Using a Bluetooth Ring Scanner across Multiple Applications
We have had several customers over the past year or so develop solutions that comprise Zebra Bluetooth Ring Scanners, for example the RS6000 paired with a Zebra Mobile computer such as the WT6000 and running two or more Android applications which will perform scanning. A common question is “How do I control the ring scanner across these multiple apps?” Specifically:
- Pairing with the ring scanner
- Connecting to the ring scanner
- Enabling the ring scanner (so it will scan and return scanned data)
- Switching between applications that require the ring scanner
- Switching between applications where one of those apps will use the internal scanner.
- Handling the device going to sleep or the scan engine going into sleep mode.
Managing all this yourself using the EMDK for Android or Xamarin is possible but non-trivial since there is a lot to consider. A far more straight forward approach for an application developer in this scenario is to use DataWedge to control the Bluetooth scanner. DataWedge will take care of pairing, connecting, enabling and capturing data from the scanner meaning all the application has to worry about is how to handle that data after it is captured. This not only saves time in the initial development but DataWedge could potentially save you support headaches when it comes to the implementation phase of your solution.
To demonstrate this I have put together 3 Android applications which are available on GitHub along with the DataWedge profiles which will be discussed in this post. (There are also Xamarin versions of the sample apps for Xamarin developers but to use these you will need to modify the 'associated apps' of the sample DataWedge profiles.) The scenario is as follows:
- 3 Android applications on the device need to perform scanning
- 2 of those 3 scanning applications use the RS6000 ring scanner, the remaining app uses the internal imager.
- 3 profiles are created in DataWedge, each profile associated with one of the scanning applications.
- The required scanner is specified in the profile, 2 will specify “RS6000 Bluetooth Scanner” and the remaining profile will specify “2D Barcode Imager”, which is the designation of the internal imager.
- The screenshots in this post are taken from a TC57 running Oreo but I have tested these apps and scenario all the way back to a TC75 running Lollipop.
Deploy applications to the device
To see this scenario in action, first copy the three applications available from GitHub to the device:
Application 1 | Application 2 | Application 3 | |
---|---|---|---|
Applications on device |
|
|
|
Configure DataWedge
The following screenshots show the configuration of DataWedge:
Application 1 | Application 2 | Application 3 | |
---|---|---|---|
Barcode input is enabled and the ‘Scanner selection’ specified as either RS6000 or the internal imager.
|
|
|
|
Each profile is associated with a separate application, this enables each application to have its own scanner settings. |
|
|
|
Each profile specifies to output scans via Intent but the action being received differs from application to application. This is not required but makes it more obvious what is happening.
|
|
|
|
Since the profiles for application 1 and application 2 are nearly identical, I could have probably used the same profile for both, but I wanted to make things clearer for this demo.
Pair and Connect to the RS6000 Bluetooth Scanner
The three applications and DataWedge are now correctly configured. As soon as you launch either Application 1 or Application 2 DataWedge will recognise that the RS6000 is not paired or connected and initiate the pairing. This takes away all pairing and connection worries from the application developer and if anything goes wrong, for example if the user walks out of range then DataWedge will handle the reconnection:
|
|
1. DataWedge recognises that the desired scanner is not paired or connected and initiates the pairing workflow | 2. If Bluetooth is switched off, the user is prompted to turn it on. Note: It is recommended to have previously enabled BT as part of device staging. |
|
|
3. A pairing barcode is presented to the user to scan with the RS6000 | 4. The application reports that the BT scanner is connected |
Scanning in all 3 applications
Everything is now configured to allow scanning across the 3 applications.
- Switch between applications 1 and 2 and observe that both use the RS6000 ring scanner
- Launch application 3 and observe that the RS6000 no longer scans but you can capture data using the internal imager
Application 1 | Application 2 | Application 3 |
---|---|---|
|
|
|
Application 1 after scanning a barcode with the RS6000 | Application 2 after scanning a barcode with the RS6000 | Application 3 after scanning a barcode with the internal imager. |
Conclusion
This post has shown a reasonably complicated scenario but has hopefully demonstrated that the onus on the developer to achieve this setup is not great, provided you use DataWedge to handle scanning.
You could imagine a more complicated setup, perhaps with additional applications or each application using a different scanner. DataWedge supports the internal imager, the device camera and Bluetooth scanners such as the RS507 or RS6000 as well as a selection of our handheld scanners (DS3678, LI3678 and DS2278 at the time of writing), depending on the version of DataWedge available on your device. The effort for a developer to support these additional scanners or additional applications would be at most to define additional DataWedge profiles.
For more information on the RS507 & RS6000 settings available then please refer to my previous post on the subject, this also covers the additional DataWedge configuration possible for Bluetooth scanners
Anonymous (not verified)