RP457c
USB On The Go (OTG) Requirements
RP457c firmware must be 8.55 or later.
Android device must support USB OTG connectivity.
USB OTG adapter must be used to connect using USB.
note
- USB OTG connecter cannot be used to establish bluetooth pairing. Only audio connection can be used to establish a trusted bluetooth connection.
- RP457c will not charge over the USB OTG connecter or audio connection.
Pairing a ROAM RP457c Card Reader
If you are using a ROAM RP457c reader, in addition to the audio connection, you can also pair the reader to your device over a Bluetooth connection. In order to do this, you must first connect over the audio connection. While you have this connection maintained, you will be able to pair over bluetooth using the card reader interface provided to you when you first made the audio connection. Once you pair the ROAM reader over bluetooth, you can unplug the reader from the audio jack and the next connection that you make will be over bluetooth.
note
Pairing can only occur when connected via audio jack. USB On the Go connections do not support pairing.
Java
When pairing to Android devices, you will first connect the RP457c via audio jack. Once the audio connection completes, you may pair the RP457c via Bluetooth by using the findPairableDevices
call to search for any pairable devices, followed by the pair command to actually complete the pairing process. When you attempt to pair the device, you will get a system prompt from Android for you to confirm a passkey to pair the RP457c. Select Ok from this prompt to complete the pairing process. Once you have succesfully paired your RP457c device, you can connect via Bluetooth without having to use the audio connection going forward. If a paired RP457c device is plugged into the Android device, the audio connection will be used instead of Bluetooth.
Code Sample - Simplified Flow
Refer to the sample application source code for more information.
account.getCardReaders().findPairableDevices(new ECLDevicesSearchingListener()
{
@Override
public void uponSearchingDevice(ECLConnectionMethod eclConnectionMethod)
{
}
@Override
public void devicesSearchFound(String name, ECLDeviceConnectionType eclDeviceConnectionType)
{
}
@Override
public void devicesSearchDone(final List<ECLDeviceSearchResult> list)
{
handler.post(new Runnable()
{
@Override
public void run()
{
if (list.size() > 0)
{
List<String> deviceNames = new ArrayList<>();
for (ECLDeviceSearchResult result : list)
{
deviceNames.add(result.getName());
}
// For simplified flow, just use first pairable search result found
ECLDeviceSearchResult searchResult = list.get(0);
ECLDeviceInterface deviceInterface = account.getCardReaders()
.setDeviceToUse(searchResult.getName(), searchResult.getConnectionTypes());
if (deviceInterface != null)
{
deviceInterface.pair(new ECLDevicePairingListener()
{
@Override
public void devicePairingSucceeded(ECLDeviceInterface device)
{
if (device instanceof ECLCardReaderInterface)
{
showMessage(((ECLCardReaderInterface) device).getName()
+ " Paired Succesfully");
}
else
{
showMessage("Paired!");
}
}
@Override
public void devicePairingFailed(ECLDeviceInterface device, final ECCError error)
{
showMessage("Failed to pair: " + error.getDebugDescription());
}
@Override
public void devicePairingProgress(ECLDeviceInterface device,
final ECLTransactionProgress progress)
{
handler.post(new Runnable()
{
@Override
public void run()
{
displayMessageInProgressView(
"device pairing Progress: " + progress.toString(), false);
}
});
}
});
}
}
else
{
showMessage("No card readers to pair");
}
}
});
}
}, 30);
Objective-C
When pairing to iOS devices, you will have to follow slightly different steps from Android devices. After you call the pair fuction on the card reader, you need to exit your application and go to the iOS settings of your device. Under the bluetooth settings, you would click on the ROAM device that you want to pair. At this point, Commerce SDK will call one of the delegate methods of the pair function - devicePairingPasscode:(NSString *)passcode
, which contains the passcode that iOS will ask you to match. One way to display this passcode to the user would be to use a UILocalNotification
sent by your application when the user clicks on the ROAM device they want to pair. You can see the example code below.
Once the user confirms that the passcode is correct, the iOS device should display Connected in the BT settings. At this point the user can go back to the application, unplug the ROAM reader from the audio jack, and connect over bluetooth.
note
In order for your application to communicate to the ROAM reader over audio and bluetooth, you need to set several properties in your Xcode project. Refer to Step 8 of Set Up the Xcode Project to Use Commerce SDK to see which properties need to be set.
Code Sample - Simplified Flow
Refer to the sample application source code for more information.
// get the card reader instance that currently holds an audio connection
// you will have this if you connected over the transactional API or via findDevices
id<ECLCardReaderProtocol> cardReader = [[_account cardReaders] selectedDevice];
// call the pair function
[cardReader pair:self];
// in this case we made the current class receive the pair callbacks (note the reference to "self" above)
...
// the implementation of the pair callback
+ (void)devicePairingSucceeded {
dispatch_async(dispatch_get_main_queue(), ^{
[self addStatusString:@"Reader paired\n"];
});
}
+ (void)devicePairingFailed {
dispatch_async(dispatch_get_main_queue(), ^{
[self addStatusString:@"Reader pairing failed\n"];
});
}
+ (void)devicePairingNotSupported {
dispatch_async(dispatch_get_main_queue(), ^{
[self addStatusString:@"Reader pairing not supported\n"];
});
}
// this will get called when the user clicks on the roam device they want to pair in the iOS bluetooth settings
// iOS will display a passcode which should be the same as the one returned here
+ (void)devicePairingPasscode:(NSString *)passcode {
dispatch_async(dispatch_get_main_queue(), ^{
// send a notification to the user so they know the passcode matches the one displayed by iOS in the BT settings
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = passcode;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
});
}