请求绑定 

配对外部设备。

标识符: request_binding

元素

  • device_id: 要配对的设备的 ID。对于 xBands,这是附加到频段的数据矩阵代码。
    • 必需: True
    • 默认值: 空
  • timeout_ms: 超时(以毫秒为单位),在此之后启动事件。
    • 必需: 取决于
    • 默认值: 空

输出

  • 超时: 如果在指定时间内没有成功,将启动超时事件。

<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”输出,因此需要验证连接。这可以按照以下示例所示完成:

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

连接 Zebra 打印机

尝试连接打印内容并将其发送到 Zebra 打印机。

标识符:print_zebra_label

操作类型

  • print_zebra_label:
    • 必填: 是的

参数

  • 类型: 将与打印机建立的连接类型
    • 类型: 字符串
    • 必填: 是的
    • 默认值: 空字符串
    • 取值范围: TCP、蓝牙
  • format:打印机设置为使用的格式
    • 类型: 字符串
    • 必填: 是的
    • 默认值: 空字符串
    • 取值范围: ZPL、CPCL型
  • 内容: 发送要打印的数据(即打印机标签)
    • 类型: 字符串
    • 必填: 是的
    • 默认值: 空字符串

对于 TCP 连接类型

  • IP地址:
    • 类型: 字符串
    • 必填: 是的
    • 默认值: 空字符串
  • 港口: 打印机配置为使用的端口
    • 类型: 字符串
    • 必填:
    • 默认值: 如果未指定,则将使用 9100 (ZPL) 或 6101 (CPCL)

对于蓝牙连接类型

  • 苹果电脑: 带或不带“:”分隔符的打印机的蓝牙 MAC 地址
    • 类型: 字符串
    • 必填: 是的
    • 默认值: 空字符串
  • bt_secure:用于建立需要在两台设备上接受配对请求的安全连接
    • 类型: 布尔
    • 必填:
    • 默认值:

最小 TCP 示例:

<操作 id=“print_label” type=“print_zebra_label”>
<参数名称=“类型”>tcp</param>
<参数名称=“格式”>cpcl</param>
<参数名称=“ipaddress”>10.10.10.10</param>
<参数名称=“端口”>2020</param>
<参数名称=“内容”><![CDATA[ ?{
var msg = “\n” +
“! 0 200 200 210 1\r\n” +
“音调 99\r\n” +
“速度 98\r\n” +
“T 4 0 0 80 测试 1234\r\n” +
“FORM\r\n” +
“打印”;
味精}?]]></param></action>

最小蓝牙示例:

<操作 id=“print_label” type=“print_zebra_label”>
<参数名称=“类型”>蓝牙</参数>
<参数名称=“格式”>cpcl</参数>
<参数名称=“mac”> 48:A4:93:02:CB:F1</参数>
<参数名称=“内容”><![CDATA[ ?{
var msg = “\n” +
“! 0 200 200 210 1\r\n” +
“音调 99\r\n” +
“速度 98\r\n” +
“T 4 0 0 80 测试 1234\r\n” +
“FORM\r\n” +
“打印”;
味精
}?]]></param>

</action>

发布绑定

释放指定设备的配对。

注意:如果要释放所有外部设备,请改用 release_all_bindings 操作。

标识符: release_binding

元素

  • device_id: 包含要释放的外部设备的 ID。
    • 必需: 是
    • 默认值: 空

例子

<action id=“release_device” type=“release_binding”>
    <参数名称=“device_id”>#{external_device_id}</param>
</action>

发送外部设备配置

使您能够配置 xBand 对设备的行为(例如,振动和哔哔声)。

标识符: send_external_device_configuration

元素

  • configuration: 包含以逗号分隔的配置值(见下文)。
    • 必需: 是

配置值

注意:确保列表中没有空格,并且给出了所有键的值。

  • DEFAULT_SCAN_BEEP: 用于配置 xBand 设备在每次扫描后发出的哔哔声。
    • 可能的值: NONE、、 、   POSITIVE NEGATIVECONNECTSHORTDISCONNECT
  • POSITIVE_BEEP: 用于配置工作流向 xBand 发送正命令时发出的哔哔声。
  • 可能的值: NONE、、 、   POSITIVE NEGATIVECONNECTSHORTDISCONNECT
  • NEGATIVE_BEEP: 用于配置工作流向 xBand 发送否定命令时的哔哔声。
  • 可能的值: NONE、、 、   POSITIVE NEGATIVECONNECTSHORTDISCONNECT
    • DEFAULT_SCAN_VIBRATION: 用于配置 xBand 在每次扫描后产生的振动。
    • 可能的值: NONE、、 、 LONG SHORTDOUBLE
  • POSITIVE_VIBRATION: 用于配置工作流向 xBand 发送正命令的情况的振动。
  • 可能的值: NONE、、 、 LONG SHORTDOUBLE
    • NEGATIVE_VIBRATION: 用于在工作流向 xBand 发送否定命令的情况下配置振动。
    • 可能的值: NONE、、 、 LONG SHORTDOUBLE

<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,NONE</param>
    </list>
</action>

发送外部设备命令

向外部设备发送命令。

标识符: send_external_device_commands

元素

  • device_id: 包含接收命令的外部设备的 ID。
    • 必需: 否
    • 默认值: 空
  • commands: 包含要发送到外部设备的命令列表。
    • 必需: 是
    • 默认值: 空

注意:如果未能指定要向其发送命令的设备,则该命令将发送到所有连接的设备。

支持的命令名称

  • P: 设置外部设备的电源。
    • 可能的值: [0, 20]
  • 答: 用于许可(通知手段用户是否有权访问)。
  • 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”>
        <参数名称=“b”>1</param>
    </list>
</action><

action id=“send_external_device_correct_pick” type=“send_external_device_commands”>
    <list name=“commands” listType=“NAMED”>
        <参数名称=“n”>1</param>
    </list>
</action>

<action id=“send_external_device_wrong_pick” type=”send_external_device_commands“>
    <list name=”commands“ listType=”NAMED“>
        <参数名称=”n“>2</param>
    </list>
</action>

<action id=”send_external_device_vibrate“ type=”send_external_device_commands“>
    <list name=”commands“ listType=”NAMED“>
        <参数名称=”v“>1</param>
    </list>
</action>

<action id=“reset_external_device_tag_buffer” type=“send_external_device_commands”>
    <list name=“commands” listType=“NAMED”>
        <参数名称=“x”>0</param>
    </list>
</action>

释放所有绑定

释放对所有连接设备的绑定。

标识符: release_all_bindings

<操作 id=“release_devices” type=“release_all_bindings”/>