External Device

Modified on Tue, 12 Nov at 3:40 PM

External Device

Request Binding 

Pairs an external device.

Identifier: request_binding

Elements

  • device_id:The ID of the device you want to pair. For xBands, this is the data matrix code attached to the band.
    • Required: True
    • Default Value: Empty
  • timeout_ms:Timeout in milliseconds after which an event is initiated.
    • Required: Depends
    • Default Value: Empty

Output

  • TIMEOUT: If there is no success within the specified time, a timeout event will be started.

Example

<action id="bind_device" type="request_binding">
    <param name="device_id">#{external_device_id}</param>
    <param name="timeout_ms" type="long">10000</param>
</action>

Validating the connection

Since the action has no "SUCCESS" output, you need to validate the connection. This can be done as shown in this example:

<rule id="device_connected">
    <expression> <![CDATA[#{extdevices.CONNECTION_STATUS} == #{const:extdevices.CONNECTED}]]> </expression>
    <actions>
        <action ref="my_action" />
    </actions>
</rule>

Connecting Zebra printer

Attempts to connect and send print content to a Zebra printer.

Identifier: print_zebra_label

Action type

  • print_zebra_label:
    • Required: Yes

Parameters

  • type: The type of connection that will be made with the printer
    • Type: String
    • Required: Yes
    • Default Value: Empty string
    • Valid Values: TCP, Bluetooth
  • format: The format the printer is set to use
    • Type: String
    • Required: Yes
    • Default Value: Empty string
    • Valid Values: ZPL, CPCL
  • content: The data sent to be printed (i.e. a printer label)
    • Type: String
    • Required: Yes
    • Default Value: Empty string

For TCP connection type

  • ipaddress:
    • Type: String
    • Required: Yes
    • Default Value: Empty string
  • port: The port that the printer is configured to use
    • Type: String
    • Required: No
    • Default Value: If not specified then either 9100 (ZPL) or 6101 (CPCL) will be used

For Bluetooth Connection type

  • mac: The Bluetooth MAC address of the printer used with or without ':' separator
    • Type: String
    • Required: Yes
    • Default Value: Empty string
  • bt_secure:Used to make a secure connection that requires accepting a paring request on both devices
    • Type: Boolean
    • Required: No
    • Default Value: False

Minimal TCP example:

<action id="print_label" type="print_zebra_label">
    <param name="type">tcp</param>
    <param name="format">cpcl</param>
    <param name="ipaddress">10.10.10.10</param>
    <param name="port">2020</param>
    <param name="content"><![CDATA[ ?{
    var msg = "\n" +
    "! 0 200 200 210 1\r\n" +
    "TONE 99\r\n" +
    "SPEED 98\r\n" +
    "T 4 0 0 80 TEST 1234\r\n" +
    "FORM\r\n" +
    "PRINT";
    msg}? ]]></param></action>

Minimal Bluetooth example:

<action id="print_label" type="print_zebra_label">
    <param name="type">bluetooth</param>
    <param name="format">cpcl</param>
    <param name="mac"> 48:A4:93:02:CB:F1</param>
    <param name="content"><![CDATA[ ?{
    var msg = "\n" +
    "! 0 200 200 210 1\r\n" +
    "TONE 99\r\n" +
    "SPEED 98\r\n" +
    "T 4 0 0 80 TEST 1234\r\n" +
    "FORM\r\n" +
    "PRINT";
    msg
    }? ]]></param>

</action>

Release Binding

Releases the pairing of the specified device.

Note: If you want to release all external devices, use the release_all_bindings action instead.

Identifier: release_binding

Elements

  • device_id:Contains the ID of the external device you want to release.
    • Required: Yes
    • Default Value: Empty

Examples

<action id="release_device" type="release_binding">    
    <param name="device_id">#{external_device_id}</param> 
</action>

Send External Device Configuration

Enables you to configure the behaviour of the xBand to your devices (e.g., vibrations and beeping sounds).

Identifier: send_external_device_configuration

Elements

  • configuration:Contains the configuration values (see below) separated by commas.
    • Required: Yes

Configuration values

Note: Make sure that there are no spaces in the list and values for all keys are given.

  • DEFAULT_SCAN_BEEP:Used to configure the beeping sound the xBand device makes after each scan.
    • Possible values: NONE, SHORT, POSITIVE, NEGATIVE, CONNECT, DISCONNECT
  • POSITIVE_BEEP: Used to configure the beeping sound if the workflow sends a positive command to the xBand.
  • Possible values: NONE, SHORT, POSITIVE, NEGATIVE, CONNECT, DISCONNECT
  • NEGATIVE_BEEP: Used to configure the beeping sound if the workflow sends a negative command to the xBand.
  • Possible values: NONE, SHORT, POSITIVE, NEGATIVE, CONNECT, DISCONNECT
    • DEFAULT_SCAN_VIBRATION: Used to configure the vibration the xBand makes after each scan.
    • Possible values: NONE, SHORT, LONG, DOUBLE
  • POSITIVE_VIBRATION: Used to configure the vibration for cases where the workflow sends a positive command to the xBand.
  • Possible values: NONE, SHORT, LONG, DOUBLE
    • NEGATIVE_VIBRATION: Used to configure the vibration for cases where the workflow sends a negative command to the xBand.
    • Possible values: NONE, SHORT, LONG, DOUBLE

Example

<action id="set_external_device_config_beep_on_scan" type="send_external_device_configuration">
    <list name="configuration" listType="NAMED">
        <param name="d">SHORT,NONE,NONE,NONE,NONE,NONE</param>
    </list>
</action>

Send External Device Commands

Sends a command to the external device.

Identifier: send_external_device_commands

Elements

  • device_id:Contains the ID of the external device receiving the commands.
    • Required: No
    • Default value: Empty
  • commands:Contains the list of commands to be sent to the external device.
    • Required: Yes
    • Default value: Empty

Note: If you fail to specify the device to which you want to send your command, the command will be sent to all connected devices.

Supported command names

  • P:Sets the power for the external device.
    • Possible values: [0, 20]
  • A: Is used for licensing (informs the band if the user has access or not).
  • R: Changes the range of the band (currently not used since the power is directly controlling this).
  • D: Contains the key for configurations that define the behaviour of the band in general.
  • V: Lets the xBand device vibrate.
  • B: Lets the xBand device beep.
  • N: Contains the notifications for the xBand (e.g., the correct pick).
  • X: Resets the tag buffer, so that the same code is accepted again.

Examples

<action id="send_power_config_command" type="send_external_device_commands">
    <list name="commands" listType="NAMED">
        <param name="p">#{code}</param>
    </list>
</action>

<action id="send_external_device_beep" type="send_external_device_commands">
    <list name="commands" listType="NAMED">
        <param name="b">1</param>
    </list>
</action>
ļ»æ
<action id="send_external_device_correct_pick" type="send_external_device_commands">
    <list name="commands" listType="NAMED">
        <param name="n">1</param>
    </list>
</action>
ļ»æ
<action id="send_external_device_wrong_pick" type="send_external_device_commands">
    <list name="commands" listType="NAMED">
        <param name="n">2</param>
    </list>
</action>
ļ»æ
<action id="send_external_device_vibrate" type="send_external_device_commands">
    <list name="commands" listType="NAMED">
        <param name="v">1</param>
    </list>
</action>

<action id="reset_external_device_tag_buffer" type="send_external_device_commands">
    <list name="commands" listType="NAMED">
        <param name="x">0</param>
    </list>
</action>

Release All Bindings

Releases the bindings to all of the connected devices.

Identifier: release_all_bindings

Example

<action id="release_devices" type="release_all_bindings"/>

Was this article helpful?

Thatā€™s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article