Windows SDK Sample Applications

Overview

This chapter provides information about testing and evaluation of the Zebra Scanner SDK's software components using the test utilities provided in the SDK.

NOTE For the attributes (parameters) applicable to a specific scanner, refer to the Product Reference Guide . Product Reference Guides may also contain an appendix listing the generic non-parameter attributes supported on most Zebra scanners.


Test Utilities Provided in the SDK

The Zebra Scanner SDK includes the following test utilities:

  • Zebra Scanner SDK C++ Sample Application
  • Zebra Scanner SDK C# .Net Sample Application

Each test utility demonstrates the main functionalities of the SDK. You can gain an understanding of the Zebra Scanner SDK using these test utilities. This section also describes how to use the test utilities' functionality.

NOTE You may need to install the Microsoft®.Net Framework v2.0 or later to execute C# .Net Sample application. If so, Microsoft detects and informs the user of this requirement.

The Zebra Scanner SDK Test Utilities support the following functionality:

  • Discovery of asset tracking information
  • Scan a bar code
  • Capture Image and Video
  • Capture documents with Intelligent Document Capture (IDC)
  • Attribute query and setting
  • Host Variant switching
  • Firmware upgrade.

Scanner SDK C++ Sample Application

The Scanner SDK C++ Sample Application enables you to simulate an application that communicates with the Scanner SDK. The utility demonstrates the functionality of the SDK. It includes C++ source code and its solution and project files for further reference.

Figure 1 C++ Sample Application

Scanner SDK C#.Net Sample Application

The Scanner SDK C#.Net Sample Application enables you to simulate an application that communicates with the Scanner SDK. The utility demonstrates the functionality of the SDK. It includes C#.Net source code and its solution and project files for further reference.

Figure 2 C#.Net Sample Application

Table 1 Test Utility Buttons and Fields by Tab Screen

Button for Field Description
Discover Scanners Invokes Open, GetScanners methods and register for all the events.
Select Scanner Select the scanner you want to invoke the command
Connected Scanners List all the connected scanners regardless of the mode
Pull Trigger Soft Pull Trigger the scanner for Bar code, Image and Video actions
Release Trigger Soft Release Trigger the scanner for Bar code, Image and Video actions
Bar Code Tab
Flush Macro PDF Flush Macro PDF bar code buffer
Abort Macro PDF Abort Macro PDF continues read
Clear Clear the Bar code data area
Decoded Bar Code Display label value of the scanned bar code
Symbology Display the symbology of scanned bar code
Enable Emulation Enable Simulated HID Keyboard Output
Image/Video Tab
Image Invoke image capture mode
Video Invoke video capture mode
Abort Transfer Abort Image Transfer on serial scanners
Image Type Select JPG, TIFF or BMP image type
Enable Video View Finder Enable the view finder in image mode
Save Image Save the captured image
IDC Tab
Get Display value of the IDC-related parameter in the drop down menu
Set Temporarily set the value of the IDC-related parameter in the drop down menu
Store Permanently store the value of the IDC-related parameter in the drop down menu
Value Field to display, and enter an IDC-related parameter value
Decode Data Value of linked or anchor bar code data
Symbology Symbology of linked or anchor bar code
Use HID Specify HID channel for data transmission (instead of the default BULK channel)
Clear Clears all the fields
Scanner Actions Tab
Enable/Disable Scanner Enable/Disable the scanner for data/image/video capture initiation
Aim Switch on and off Aim control of the scanner
Beeper Beep the peeper of the scanner
Reboot Scanner Reboot the scanner
LED Light the LED(s) on the scanner
Switch Host Variant Switch the scanner host type from current type to desired type; the user has the option to select silent feature and variant change persistent and non-persistent.
RSM Tab
Get All IDs Get all supported attribute IDs from the selected scanner
Get Value Select one or more attribute IDs and get the value for them
Next Value Get the next attributes value given the current attribute number
Store Value Store value(s) for selected attribute(s)
Set Value Set value(s) for selected attribute(s)
Select All Select all the attribute IDs at the RSM data viewer
Clear All Clear all the attribute data at the RSM data viewer
Clear All Values Clear all the attribute values at the RSM data viewer (C# only)
Clear Value Clear a selected attribute value at the RSM data viewer (C# only)
Advanced Tab
Firmware Update Options Updated firmware and launch the new firmware on the scanner
Browse Browse the Firmware file (*.DAT) or Plug-in file (*.SCNPLG)
Update Initiate firmware update process
Abort If you want to abort firmware update process
Launch Once firmware update finishes launch the new firmware in the scanner
Claim Scanner Exclusively claim and declaim the scanner for this application
Miscellaneous Tab
SDK Version Get the scanner SDK version
Get Device Topology Get the scanner device topology, this is useful to get an idea of scanner topology for cascaded scanners
Serial Interface Settings Serial interface settings for serial scanners
Scale Tab
Read Weight Read the weight of the item on the scale
Zero Scale Zero the scale
Reset Scale Reset the scale
Weight Measured Weight of the item (Pounds or Kilograms)
Weight Unit Weight mode of the scale (English or Metric)
Logs Tab
Event Log Command and event log, logs commands initiated
XML Log Displays Output of each function if an output exists
Clear Event Log Clear command and event log area
Clear XML Log Clear XML log area

NOTE The SDK Sample Application in the latest release of the Scanner SDK for Windows implements a ScanToConnect tab. The ScanToConnect feature enables a Zebra cordless Bluetooth scanner to pair directly to a PC/tablet by scanning an on-screen bar code, replacing the need for a paper pairing label. This paperless pairing solution wirelessly connects the scanner directly to the host, without the need for a cradle.

NOTE Sample source code for the ScanToConnect tab is included with installation of the SDK Sample Application. For further information on this functionality, contact the Zebra Technologies Global Customer Support Center at: www.zebra.com/support


How to Verify Scanner SDK Functionality

This section guides you through a series of use cases and test cases of the Zebra Scanner SDK and its functionality.

See Basic Installation Verification for more information

Scanner Discovery / Asset Tracking Information / Validating Successful SDK Installation

  1. Connect a Zebra USB scanner(s) to the computer and put the scanner into USB OPOS (Hand Held) or USB SNAPI mode by scanning one of the bar codes below.

    USB (IBM Hand-Held)
    USB (IBM Hand-Held)
  2. Launch the Zebra Scanner SDK Sample Utility by selecting Start > All Programs > Zebra Scanner > Scanner SDK > Scanner SDK Sample Application (C++)"or Scanner SDK Sample Application (C#.Net).

    Figure 3 Start Scanner SDK Sample Application (C++) or C# .Net
  3. Click Discover Scanners to display all the connected scanners in the Connected Scanners area
  4. Clicking Discover Scanners in the sample application executes an Open for all types of scanners and an ExecCommand with the REGISTER_FOR_EVENTS method using the following XML and a GetScanners API call:

    
    <inArgs>
        <cmdArgs>
            <arg-int>6</arg-int>
            <arg-int>1,2,4,8,16,32</arg-int>
        </cmdArgs>
    </inArgs>
    
    

NOTE The first <inArgs> tag in the XML is filled with the number of events you want to register. In the example above, number of event it wants to register is "6". The second tag is filled with the event ids that you want to register separated by the commas (","). See event IDs in table below.

Table 2 Supported Event IDs

Event Name Event ID
SUBSCRIBE_BARCODE 1
SUBSCRIBE_IMAGE 2
SUBSCRIBE_VIDEO 4
SUBSCRIBE_RMD 8
SUBSCRIBE_PNP 16
SUBSCRIBE_OTHER 32

  1. The GetScanners API call produces XML code as follows:

    
    <?xml version="1.0" encoding="UTF-8" ?>
    <scanners>
        <scanner type="SNAPI"> 
            <scannerID>1</scannerID> 
            <serialnumber>7116000501003</serialnumber>
            <GUID>A2E647DED2163545B18BCEBD0A2A133D</GUID> 
            <VID>1504</VID>
            <PID>6400</PID>
            <modelnumber>DS670-SR20001ZZR</modelnumber>
            <DoM>27APR07</DoM>
            <firmware>NBRPUAAC</firmware>
        </scanner>
    </scanners>
    
    

    Table 3 Data Representation of the GetScanners Output in this Example

    Scanner Information Value Description
    Scanner ID 1 A unique ID assigned for a scanner from the SDK; any scanner specific method execute from ExecCommand should point to a scanner ID
    Serial Number 7116000501003 Device serial number printed on the label
    Model Number DS670-SR20001ZZR Device model number
    Date of Manufacture 27APR07 Device date of manufacture
    Firmware Version NBRPUAAC Current firmware version
    H/W GUID A2E647DED2163545B18BCEBD0A2A133D Hardware unique ID

  2. The XML consists of the scanner type, scanner ID, serial number, GUID, VID, PID, model number, date of manufacture and firmware version of the connected scanners.

    All discovered scanners are presented in the Connected Scanners window by processing the XML received from the GetScanners command along with their asset tracking information returned by querying device parameters. The detection of scanners indicates the SDK was installed successfully. Click Discover Scanners to display the connected scanners.

    Figure 4 Connected Scanners

Bar Code Scanning

  1. Connect and discover a scanner (see Scanner Discovery / Asset Tracking Information / Validating Successful SDK Installation).
  2. Scan a bar code and its decoded data is returned in the form of XML data and displayed on the Barcode tab. To illustrate the typical implementation, the sample application also displays only the "Bar code" data below the XML data.

    Figure 5 Decoded Bar Code Data

Example

  1. Scan the following sample bar code after discovering the scanner in the sample application (see Scanner Discovery / Asset Tracking Information / Validating Successful SDK Installation).

    UPC-A 0-1234567891-2
  2. The following XML is returned:

    
    <?xml version="1.0" encoding="UTF-8" ?>
    <outArgs>
        <scannerID>2</scannerID>
        <arg-xml>
            <scandata>
                <modelnumber>DS670-SR20001ZZR</modelnumber>
                <serialnumber>7116000501003</serialnumber>
                <GUID>A2E647DED2163545B18BCEBD0A2A133D</GUID>
                <datatype>8</datatype>
                <datalabel>0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x31 0x32</datalabel>
                <rawdata>0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x31 0x32</rawdata>
            </scandata>
        </arg-xml>
    </outArgs>
    
    
  3. By processing the XML above, the sample application displays the decoded bar code in the Decoded Bar code text box and the symbology in the Symbology text box.

Language/Locale Details

  1. Toggle the Enable Emulation check box to enable/disable Simulated HID Keyboard Output.
  2. Select the language locale from the drop down menu.

    The sample application first retrieves the current config.xml file (see Simulated HID Keyboard Output by executing an ExecCommand API call with the KEYBOARD_EMULATOR_GET_CONFIG method and an empty inXML. It receives outXML as shown below:

    inXML:

    
    <inArgs></inArgs>
    
    

    outXML:

    
    <outArgs>
        <arg-xml>
            <KeyEnumState>1</KeyEnumState>
            <KeyEnumLocale>0</KeyEnumLocale>
        </arg-xml>
    </outArgs>
    
    

    The sample application processes the XML above and populates the user interface. The <KeyEnumState> tag indicates the current state of Simulated HID Keyboard Output, where enabled = 1 and disabled = 0. The <KeyEnumLocale> tag indicates the language locale number currently active with the CoreScanner service. The value of "0" above indicates English.

    Use the ExecCommand API call with the KEYBOARD_EMULATOR_ENABLE method and following inXML to enable/disable Simulated HID Keyboard Output.

    
    <inArgs>
        <cmdArgs>
            <arg-bool>TRUE</arg-bool>
        </cmdArgs>
    </inArgs>
    
    

    To enable HID KB Emulator use "TRUE" in <arg-bool> tags and "FALSE" to disable it.

    
    <inArgs>
        <cmdArgs>
            <arg-int>1</arg-int>
        </cmdArgs>
    </inArgs>
    
    

    Use the ExecCommand API call with the KEYBOARD_EMULATOR_SET_LOCALE method and following inXML to change the language locale.

    Set the <KeyEnumLocale> tag value to "1" for French and "0" for English.

Capture Image and Video

  1. Connect and discover an imaging scanner (see Scanner Discovery / Asset Tracking Information / Validating Successful SDK Installation).
  2. Select a "SNAPI" mode scanner ID from the Select Scanner drop-down box. Your selection is then reflected in the Connected Scanners window.

    NOTE If no SNAPI scanner is shown in the Connected Scanners window, you must connect an imaging scanner that supports image/video transfer. For an up-to-date table listing scanner models and their supported communication modes refer to the Scanner SDK for Windows website at: www.zebra.com/scannersdkforwindows

    Alternatively, select "SNAPI" mode scanner in the Connected Scanners area. Your selected Scanner's ID is displayed in the Select Scanner drop-down combo box.

    Figure 6 Scanner Selection
  3. Go to the Image & Video tab.
  4. Select an image type of JPG, TIFF or BMP.
  5. Selecting the image type in the sample application executes an ExecCommand API call using the DEVICE_SET_PARAMETERS method and following XML code:

    
    <inArgs>
        <scannerID>1</scannerID>
        <cmdArgs>
            <arg-xml>
                <attrib_list>
                    <attribute>
                        <id>304</id>
                        <datatype>B</datatype>
                        <value>4</value>
                    </attribute>
                </attrib_list>
            </arg-xml>
        </cmdArgs>
    </inArgs>
    
    

    NOTE The <scannerID> tag in the XML is filled with the scanner’s ID selected in the Connected Scanners list of the sample application. The <id> tag contains the image file type parameter of the selected scanner. In the XML example above, this value is 304. The value 4 indicates the image type the user should get from the scanner. See the following table for valid Image Types.

    Table 4 Image Types

    Image Type Value
    BMP_FILE_SELECTION 3
    TIFF_FILE_SELECTION 4
    JPEG_FILE_SELECTION 1

    NOTE These values may change with the scanner model. Refer to the scanner Product Reference Guide for more information on scanner parameters. For more information about parameter settings, see Parameter Setting (Device Configuration) on page 4-21

  6. Check Enable Video View Finder and click either Image to put the scanner into image capture mode or Video to put the scanner into video capture mode.
  7. Checking Enable Video View Finder in the sample application executes an ExecCommand API call with the DEVICE_SET_PARAMETERS method and following XML code:

    
    <inArgs>
        <scannerID>1</scannerID>
        <cmdArgs>
            <arg-xml>
                <attrib_list>
                    <attribute>
                        <id>324</id>
                        <datatype>B</datatype>
                        <value>1</value>
                    </attribute>
                </attrib_list>
            </arg-xml>
        </cmdArgs>
    </inArgs>
    
    

    NOTE The <scannerID> tag in the XML contains the selected scanner’s ID from the Connected Scanners list of the sample application. The <id> tag contains the video view finder parameter number of the scanner and value 1 indicates that the view finder is enabled. A value “0” indicates the view finder is disabled.

  8. Click Image in the sample application. Image executes an ExecCommand API call using the DEVICE_CAPTURE_IMAGE method with the XML code below. Click Video to execute an ExecCommand API call using the DEVICE_CAPTURE_VIDEO method with the following XML code.

    
    <inArgs>
        <scannerID>1</scannerID>
    </inArgs>
    
    
  9. Click Pull Trigger on the bottom left side of the utility to capture an image. If the scanner was place into video capture mode in the previous step, click Pull Trigger once to start video capture and click Release Trigger to stop video capture.
  10. Clicking Pull Trigger or Release Trigger in the sample application executes an ExecCommand API call using the corresponding DEVICE_PULL_TRIGGER or DEVICE_RELEASE_TRIGGER method with the following XML code

    
    <inArgs>
        <scannerID>1</scannerID>
    </inArgs>
    
    

    NOTE You can use the trigger on the scanner to start and stop image or video capture instead of the soft trigger buttons provided in the sample utility.

    Figure 7 Captured Image Displayed on the Image & Video Tab
  11. If you registered with ImageEvent (see Register for COM Events on page 5-2) you receive an image event for the performed pull trigger when in image mode.
  12. 12. If you registered with VideoEvent (see Register for COM Events on page 5-2) you receive a video event for the performed pull trigger when in video mode.

Beep the Beeper

Zebra scanners are capable of sounding the beeper by invoking the Beeper method from the host system.

  1. Connect and discover a scanner (see Scanner Discovery / Asset Tracking Information / Validating Successful SDK Installation).
  2. Select a "SNAPI" or "OPOS/IBM OPOS" mode scanner ID from the Select Scanner drop-down box. Your selection is reflected in the Connected Scanners window (see Figure 6).
  3. Select the desired beep sequence from the list defined on the Scanner Actions tab as shown below.

    Figure 8 Beep Values
  4. Click Beep
  5. Clicking Beep in the sample application executes an ExecCommand API call with the SET_ACTION method and following XML code:

    
    <inArgs>
        <scannerID>1</scannerID>
        <cmdArgs>
            <arg-int>2</arg-int>
        </cmdArgs>
    </inArgs>
    
    

    NOTE The <scannerID> tag in the XML is filled with the scanner’s ID selected in the Connected Scanners list of the sample application. The <arg-int> tag in the XML is filled with the beep’s ID selected in the Beeper drop-down list shown in Figure 4-10 on page 4-19.

  6. You can sound any of the beeps by changing the value of the tag in the XML code. Successful execution of the command returns the status parameter as "0".

Scan Scan Write

Scan Scan Write can be used to "commission" tags (change the Serial Number and EPC id). This information gets written to the tag. Scan Scan Write works with all interfaces (except Keyboard Wedge) but SNAPI is recommended.

NOTE: The new tab control will be visible only when a DS9908R device is connected and selected from the list of barcode scanners currently connected to the demo application.

Follow these steps.

  1. Download the latest version of the Zebra CoreScanner Driver and Zebra Scanner SDK for Windows from zebra.com.
  2. Set the USB Device Type to "SNAPI" (with or without imaging) on the DS990R and connect it to your PC.
  3. Open the Scanner SDK C# Sample Applications app.
  4. Select "Discover Scanners". DS9908-xxxxxxxxxxx will appear in the "Connected Scanners List".

    Select the "Scan Scan Write" tab you will see a screen similar to the one below.

    NOTE: The new tab control will be visible only when a DS9908R device is connected and selected from the list of barcode scanners currently connected to the demo application.

    Figure 9 Device Discovery
  5. Scan the RFID tag. The Existing EPC id, Filter value, Position, Serial Number and User Bank data (if applicable) will be populated. See screen shot below.

    Figure 10 Scan RFID Tag
  6. Scan the barcode. The Scan Barcode and New EPC id will be populated. See screen shot below.

    Figure 11 Scan Barcode
  7. Edit the Serial Number if desired. New EPC id will change to reflect the new Serial Number.

    Figure 12 Edit Serial Number
  8. Rescan the RFID tag and select "Write tag". The new EPC id will be written to the RFID tag. A green checkmark will appear after the new EPC id. Or red X if.

    Figure 13 Write Tag
  9. Select "Clear" to clear the fields.

    Figure 14 Clear Fields
  10. Rescan the RFID tag and Select "verify tag" to verify the contents.

    Figure 15 Verify Tag