Automating Workflows Using the Socket Mobile CaptureSDK - White Paper

Dev Community Updates by Socket Mobile, Inc.
sdk-architecture-01

A barcode scanning workflow often requires scanning more than one barcode for a given task (i.e., a product barcode and a quantity barcode).  It would be helpful if we could protect users from themselves and ensure they scan the RIGHT barcode at the right time. 

So, how do you differentiate between the two barcodes and what can you ‘tell’ the user? 

The first scenario would be if the two barcodes are the same symbology. This is the hardest scenario to accommodate, as the only way you can differentiate the barcodes is by looking at the format of the data, which may or may not be easy to do.  

Ideally, each barcode would be a different symbology - one is a Code128 and the second is a Data Matrix.  Differentiating barcodes is very easy as all Socket Mobile barcode scanners can differentiate these.  You can solve this problem in two different ways, depending on how much feedback you want to give the user. 

Note that the methods discussed below assume you are using the scanner in Application Mode (Serial Port Profile) using the Socket Mobile SDK integrated into an application.  None of these methods will work if the scanner is in Basic mode (HID). 

The first way is to tell the scanner to ONLY recognize the first symbology you want the user to read - in this case, Code128.  You do that by disabling all other symbology types, except for Code128.  Then the scanner will only read Code128 barcodes. No matter how hard the user tries, the scanner will not read the Data Matrix barcode. However, there are no error indications. The user presses the scan button, the illumination and aiming come on, and the scanner will eventually time out and go off. Note that disabling all symbologies can be a very long process as there is no ‘intrinsic’ disable-all-symbologies command. You would have to get the list of all supported symbologies; and, since we don’t really want to disable ones that are already disabled, you get their status and disable those that require it.  It is preferable to just leave them enabled and ignore the ones that you don’t want. 

After the Code128 barcode has been read, the application can disable Code128 and enable Data Matrix, allowing the user to proceed to read the next barcode.  There is a small delay to disable one barcode and enable the second, but it shouldn’t take more than two seconds. 

The downside of this method (other than the time required to change the symbology settings on the scanner on every scan) is that there is no real feedback to the user; they don’t know why they can’t scan the barcode that is under their scanner.   

The second option is using data confirmation mode. This gives you the same control over the order in which barcodes can be read, but also provides a way to give the user feedback if they scan the wrong barcode. First, enable both symbologies. Then, put the scanner into “Application Acknowledgement” (DataConfirmation Mode Application). 

In Application Acknowledgement Mode, the scanner will not indicate a good read or bad read until instructed to do so by the application (see Barcode Validation for more information on Application Acknowledgement mode). This way the application can signal a ‘bad scan’ indication to the scanner when the user scans the wrong barcode, or a “good scan” indication if they scan the correct one!  It is up to the application to ignore the data from the barcode that is out of sequence. 

To acknowledge a scan, use the Symbology ID value that is passed to the application with each decoded data event.   

Getting the Symbology ID is code similar to the following (C#): 
 
void CaptureDecodedData(object sender, CaptureHelper.DecodedDataArgs e) 

if (LookingForCode128) 
    { 
    if (e.DecodedData.SymbologyID == ICaptureSymbology.Id.kCode128) 
              // Send positive acknowledgement 
              // Process decoded data (e.DecodedData.Data) 
    else               
// Send negative acknowledgement  
    } 

This method does not require reconfiguring the scanner after each scan, which should result in slightly better responsiveness. 

You could also allow the user to read either barcode in any order, since we can use the symbology ID to determine which barcode has been read. 

There are many workflows where two different types of barcodes must be read in a specific order. We have seen two ways to enforce this desired work flow and exemplified the importance in providing feedback to the user. The symbology ID is the most effective way to provide feedback and ensure the right data goes to the right place.