Moby/5500
Pairing a Moby/5500 Card Reader
For mobile application use (iOS and Android), the Moby/5500 can be used over a Bluetooth connection. In order to pair the Moby/5500 to the mobile device, you need to use the existing findDevices
API to find the reader first, and then setup a pairing listener for that device. When you call ’connectAndInitialize` on that device, you will see a pairing dialog displayed by iOS and Android. The user should click pair and then press the power/bluetooth button on the Moby/5500. This will display a sequence of LED lights on the Moby/5500. The same sequence will be returned back to the application via the pairing listener. The application can then display the sequence for the user to confirm. Once confirmed, the pairing process will be completed.
Overview of pairing steps:
Call
findDevices
API using the commerce account.When device search returns with Moby/5500, call
selectDevice
API to set it as the active device.Setup the LED pairing listener on the card reader interface returned from
selectDevice
.Call
connectAndInitialize
API.iOS/Android displays dialog to pair; user accepts.
User presses bluetooth button on the Moby/5500.
Moby/5500 displays sequence of LED lights.
The LED sequence is sent to the pairing listener.
App displays the sequence to the user. Per PCI compliance, the app is required to display the sequence so the user can confirm it.
User confirms the sequence. Bluetooth pairing is now established.
Troubleshooting Guidelines for Users
Pairing process fails
- iOS - User has to go into iOS Bluetooth settings and forget the temporarily paired reader before re-starting pairing process.
- Android - User can start pairing process again without any further steps to be done.
Reader is not initiating LED sequence
- Make sure user clicks button on Moby/5500 within 30 seconds of accepting the pairing dialog displayed by iOS/Android.
Java (Android)
Code Sample - Simplified Flow
Refer to the sample application source code for more information.
// get a hold of the cardreaders interface
ECLDevicesInterface<ECLCardReaderInterface> cardReadersInterface = eclAccountInterface.getCardReaders();
// kick off a device search and setup a listener to receive callbacks from the search
cardReadersInterface.findDevices(new ECLFindDevicesListener() {
// implementation of device search done callback
public void devicesSearchDone(List<ECLFindDevicesSearchResult> deviceSearchResults) {
...
if (deviceSearchResults.size() > 0) {
ECLFindDevicesSearchResult result = deviceSearchResults.get(0);
// set this card reader as the active device
ECLCardReaderInterface cardReaderInterface = cardReadersInterface.selectDevice(result.getName(), result.getConnectionTypes());
...
// add connection listener to receive connect and disconnect callbacks
cardReaderInterface.addConnectionListener( new CardReaderListenerAdapter(...));
if (result.getName().contains("MOB55")) {
cardReaderInterface.addDevicePairingListener(new ECLDeviceLedPairingListener() {
// the implementation of one of the pairing delegate callbacks
// User has to press the power button on Moby/5500 to display the pairing sequence before this method gets called
public void deviceLedPairingSequence(ECLDeviceInterface eclDeviceInterface, List ledSequence,
ECLLedDevicePairingConfirmationInterface eclLedDevicePairingConfirmationInterface) {
// display the sequence using com.roam.roamreaderunifiedapi.view.PairingLedView
// see LedPairingDialog of sample app for details
...
// if user confirms the sequence
eclLedDevicePairingConfirmationInterface.confirm();
}
...
}
}
...
// connect and initialize the device. if an update is necessary, perform the update.
cardReaderInterface.connectAndInitialize(true);
}
}
...
}
Objective-C
Code Sample - Simplified Flow
Refer to the sample application source code for more information.
// get a hold of card readers implementation of the devices protocol from the account and call findDevices
[[_account cardReaders] findDevices:self forceToDisconnect:true timeoutInSeconds:30];
// in this case we made the current class receive the findDevices callbacks (note the reference to "self" above)
...
// the implementation of one of the findDevices callbacks
+ (void)devicesSearchDone:(id<ECLDevicesProtocol>)devices searchResults:(NSArray<ECLFindDevicesSearchResult *> *)deviceSearchResults {
...
if ([searchResults count] > 0) {
// make this device the "active" device
ECLFindDevicesSearchResult *reader = deviceSearchResults[0];
id<ECLDeviceProtocol> selectedDevice = [devices selectDevice:reader.name withConnectionTypes:reader.connectionTypes];
id<ECLCardReaderProtocol> selectedCardReader = (id<ECLCardReaderProtocol>)selectedDevice;
// register this class to receive connection related callbacks
[selectedCardReader addConnectionDelegate:self];
// register the pairing delegate - required for Moby/5500 pairing.
[selectedCardReader addDevicePairingDelegate:self];
[selectedCardReader connectAndInitialize:YES];
...
// the implementation of one of the pairing delegate callbacks
// User has to press the power button on Moby/5500 to display the pairing sequence before this method gets called
+ (void)devicePairingLedSequence:(NSArray *)ledSequence confirmationProtocol:(id<ECLLedDevicePairingConfirmationProtocol>)confirmationProtocol {
// display the sequence using LedPairingView from RUA_MFI framework
// see LedPairingViewController of sample app for details
// if user confirms the sequence
[confirmationProtocol confirm];
}
Moby/5500 Firmware Update
When connecting to the Moby/5500 device for the first time, it may go through a firmware update if it is not already up-to-date. When the update is complete, the Moby/5500 will shutdown if it was running on battery power, in which case it will need to be manually rebooted by the user. If the Moby/5500 was not running on battery power (e.g. plugged into a power source), then it will reboot automatically after the shutdown.
CSDK will notify the integrating POS system via an API callback when the firmware update is complete so that the user can be notified to manually reboot the Moby/5500, if needed.
Java (Android)
// callback method in ECLCardReaderListener
@Override
public void cardReaderShouldManuallyReboot(ECLCardReaderInterface cardReader, boolean didUpdate)
{
if (didUpdate)
{
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Manual Reboot")
.setMessage("Card reader updated. Manual reboot may be required to complete the update.")
.setCancelable(false)
.setPositiveButton("OK", (dialog, id) -> dialog.dismiss());
builder.show();
}
}
Objective-C (iOS)
// callback method in ECLCardReaderDelegate
- (void)cardReaderShouldManuallyReboot:(id<ECLCardReaderProtocol>)cardReader didUpdate:(BOOL)didUpdate {
if (didUpdate) {
NSString *title = @"Manual Reboot";
NSString *message = @"Card reader updated. Manual reboot may be required to complete the update";
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alert addAction:ok];
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:alert animated:YES completion:nil];
});
}
}