GetAndSet Utility

Overview

Each scanner has an attribute list which can be accessed by the user. There are 3 types of operations that can be performed over the attribute list. They are get, set and store.

GetAndSet application enables the user to access the attribute list of the connected scanner. GetAndSet does the following operations when executed as an application.

  1. Get attributes values for corresponding attributes ids.
  2. Set the attribute values temporarily.
  3. Store the attribute values permanently.

Prerequisites

  1. CoreScanner SDK should be installed in the system.
  2. gcc package.

GetAndSet Binary Command

There are 3 files in the distribution package.

  1. GetAndSet - The binary application by which user can access the scanner attributes.
  2. getandset.sh - This is a sample script which runs the GetAndSet binary internally. The user can use it as a reference to build their application on top of it.
  3. sample_xml_files/sample_input_getandset.xml - A sample input xml file which contains the information of attributes ids which need to be read from scanner and written to scanner.

Execute the GetandSet binary by providing the input xml file along with the path. ./GetandSet <path>/sample_input_getandset.xml User can find sample_input_getandset.xml under sample_xml_files directory for reference.

Note: By default, the output xml file gets stored under newly created directory output_xml_file in the current path. The path to store the output_xml_file can be changed by modifying the environment variable ZEBRA_GETANDSET_OUTPUT_PATH. This can be done by the following command:


export ZEBRA_GETANDSET_OUTPUT_PATH=<PATH>


Using getandset.sh Script

  1. Open the script file with your favorite editor.
  2. Make sure that the variable get_and_set_binary_location points to the directory which has GetAndSet binary variable. If this variable is empty, the script looks for the GetAndSet variable in the current directory and in the paths defined in the $PATH environment variable.
  3. Please provide the input xml file name with the full path as argument while running the script.
  4. By default, the output xml file gets stored under newly created directory output_xml_file in the current path, since the ZEBRA_GETANDSET_OUTPUT_PATH environment variable is empty. The path to store the "output_xml_file" can be changed by modifying the environment variable ZEBRA_GETANDSET_OUTPUT_PATH. The ZEBRA_GETANDSET_OUTPUT_PATH needs to be set in the script if the script is being used for GetandSet execution.
  5. Run the script,
  6. 
    getandsetatt.sh <PATH>/sample_input_getandset.xml
    
    


Input XML File

A reference input xml file can be found in the sample_xml_file directory.


<?xml version="1.0" encoding="utf-8"?>
<main-tag>
    <scanner>
        <model>DS8108-SR00006ZZWW</model> 
        <serial-number>123456789</serial-number>
        <output-filename-tag>xyz</output-filename-tag>
    </scanner>
    <get-attributes-configuration>
        <attrib_list>392, 33, 44</attrib_list> 
    </get-attributes-configuration>
    <store-attributes-configuration>
        <attrib_list>
            <attribute>
                <id>392</id>
                <datatype>A</datatype>
                <value>0x00</value>
            </attribute>
            <attribute>
                <id>135</id>
                <datatype>A</datatype>
                <value>0x03</value>
            </attribute>
            <attribute>
                <id>235</id>
                <datatype>B</datatype>
                <value>1</value>
            </attribute>
            <attribute>
                <id>111</id>
                <datatype>B</datatype>
                <value>10</value>
            </attribute>
        </attrib_list>
    </store-attributes-configuration>
    <set-attributes-configuration>
        <attrib_list>
            <attribute>
                <id>445</id>
                <datatype>A</datatype>
                <value>0x00 </value>
            </attribute>
            <attribute>
                <id>135</id>
                <datatype>A</datatype>
                <value>0x03</value>
            </attribute>
            <attribute>
                <id>235</id>
                <datatype>B</datatype>
                <value>1</value>
            </attribute>
            <attribute>
                <id>1341</id>
                <datatype>B</datatype>
                <value>10</value>
            </attribute>
        </attrib_list>
    </set-attributes-configuration>
</main-tag>

User can edit the file according to his/her need. The GetAndSet Utility reads this file and carries on the execution process. Please note that the user has to provide the model number of the scanner that needs to be communicated with. Serial number is used to identify the device if more than one scanner of the same model is connected.

output-filename-tag is attached to the output xml file name if get attribute is requested.

Attributes to get, set and store can be modified under the get-attributes-configuration, set-attributes-configuration and store-attributes-configuration tags accordingly.

Get Attribute

To read a single or multiple attribute values from the scanner the user must provide the list of attribute ids which need to be read in the input xml file inside <get-attributes-configuration> tag enclosed with <attrib_list> as shown below.


<get-attributes-configuration>
    <attrib_list>392, 33, 44</attrib_list>
</get-attributes-configuration>

Set Attribute

To write a single or multiple attribute values to the scanner temporarily, the user has to provide the list of attribute ids which need to be written to the scanner in the input xml file, inside <set-attributes-configuration> tag enclosed with <attrib_list> as shown below.


<set-attributes-configuration>
    <attrib_list>
        <attribute>
            <id>445</id>
            <datatype>A</datatype>
            <value>0x00 </value>
        </attribute>
        <attribute>
            <id>135</id>
            <datatype>A</datatype>
            <value>0x03 </value>
        </attribute>
        <attribute>
            <id>235</id>
            <datatype>B</datatype>
            <value>1</value>
        </attribute>
        <attribute>
            <id>1341</id>
            <datatype>B</datatype>
            <value>10</value>
        </attribute>
    </attrib_list>
</set-attributes-configuration>

Please note that setting an attribute value has a temporary effect on the scanner. Once the scanner is rebooted, the set value gets erased. if the user wants to set the value permanently then please use store attribute which is explained in the next section.

Store Attribute

To write a single or multiple attribute values to the scanner permanently, the user has to provide the list of attribute ids which need to be written to the scanner in the input xml file, inside <store-attributes-configuration> tag enclosed with <attrib_list> as shown below.


<store-attributes-configuration>
    <attrib_list>
        <attribute>
            <id>392</id>
            <datatype>A</datatype>
            <value>0x00 </value>
        </attribute>
        <attribute>
            <id>135</id>
            <datatype>A</datatype>
            <value>0x03 </value>
        </attribute>
        <attribute>
            <id>235</id>
            <datatype>B</datatype>
            <value>1</value>
        </attribute>
        <attribute>
            <id>111</id>
            <datatype>B</datatype>
            <value>10</value>
        </attribute>
    </attrib_list>
</store-attributes-configuration>

Output XML

Output xml file is created for the requested attribute ids in the get-attributes-configuration tag of the input xml file.

By default, the output xml file gets stored under newly created directory output_xml_file in the current path since the ZEBRA_GETANDSET_OUTPUT_PATH environment variable is empty. The path to store the "output_xml_file" can be changed by modifying the environment variable ZEBRA_GETANDSET_OUTPUT_PATH.


<?xml version="1.0" encoding="utf-8"?>
<main-tag>
    <scanner>
        <model>DS8108-SR00006ZZWW</model> 
        <serial-number> </serial-number>
    </scanner>
    <attributes-from-scanner>
        <attrib_list>
            <attribute>
                <id>392</id>
                <datatype>A</datatype>
                <value>0x00 </value>
            </attribute>
            <attribute>
                <id>33</id>
                <datatype>A</datatype>
                <value>0x03 </value>
            </attribute>
            <attribute>
                <id>44</id>
                <datatype>B</datatype>
                <value>1</value>
            </attribute>
        </attrib_list>
    <attributes-from-scanner>
</main-tag>


Output File Name Format

Each output file will have a Model number, Serial number, Time stamp and the tag. The tag is provided by the user in the input xml file.

The filename of the output xml file has the following format:

MODELNUMBER_SERIALNUMBER_DATE_TIME_TAG.xml

For example:

DS8108-SR00006ZZWW_123456789_2021-12-14_15-55-33_xyz.xml

Note: This application only supports directly connected scanners.