要求装订
配对外部设备。
标识符:请求绑定
要素
- device_id:要配对的设备的 ID。对于 xBands,这是附加到波段上的数据矩阵代码。
- timeout_ms:以毫秒为单位的超时,超时后事件将被启动。
输出
- 超时:TIMEOUT: 如果在指定时间内没有成功,将启动超时事件。
示例
<action id="bind_device" type="request_binding">
<param name="device_id">#{external_device_id}</param>
<param name="timeout_ms" type="long">10000</param>
</action>
验证连接
由于该操作没有 "SUCCESS"(成功)输出,因此需要验证连接。可按本例所示进行验证:
<rule id="device_connected">
<expression> <![CDATA[#{extdevices.CONNECTION_STATUS} == #{const:extdevices.CONNECTED}]]> </expression>
<actions>
<action ref="my_action" />
</actions>
</rule>
连接斑马打印机
尝试连接并向 Zebra 打印机发送打印内容。
标识符: Print_zebra_label
行动类型
参数
- 类型: 与打印机连接的类型
- 类型: 字符串 字符串
- 需要: 是
- 默认值: 空字符串
- 有效值: TCP、蓝牙
- 格式:打印机设置使用的格式
- 类型: 字符串 字符串
- 需要: 是
- 默认值: 空字符串
- 有效值: ZPL、CPCL
- 内容: 发送打印的数据(即打印机标签)
- 类型: 字符串 字符串
- 需要: 是
- 默认值: 空字符串
对于 TCP 连接类型
- ipaddress:
- 类型: 字符串 字符串
- 需要: 是
- 默认值: 空字符串
- 端口: 打印机配置使用的端口
- 类型: 字符串 字符串
- 需要: 不需要
- 默认值: 如果未指定,则使用 9100 (ZPL) 或 6101 (CPCL)
蓝牙连接类型
- mac: 打印机的蓝牙 MAC 地址,带或不带分隔符":"。
- 类型: 字符串 字符串
- 需要: 是
- 默认值: 空字符串
- bt_secure:用于建立安全连接,需要在两台设备上都接受解析请求
最小 TCP 示例
<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>
最小蓝牙示例
<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_all_bindings 操作。
标识符:release_binding
要素
- device_id:包含要释放的外部设备的 ID。
实例
<action id="release_device" type="release_binding">
<param name="device_id">#{external_device_id}</param>
</action>
发送外部设备配置
您可以根据设备配置 xBand 的行为(如振动和蜂鸣声)。
标识符:send_external_device_configuration
要素
配置值
- DEFAULT_SCAN_BEEP:用于配置 xBand 设备每次扫描后发出的蜂鸣声。
- POSITIVE_BEEP:用于配置工作流向 xBand 发送肯定命令时的蜂鸣声。
- 可能的值:
无
、短路
、正
、负
、连接
、断开
- NEGATIVE_BEEP:用于配置工作流向 xBand 发送负命令时的蜂鸣声。
- 可能的值:
无
、短路
、正
、负
、连接
、断开
- DEFAULT_SCAN_VIBRATION:用于配置 xBand 每次扫描后的振动。
- 可能的值
无
、短
、长
、双
- POSITIVE_VIBRATION:用于配置工作流向 xBand 发送正向命令时的振动。
- 可能的值
无
、短
、长
、双
- NEGATIVE_VIBRATION:用于配置工作流向 xBand 发送负命令时的振动。
- 可能的值
无
、短
、长
、双
示例
<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
要素
- device_id:包含接收命令的外部设备的 ID。
- 命令:包含要发送到外部设备的命令列表。
注意:如果未指定要发送命令的设备,命令将发送到所有连接的设备。
支持的命令名称
- A:用于许可(告知频段用户是否有访问权限)。
- R:改变频段范围(目前不使用,因为功率直接控制该范围)。
- D:包含定义一般频段行为的配置键。
- V:让 xBand 设备振动。
- B:让 xBand 设备发出蜂鸣声。
- N:包含 xBand 的通知(例如,选取正确)。
- X:重置标签缓冲区,以便再次接受相同的代码。
实例
<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
示例
<action id="release_devices" type="release_all_bindings"/>