设置配置

DataWedge 7.4

SET_CONFIG

用于创建、更新或替换 DataWedge 配置文件及其设置,并且可以通过单个 Intent 操作配置多个选项。 SET_CONFIG 实施嵌套捆绑包,其中PARAM_LIST(参数列表)捆绑包可以嵌套在相应的 PLUGIN_CONFIG(基于输入、数据处理、实用程序或输出的选项)捆绑包中,而后者又可以嵌套在 SET_CONFIG 捆绑包中。可以在 SET_CONFIG 捆绑包中嵌套多个 PLUGIN_CONFIG 捆绑包。

图 1.嵌套捆绑包的直观展示。

要创建配置文件而不配置其设置参数,请使用 CREATE_PROFILE

版本历史记录

  • DataWedge 6.4 - 引入了 API
  • DataWedge 6.6 - 增加了对通过单个操作配置多个插件的支持
  • DataWedge 6.7 - 增强了字符间延迟功能(更多信息)
  • DataWedge 6.8 - 支持 ADF 设置:
    • 新的 ADF_RULE 捆绑包,含有 Action、Device、Decoder 和 Label_ID 子捆绑包
    • 新的结果代码:RESULT_ACTION_RESULT_CODE_EMPTY_RULE_NAME
  • DataWedge 6.9/7.0 - 增加了对 Voice Input 和全局扫描器配置的支持。
  • DataWedge 7.1 - 新配置:完整配置文件(所有插件、APP_LIST 和 Data Capture Plus)、Data Capture Plus、IP(Internet 协议)、MSR(磁条读取器)和 Simulscan。用于多个插件的新 SEND_RESULT 结果代码。
  • DataWedge 7.2 - 增加了新的 DotCode 解码器支持。
  • DataWedge 7.3 - 增加了新的解码器签名支持、新的 Grid Matrix 解码器支持和新的按键输出参数。
  • DataWedge 7.3.22 - 增加了新的 RFID 输入功能。
  • DataWedge 7.4 - 增加了新的 DPM 支持。

函数原型

Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", <mainbundle>);

参数

ACTION [字符串]:"com.symbol.datawedge.api.ACTION"

EXTRA_DATA [字符串]:"com.symbol.datawedge.api.SET_CONFIG"

BUNDLE:<主捆绑包>(请参阅下面的参数)

MAIN BUNDLE

主捆绑包 SET_CONFIG 包括以下属性:

  • PROFILE_NAME [字符串]:要针对其执行操作的配置文件的名称
  • CONFIG_MODE [字符串]:(默认=OVERWRITE)适用于配置文件。可用于代替 CREATE_PROFILE。选项:
    • CREATE_IF_NOT_EXIST:如果设备上不存在 PROFILE_NAME 中的字符串,则创建配置文件
    • OVERWRITE:如果配置文件存在,则将所有选项重置为默认值,然后配置指定的设置
    • UPDATE:仅更新指定的设置
  • PROFILE_ENABLED [字符串]:可选;控制是启用 (true) 还是禁用 (false) 配置文件(默认=true)。如果未指定,则不会对配置文件状态进行更改。
  • PLUGIN_CONFIG [捆绑包]:包含每个插件设置的捆绑包数组(嵌套在主捆绑包内)
  • APP_LIST [数组]:要与配置文件关联的捆绑包数组。每个 APP_LIST 捆绑包都包含以下属性:
    • PACKAGE_NAME [字符串]:要与配置文件关联的应用程序的包名称。例如:"com.symbol.emdk.barcodesample1" 或通配符 (*)。
    • ACTIVITY_LIST [列表]:来自 PACKAGE_NAME 的活动列表。也支持通配符 (*)。

PLUGIN_CONFIG BUNDLE

使用以下属性配置 PLUGIN_CONFIG 捆绑包:

  • RESET_CONFIG [字符串]:可选 - 适用于现有配置文件。值:
    • True(默认)– 清除任何现有配置,并使用指定参数值创建新配置
    • False - 将现有配置与新配置中的更改合并 - 更新现有值并添加配置中没有的值
  • PLUGIN_NAME [字符串]:要配置的插件的名称(区分大小写):有关 PARAM_LIST 值,请参阅下表。对于 DataWedge 6.5 及更低版本,涉及插件的每个 Intent 都需要单独的 Intent 操作:
    • BARCODE 输入
    • MSR(磁条读取器)输入
    • RFID(无线射频识别)输入
    • SERIAL 输入
    • SIMULSCAN 输入
    • VOICE 输入
    • BDF(基本数据格式)处理
    • ADF(高级数据格式)处理
    • TOKENS(使用 UDI/多条码数据进行按键和 IP 输出的数据格式化和排序)处理
    • INTENT 输出
    • KEYSTROKE 输出
    • IP(Internet 协议)输出
    • DCP (Data Capture Plus) 实用程序
  • PARAM_LIST [捆绑包]:嵌套在 PLUGIN_CONFIG 捆绑包内的参数列表捆绑包。包括应在指定插件下更新的参数列表。在任何参数值中设置空字符串都会将该参数重置为其默认设置
  • OUTPUT_PLUGIN_NAME [字符串]:当指定为 PLUGIN_NAME.时,仅适用于 ADFBDF。指定与 ADF 或 BDF 参数关联的输出插件:
    • KEYSTROKE
    • INTENT
    • IP

PARAM_LIST BUNDLE

通过从下面相应的 PLUGIN_NAME 参数表中指定参数名称和值来配置 PARAM_LIST 捆绑包。适用于与 PLUGIN_NAME(在 PLUGIN_CONFIG 中指定)匹配的参数。

  • BARCODE - 接受下面的扫描器输入参数表中的值;将解码器和其他输入设置指定为 EXTRA_DATA(在 PARAM_LIST 嵌套捆绑包中)。

    • scanner_selection_by_identifier [字符串] - 接受下面的扫描器标识符列表中的值。
    • configure_all_scanners [字符串] - true/false
      如果设置为 "true",则会忽略参数 scanner_selection_by_identifier,并且配置会保存为全局扫描器配置。如果对于任何单个扫描器存在任何以前的配置,则它们会被为新的全局配置替换。
      如果设置为 "false",则只会为单个选定的扫描器保存配置。在扫描器选择设置为“自动”的情况下,会更新当前默认扫描器配置。
  • MSR - 接受下面的 MSR 输入参数表中的值。

  • RFID - 接受下面的 RFID 输入参数表中的值。

  • SERIAL - 接受下面的串行输入参数表中的值。

  • SIMULSCAN - 接受下面的 Simulscan 输入参数表中的值。

  • VOICE - 接受下面的语音输入参数表中的值。

  • DCP - 接受下面的 DCP (Data Capture Plus) 实用程序参数表中的值。

  • BDF -基本数据格式规则应用于获取的数据。接受下面的 BDF 处理参数表中的值。

  • ADF -高级数据格式规则应用于获取的数据。此捆绑包中包含 Action、Device、Decoder 和 Label_ID 子捆绑包。接受下面的 ADF 处理参数表中的值。

  • TOKENS - 适用于 UDI 或多条码;接受下面的令牌参数表中的值。

  • INTENT - 接受下面的 Intent 输出参数表中的值。

  • KEYSTROKE - 接受下面的按键输出参数表中的值;将输出设置指定为 EXTRA_DATA(在 PARAM_LIST 嵌套捆绑包中)。

  • IP(Internet 协议)- 接受下面的 IP 输出参数表中的值。

重要说明

  • 如果创建不含有至少一个规则的配置文件,则 DataWedge 会创建 "Rule0",其中包含单个操作,用于对数据进行 "SEND_REMAINING" 操作而不进行修改。
  • 如果一个或多个新创建的规则中的值缺失或无效,则 DataWedge 会使用默认值。
  • 要使用 Intent 更新现有配置文件中的一个或多个操作,必须将该配置文件中的所有操作都包括在 Intent 中。


图 2.嵌套 SET_CONFIG 捆绑包的直观展示。捆绑包以蓝色指定,并列出相应的属性。PLUGIN_NAME 列出可供配置的插件(选项)的名称。每个插件的虚线箭头指向可为该特定插件配置的相应 PARAM_LIST 属性。请参阅示例代码

扫描器标识符

扫描器标识符(在 DataWedge 6.5 中引入)允许通过友好名称而非索引号来标识扫描器。

SCANNER_IDENTIFIER [字符串]:存在于设备中支持的每个扫描器的每个扫描器信息捆绑包中。在 DataWedge 及更高版本中支持 Index 和 identifier 参数;如果代码中也引用了索引,则扫描器标识符值优先。

可能的值

  • AUTO - 自动扫描器选择
  • INTERNAL_IMAGER - 内置成像器扫描器
  • INTERNAL_LASER - 内置激光扫描器
  • INTERNAL_CAMERA - 内置摄像头扫描器
  • SERIAL_SSI - 用于 ET50/ET55 的可插入 Z 式背面扫描器
  • BLUETOOTH_SSI - RS507 蓝牙扫描器
  • BLUETOOTH_RS6000 - RS6000 蓝牙扫描器
  • BLUETOOTH_DS2278 - DS2278 蓝牙扫描器
  • BLUETOOTH_DS3678 - DS3678 蓝牙扫描器
  • PLUGABLE_SSI - 串行 SSI 扫描器 RS429(与 WT6000 一起使用)
  • PLUGABLE_SSI_RS5000 - 串行 SSI 扫描器 RS5000(与 WT6000 一起使用)
  • USB_SSI_DS3608 - DS3608 可插入 USB 扫描器

结果代码

如果应用程序包括 Intent 额外项 RECEIVE_RESULTCOMMAND_IDENTIFIER 以使应用程序能够使用 DataWedge 结果 Intent 机制获取结果,则 DataWedge 返回以下错误代码。请参阅以下示例

  • PLUGIN_NOT_SUPPORTED - 尝试配置不受 DataWedge Intent API 支持的插件
  • BUNDLE_EMPTY - 捆绑包不包含任何数据
  • PROFILE_NAME_EMPTY - 尝试配置没有数据的配置文件名称
  • PROFILE_NOT_FOUND - 尝试针对不存在的配置文件执行操作
  • PLUGIN_BUNDLE_INVALID - 传递的插件参数捆绑包为空或包含的信息不足
  • PARAMETER_INVALID - 传递的参数为空、为 null 或无效
  • APP_ALREADY_ASSOCIATED - 尝试关联已经与另一配置文件关联的应用程序
  • OPERATION_NOT_ALLOWED - 尝试重命名或删除受保护的配置文件或将应用程序与 Profile0 关联
  • RESULT_ACTION_RESULT_CODE_EMPTY_RULE_NAME - 规则名称为空或未在 ADF_RULE 捆绑包中定义

有关更多信息,另请参阅结果代码指南


扫描器输入参数

有关解码器、解码器参数和扫描参数的详细信息,请参阅条码输入

重要说明:解码参数支持会因所选扫描设备而异。有关特定于设备的支持说明,请参阅设备随附的集成商指南

所有参数均区分大小写。

解码器 解码器状态 解码器参数 参数值
decoder_code11 true
false
decoder_code11_length1
decoder_code11_length2
从 0 到 55 的整数
decoder_code11_redundancy
decoder_code11_report_check_digit
true
false
decoder_code11_verify_check_digit 0 - 无校验位
1 - 1 个校验位
2 - 2 个校验位
decoder_code128 true
false
decoder_code128_length1
decoder_code128_length2
从 0 到 55 的整数
decoder_code128_redundancy
decoder_code128_enable_plain
decoder_code128_enable_ean128
decoder_code128_enable_isbt128
decoder_code128_check_isbt_table
true
false
decoder_code128_isbt128_concat_mode 0 - 并置模式为从不
1 - 并置模式为始终
2 - 并置模式为自动
decoder_code128_security_level 0 - 安全级别 0
1 - 安全级别 1
2 - 安全级别 2
3 - 安全级别 3
decoder_code128_enable_marginless_decode true
false
decoder_code128_ignore_fnc4 true
false
decoder_code39 true
false
decoder_code39_length1
decoder_code39_length2
从 0 到 55 的整数
decoder_code39_verify_check_digit
decoder_code39_report_check_digit
decoder_code39_full_ascii
decoder_code39_redundancy
decoder_code39_convert_to_code32
decoder_code39_report_code32_prefix
decoder_code39_enable_marginless_decode
true
false
decoder_code39_security_level 0 - 安全级别 0
1 - 安全级别 1
2 - 安全级别 2
3 - 安全级别 3
decoder_dotcode true
false
decoder_dotcode_inverse 已禁用 (0)
已启用 (1)
自动 (2)
decoder_dotcode_mirror 已禁用 (0)
已启用 (1)
自动 (2)
decoder_ean13 true
false
不适用 不适用
decoder_ean8 true
false
decoder_ean8_convert_to_ean13 true
false
decoder_korean_3of5 true
false
不适用 不适用
decoder_chinese_2of5 true
false
不适用 不适用
decoder_d2of5 true
false
decoder_d2of5_length1
decoder_d2of5_length2
从 0 到 55 的整数
decoder_d2of5_redundancy true
false
decoder_trioptic39 true
false
decoder_trioptic39_redundancy true
false
decoder_code93 true
false
decoder_code93_length1
decoder_code93_length2
从 0 到 55 的整数
decoder_code93_redundancy true
false
decoder_msi true
false
decoder_msi_length1
decoder_msi_length1
从 0 到 55 的整数
decoder_msi_redundancy
decoder_msi_report_check_digit
true
false
decoder_msi_check_digit 0 - 1 个校验位
1 - 2 个校验位
decoder_msi_check_digit_scheme 0 - Mod-11-10
1 - Mod-10-10
decoder_codabar true
false
decoder_codabar_length1
decoder_codabar_length2
从 0 到 55 的整数
decoder_codabar_redundancy
decoder_codabar_clsi_editing
decoder_codabar_notis_editing
true
false
decoder_upce0 true
false
decoder_upce0_report_check_digit true
false
decoder_upce0_preamble 0 - 无前导码
1 - 前导码为系统字符
2 - 前导码为国家/地区和系统字符
decoder_upce0_convert_to_upca true
false
decoder_upce1 true
false
decoder_upce1_report_check_digit
decoder_upce1_convert_to_upca
true
false
decoder_upce1_preamble 0 - 无前导码
1 - 前导码为系统字符
2 - 前导码为国家/地区和系统字符
decoder_upca true
false
decoder_upca_report_check_digit true
false
decoder_upca_preamble 0 - 无前导码
1 - 前导码为系统字符
2 - 前导码为国家/地区和系统字符
decoder_us4state true
false
decoder_us4state_fics true
false
decoder_tlc39 true
false
不适用 不适用
decoder_mailmark true
false
不适用 不适用
decoder_hanxin true
false
decoder_hanxin_inverse 0 - 禁用
1 - 启用
2 - 自动
decoder_signature true
false
decoder_signature_format 1 - JPG
3 - BMP
4 - TIFF
decoder_signature_width 16-1280 范围内的整数
默认值:400
decoder_signature_height 16-800 范围内的整数
默认值:400
decoder_signature_bpp 0 - 1 BPP(2 级)
1 - 4 BPP(16 级)
2 - 8 BPP(256 级)(默认)
备注:不适用于 JPEG 格式。
decoder_signature_jpegquality 从 5 到 100 的整数,增量为 5
默认值:65
decoder_webcode true
false
不适用 不适用
decoder_matrix_2of5 true
false
decoder_matrix_2of5_length1
decoder_matrix_2of5_length2
从 0 到 55 的整数
decoder_matrix_2of5_redundancy
decoder_matrix_2of5_report_check_digit
decoder_matrix_2of5_verify_check_digit
true
false
decoder_i2of5 true
false
decoder_i2of5_length1
decoder_i2of5_length2
从 0 到 55 的整数
decoder_i2of5_redundancy
decoder_i2of5_report_check_digit
decoder_i2of5_report_check_digit
decoder_i2of5_convert_to_ean13
i20f5_enable_marginless_decode
true
false
decoder_i2of5_check_digit 0 - 无校验位
1 - USS 校验位
2 - OPCC 校验位
decoder_i2of5_security_level 0 - 安全级别 0
1 - 安全级别 1
2 - 安全级别 2
3 - 安全级别 3
decoder_i2of5_enable_febraban true
false(默认)
decoder_gs1_databar true
false
decoder_gs1_databar_lim
decoder_gs1_databar_exp
true
false
decoder_datamatrix true
false
不适用 不适用
decoder_qrcode true
false
不适用 不适用
decoder_grid_matrix true
false(默认)
decoder_grid_matrix_inverse 已禁用 (0) - 默认
已启用 (1)
自动 (2)
decoder_grid_matrix_mirror 已禁用 (0) - 默认
已启用 (1)
自动 (2)
decoder_gs1_datamatrix true
false
不适用 不适用
decoder_gs1_qrcode true
false
不适用 不适用
decoder_pdf417 true
false
不适用 不适用
decoder_pdf417 true
false
不适用 不适用
decoder_composite_ab true
false
decoder_composite_ab_ucc_link_mode 0 - 忽略链接标记
1 - 始终链接
2 - 自动辨别
decoder_composite_c true
false
不适用 不适用
decoder_microqr true
false
不适用 不适用
decoder_aztec true
false
不适用 不适用
decoder_maxicode true
false
不适用 不适用
decoder_micropdf true
false
不适用 不适用
decoder_uspostnet true
false
不适用 不适用
decoder_usplanet true
false
decoder_usplanet_report_check_digit true
false
decoder_uk_postal true
false
decoder_uk_postal_report_check_digit true
false
decoder_japanese_postal true
false
不适用 不适用
decoder_canadian_postal true
false
不适用 不适用
decoder_dutch_postal true
false
不适用 不适用
decoder_gs1_lim_security_level 1 - 安全级别 1
2 - 安全级别 2
3 - 安全级别 3
4 - 安全级别 4
不适用 不适用
Upcean_security_level 0 - 级别 0
1 - 级别 1
2 - 级别 2
3 - 级别 3
不适用 不适用
upcean_supplemental2 true
false
不适用 不适用
upcean_supplemental5 true
false
不适用 不适用
upcean_supplemental_mode 0 - 无补充
1 - 始终补充
2 - 自动补充
3 - 智能补充
4 - 补充 378-379
5 - 补充 978-979
6 - 补充 414-419-434-439
7 - 补充 977
不适用 不适用
upcean_retry_count 从 2 到 20 的整数 不适用 不适用
upcean_random_weight_check_digit true
false
不适用 不适用
upcean_linear_decode true
false
不适用 不适用
upcean_bookland true
false
不适用 不适用
upcean_coupon true
false
不适用 不适用
upcean_coupon_report 0 - 旧优惠券报告模式
1 - 新优惠券报告模式
2 - 两种优惠券报告模式
不适用 不适用
upcean_ean_zero_extend true
false
不适用 不适用
upcean_bookland_format 0 - ISBN-10 格式
1 - ISBN-13 格式
不适用 不适用


其他扫描器输入参数:

参数名称 参数值
barcode_trigger_mode 0 - 已禁用
1 - 已启用
更多信息
auto_switch_to_default_on_event 0 - 已禁用
1 - 连接时
2 - 断开连接时
3 - 连接/断开连接时
更多信息
digimarc_decoding true
false
scanning_mode 1 - 单个
2 - UDI - 仅在最高 Android P(9.x 版)的选定 Zebra 设备上受支持
3 - 多条码
multi_barcode_count 从 2 到 10 的整数
instant_reporting_enable true
false
scanner_selection_by_identifier 请参阅扫描器标识符
trigger-wakeup true
false
scanner_input_enabled true
false
scanner_selection 自动·
0–n(ENUMERATE_SCANNERS API 中的有效扫描器索引)
databar_to_upc_ean true
false
upc_enable_marginless_decode true
false
aim_mode on - 开
off - 关
beam_timer 从 0 到 60000 的整数
Adaptive_Scanning 0 - 启用
1 - 禁用
Beam_Width 0 - 窄
1 - 正常
2 - 宽
power_mode 0 - 低功率模式
1 - 优化功率模式
2 - 高功率模式
3 - 始终打开
mpd_mode 0 - 禁用移动电话显示屏模式
3 - 启用移动电话显示屏模式
reader_mode 0 - 触发模式
7 - 显示模式
linear_security_level 1 - 安全短或 Codabar
2 - 安全全部两次
3 - 安全长和短
4 - 安全全部三次
picklist 0 - 已禁用
1 - 已启用/硬件拣读
2 - 软件拣读
aim_type 0 - 触发器
1 - 定时保持
2 - 定时释放
3 - 按下后释放
4 - 显示
5 - 连续读取
6 - 按下并保持
scene_detect_qualifier 0 - 无
1 - 接近传感器输入
aim_timer 从 0 到 60000 的整数
same_barcode_timeout 从 0 到 5000 的整数
different_barcode_timeout 从 0 到 5000 的整数
illumination_mode off - 关
torch - 开
illumination_brightness 从 1 到 10 的整数
cd_mode 0 - 已禁用
3 - 已启用
low_power_timeout 从 0 到 1000 的整数
delay_to_low_power_mode 16 - 1 秒
29 - 30 秒
32 - 1 分钟
37 - 5 分钟
inverse_1d_mode 0 - 禁用
1 - 启用
2 - 自动
viewfinder_size 从 0 到 100 的整数
viewfinder_posx 从 0 到 100 的整数
viewfinder_posy 从 0 到 100 的整数
1d_marginless_decode_effort_level 0 - 级别 0
1 - 级别 1
2 - 级别 2
3 - 级别 3
poor_quality_bcdecode_effort_level 0 - 级别 0
1 - 级别 1
2 - 级别 2
3 - 级别 3
charset_nameAUTO
UTF-8
ISO-8859-1
Shift_JIS
GB18030
auto_charset_preferred_order 在由分号分隔的单个字符串中按优先级顺序列出首选选项:
     示例 1:"UTF-8;GB2312"
     示例 2: "GB2312;UTF-8"
auto_charset_failure_option NONE
UTF-8
ISO-8859-1
Shift_JIS
GB18030
viewfinder_mode 1 - 取景器已启用
2 - 静态十字线
code_id_type 0 - 代码 ID 类型为无
1 - 代码 ID 类型为目标
2 - 代码 ID 类型为 Symbol
volume_slider_type 0 - 铃声
1 - 音乐和媒体
2 - 警报
3 - 通知
decode_audio_feedback_uri URI - 可以是从 RingToneManager 查询可用 URI
decode_haptic_feedback true
false
bt_disconnect_on_exit true
false
connection_idle_time 从 0 到 1800 的整数
establish_connection_time 从 30 到 60 的整数
remote_scanner_audio_feedback_mode 从 0 到 3 的整数
remote_scanner_led_feedback_mode 从 0 到 3 的整数
display_bt_address_barcode true
false
good_decode_led_timer 从 0 到 1000 的整数
decoding_led_feedback true
false
decoder_usplanet_report_check_digit true
false
decode_screen_notification true
false
decode_screen_time 成功解码时显示屏幕通知的时间长度(以毫秒为单位)。

1000(默认值)
500-1500
decode_screen_translucency 设置解码通知绿色屏幕的透明度值 - 值越高,透明度越高。值范围从 20 至 50,增量为 5:

20、25、30、35(默认)、40、45、50。
keep_pairing_info_after_reboot 启用/禁用设备重新启动后自动重新连接到所连接的蓝牙扫描器。仅适用于连接的蓝牙扫描器:

0 - 已禁用
1 - 已启用
dpm_illumination_control 控制对 DPM 条码解码的照明。默认值为 10。值:

0 - 直接
11 - 间接
10 - 循环

更多信息
dpm_mode 根据条码大小优化 DPM 条码解码性能。默认值为 2。值:

0 – 已禁用
1 – 模式 1
2 – 模式 2

更多信息

MSR 输入参数

所有参数均区分大小写。

参数 参数值
msr_input_enabled true
false

RFID 输入参数

所有参数均区分大小写。

参数 参数值
rfid_input_enabled true
false
rfid_beeper_enable true
false
rfid_led_enable true
false
rfid_antenna_transmit_power 5 至 30
rfid_memory_bank 0 - 无(默认)
1 - 用户
2 - 保留
3 - TID(标签识别)
4 - EPC(电子产品代码)
rfid_session 0 - 会话 0
1 - 会话 1(默认值)
2 - 会话 2
3 - 会话 3
rfid_filter_duplicate_tags true
false
rfid_hardware_trigger_enabled true
false
rfid_trigger_mode 0 - 立即(默认)
1 - 连续

串行输入参数

重要说明:串行参数支持因设备而异。有关特定于设备的支持说明,请参阅设备随附的集成商指南

所有参数均区分大小写。

参数 参数值
serial_port_id 0–n(必须是有效索引)
serial_input_enabled true
false
serial_baudrate 300、1200、2400、4800、9600、19200、38400、57600、115200、230400、460800 或 921600
serial_databits 7
8
serial_parity NONE
ODD
EVEN
MARK
SPACE
serial_stopbits 1
2
serial_flow FLOW_NONE、FLOW_RTS_CTS 或 FLOW_XON_XOFF

Simulscan 输入参数

所有参数均区分大小写。

参数 参数值
simulscan_input_enabled true
false
simulscan_input_source 摄像头
成像器
默认值
simulscan_template 可用模板示例:
  默认值 - BankCheck.xml
  默认值 - Barcode 1.xml
  默认值 - Barcode 10.xml
  默认值 - Barcode 2.xml
  默认值 - Barcode 4.xml
  默认值 - Barcode 5.xml
  默认值 - BookNumber.xml
  默认值 - DocCap + Optional Barcode.xml
  默认值 - DocCap + Required Barcode.xml
  默认值 - TravelDoc.xml
  默认值 - Unstructured Multi-Line.xml
  默认值 - Unstructured Single Line.xml
simulscan_template_params [参数名称] [参数值]
注释:括号 [] 中的文本要替换为指定文本,例如动态数量    9
simulscan_region_separator TAB
CR
LF
NONE
simulscan_log_dir [有效路径]
simulscan_enable_timestamp true
false

语音输入参数

所有参数均区分大小写。

参数 参数值
voice_input_enabled true
false
voice_data_capture_start_phrase start(默认值)
voice_data_capture_end_phrase [空白](默认值)
voice_enter_command true
false
voice_data_type 0 - 任意
1 - 字母
2 - 数字
voice_start_phrase_waiting_tone true
false
voice_data_capture_waiting_tone true
false
voice_validation_window true
false
voice_offline_speech true
false

DCP 实用程序参数

所有参数均区分大小写。

参数 参数值 说明
dcp_input_enabled true
false
启用/禁用 Data Capture Plus 输入
dcp_dock_button_on LEFT - 仅左侧
RIGHT - 仅右侧
BOTH - 左侧或右侧
按钮停靠位置:左侧、右侧、右侧或左侧(两侧)
dcp_start_in FULLSCREEN
BUTTON
BUTTON_ONLY
设置 DCP 启动的模式:全屏、按钮(可通过拖放重新定位的浮动按钮)和仅按钮(不能重新定位)
dcp_highest_pos 0-100 设置按钮位置上限,以占总屏幕高度的百分比表示。例如,在垂直测量高度为四英寸的屏幕上,如果将此值设置为 75 (%),则 DCP 按钮的上边缘无法来到距离屏幕顶部不到一英寸的位置。
dcp_lowest_pos 0-100 设置按钮位置下限,以占总屏幕高度的百分比表示。例如,在垂直测量高度为四英寸的屏幕上,如果将此值设置为 25 (%),则 DCP 按钮的下边缘无法来到距离屏幕底部不到一英寸的位置。
dcp_drag_detect_time 0-1000 在触发扫描器操作之前,DCP 应在屏幕轻触后应等待的等待时间(以毫秒计)。将 DCP 按钮拖动到新位置时,这可帮助阻止意外触发事件发生。


请参阅 DCP 输入


BDF 处理参数

所有参数均区分大小写。

参数 参数值
bdf_enabled true
false
bdf_prefix [放置在获取的数据前面的字符串]
bdf_suffix [附加在获取的数据后面的字符串]
bdf_send_data true
false
bdf_send_hex true
false
bdf_send_tab true
false
bdf_send_enter true
false

ADF 处理参数

所有参数均区分大小写。

参数 参数值
adf_enabled true
false(默认)
ADF_RULE 接受值的捆绑包:
  • name [字符串] – 要使用的 ADF 规则的名称
  • enabled [字符串] – 已启用规则;true/false(默认值=true)
  • alldevices [字符串] – 接受来自所有受支持的输入源的数据;true/false(默认值=true)
  • string [字符串] – 要检查的字符串(默认值=空字符串)
  • string_pos [字符串] – 字符串位置(默认值=0)
  • string_len [字符串] - 字符串长度(默认值=0)
ACTIONS 可以有多个实例的捆绑包;接受值:
  • type [字符串] - 来自 ADF 操作表的操作的名称
  • [action_param_1], [action_param_2]...(由 ADF 操作确定;请参阅表)
DEVICES 可以有多个实例的捆绑包;接受值:
  • device_id [字符串] - 输入源的名称:BARCODE、MSR、RFID、SERIAL、SIMULSCAN 或 VOICE
  • enabled [字符串] - 接受来自指定设备 ID 的数据:true/false(默认值=true)
  • alldecoders [字符串] - 允许所有条码码制:true/false(默认值=true)
  • all_label_ids [字符串] - 允许所有 UDI 标签 ID:true/false(默认值=true)
DECODERS 可以有多个实例的捆绑包;接受值:
  • device_id [字符串] - BARCODE、MSR、RFID、SERIAL、SIMULSCAN 或 VOICE
  • decoder [字符串] -(例如 "Australian Postal")
  • enabled [字符串] - true/false(默认值=true)
LABEL_IDS 可以有多个实例的捆绑包;接受值:
  • device_id [字符串] - BARCODE、MSR、RFID、SERIAL、SIMULSCAN 或 VOICE
  • label_id [字符串] - UDI_GS1、UDI_HIBCC 或 UDI_ICCBBA
  • enabled [字符串] - true/false(默认值=true)

ADF 操作

类别 操作类型
参数(如果有)
说明

光标移动

SKIP_AHEAD
action_param_1

将光标向前移动指定的字符数(默认值=1)

SKIP_BACK
action_param_1

将光标向后移动指定的字符数(默认值=1)

SKIP_TO_START

将光标移至数据的开头

MOVE_AHEAD_TO
action_param_1

在 DataWedge UI 中称为“移动到”,使光标前进,直到找到指定的字符串

MOVE_PAST_A
action_param_1

向前移动光标,使其超过指定的字符串

数据修改

CRUNCH_SPACES

将字词间的空格减至一个并删除数据开头和结尾处的所有空格。

STOP_CRUNCH_SPACE

禁用最后一个删减空格操作

REMOVE_SPACES

在 DataWedge UI 中称为“删除所有空格”,删除数据中的所有空格

STOP_REMOVE_SPACES

禁用最后一个 REMOVE_SPACES 操作

TRIM_LEFT_ZEROS

在 DataWedge UI 中称为“删除前导零”,删除数据开头的所有零

STOP_TRIM_LEFT_ZEROS

禁用上一个 TRIM_LEFT_ZEROS 操作

PAD_LEFT_ZEROS
action_param_1

在 DataWedge UI 中称为“添加零”,在数据左侧添加指定数量的零(默认值=0)。

STOP_PAD_LEFT_ZEROS

禁用上一个 PAD_LEFT_ZEROS 操作

PAD_LEFT_SPACES
action_param_1

在 DataWedge UI 中称为“添加空格”,在数据左侧添加指定数量的空格(默认值=0)。

STOP_PAD_LEFT_SPACES

禁用上一个 PAD_LEFT_SPACES 操作

REPLACE_STRING
action_param_1
action_param_2

将指定的字符串 (action_param_1) 替换为新指定的字符串 (action_param_2)。必须指定两者(默认值=空)

STOP_REPLACE_ALL

在 DataWedge UI 中称为“停止所有替换字符串”,停止所有 REPLACE_STRING 操作

REMOVE_CHARACTERS
action_param_1
action_param_2
action_param_3

执行发送操作时在给定位置处删除指定的字符数
action_param_1:(0=开头(默认值);1=之间;2=结尾;3=中间)
action_param_2:起始位置(默认值=0)
action_param_3:字符数(默认值=0)

STOP_REMOVE_CHARS

在后续发送操作中停止删除字符

数据发送

SEND_NEXT
action_param_1

从当前光标位置开始发送指定数量的字符(默认值=0)

SEND_REMAINING

发送从当前光标位置开始保留的所有数据

SEND_UP_TO
action_param_1

发送指定字符串前的所有数据

DELAY

在 DataWedge UI 中称为“发送暂停”,暂停指定的毫秒数(默认值 = 0;最大值 = 120000),然后再执行下一操作。Zebra 建议在发送 ENTER、LINE FEED 或 TAB 任一字符后暂停 50 毫秒

SEND_STRING
action_param_1

发送指定的字符串

SEND_CHAR
action_param_1

发送指定的 ASCII/Unicode 字符。最大 Unicode 字符值为 U-10FFFF(十进制值 1114111)

注意

  • 除非另外说明,否则默认 action_param 值为 0、空或 none
  • 为帮助最大程度地减少数据丢失,Zebra 建议在发送 ENTER、LINE FEED 或 TAB 任一字符后发送 50 毫秒的 DELAY。

令牌参数

适用于 UDI 或多条码。

所有参数均区分大小写。

参数名称 参数值
send_tokens_option DISABLED
TOKENS
BARCODES_TOKENS
token_separator TAB
CR
LF
NONE
multibarcode_separator TAB
CR
LF
NONE
token_order name: manufacturing_date_original
enabled: true/false

name: expiration_date_original
enabled: true/false

name: di
enabled: true/false
(注释:“di”表示设备标识符。)

name: lot_number
enabled: true/false

name: serial_number
enabled: true/false

name: mpho_lot_number
enabled: true/false

name: donation_id
enabled: true/false

name: labeler_identification_code
enabled: true/false

name: product_or_catalog_number
enabled: true/false

name: unit_of_measure_id
enabled: true/false

name: quantity
enabled: true/false

* DataWedge 根据 ArrayList 中所列项目的顺序确定优先级顺序,其中 Element 0 具有最高优先级。


请参阅 IP 输出按键输出中的 UDI 数据输出


Intent 输出参数

所有参数均区分大小写。

参数 参数值
intent_output_enabled true
false
intent_action [操作的确切名称]
intent_category [类别的确切名称]
intent_delivery 0 - 启动活动
1 - 启动服务
2 - 广播

按键输出参数

所有参数均区分大小写。

参数 参数值
keystroke_output_enabled true
false
keystroke_action_character NONE - ASCII_NO_VALUE
TAB - ASCII_TAB_VALUE
LF - ASCII_LF_VALUE
CR - ASCII_CR_VALUE
keystroke_delay_extended_ascii(已弃用) 从 0 到 1000 的整数
keystroke_delay_control_characters 从 0 到 1000 的整数
keystroke_character_delay 从 0 到 1000 的整数
keystroke_delay_multibyte_chars_only true
false
keystroke_send_chars_as_events true
false(默认)
keystroke_send_control_chars_as_events true
false(默认)
keystroke_send_tab_as_string true
false(默认)

按键延迟备注

  • 已弃用 keystroke_delay_extended_ascii 参数。
  • 如果按键插件捆绑包使用 keystroke_delay_extended_ascii 参数,则 DataWedge 将 keystroke_delay_multibyte_chars_only 参数设为 true。
  • 如果发送 keystroke_delay_extended_asciikeystroke_character_delay 参数:
    • 保留 keystroke_character_delay 值。
    • 忽略 keystroke_delay_extended_ascii 值。
    • 如果可用,则保存 keystroke_delay_multibyte_chars_only 值,否则将其视为 false。

IP 输出设置

所有参数均区分大小写。

参数名称 参数值
ip_output_enabled true
false
ip_output_ip_wedge_enabled true
false
ip_output_protocol TCP
UDP
ip_output_address [有效的 IP 地址格式]
ip_output_port 1 – 65535

示例代码

嵌套捆绑包

// MAIN BUNDLE PROPERTIES Bundle bMain = new Bundle(); bMain.putString("PROFILE_NAME","Profile12"); // <- "Profile12" is a bundle bMain.putString("PROFILE_ENABLED","true"); // <- that will be enabled bMain.putString("CONFIG_MODE","CREATE_IF_NOT_EXIST"); // <- or created if necessary. // PLUGIN_CONFIG BUNDLE PROPERTIES Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME","BARCODE"); bConfig.putString("RESET_CONFIG","true"); // PARAM_LIST BUNDLE PROPERTIES Bundle bParams = new Bundle(); bParams.putString("scanner_selection","auto"); bParams.putString("scanner_input_enabled","true"); // // NOTE: The "scanner_selection" parameter (above) supports "auto" selection // --OR-- the assignment of a scanner device index, which is obtained by // using the ENUMERATE_SCANNERS API. // // Syntax for scanner index: // // Bundle bParams = new Bundle(); // diff--> bParams.putString("current-device-id","0"); // bParams.putString("scanner_input_enabled","true"); // // // NEST THE BUNDLE "bParams" WITHIN THE BUNDLE "bConfig" bConfig.putBundle("PARAM_LIST", bParams); // THEN NEST THE "bConfig" BUNDLE WITHIN THE MAIN BUNDLE "bMain" bMain.putBundle("PLUGIN_CONFIG", bConfig); // CREATE APP_LIST BUNDLES (apps and/or activities to be associated with the Profile) Bundle bundleApp1 = new Bundle(); bundleApp1.putString("PACKAGE_NAME","com.symbol.emdk.simulscansample1"); bundleApp1.putStringArray("ACTIVITY_LIST", new String[]{ "com.symbol.emdk.simulscansample1.DeviceControl", "com.symbol.emdk.simulscansample1.MainActivity", "com.symbol.emdk.simulscansample1.ResultsActivity.*", "com.symbol.emdk.simulscansample1.ResultsActivity2", "com.symbol.emdk.simulscansample1.SettingsFragment1"}); Bundle bundleApp2 = new Bundle(); bundleApp2.putString("PACKAGE_NAME","com.example.intents.datawedgeintent"); bundleApp2.putStringArray("ACTIVITY_LIST", new String[]{ "com.example.intents.datawedgeintent.DeviceControl", "com.example.intents.datawedgeintent.MainActivity", "com.example.intents.datawedgeintent.ResultsActivity", "com.example.intents.datawedgeintent.SettingsFragment1"}); Bundle bundleApp3 = new Bundle(); bundleApp3.putString("PACKAGE_NAME","*"); bundleApp3.putStringArray("ACTIVITY_LIST", new String[]{"*"}); Bundle bundleApp4 = new Bundle(); bundleApp4.putString("PACKAGE_NAME","com.symbol.myzebraapp"); bundleApp4.putStringArray("ACTIVITY_LIST", new String[]{"*"}); // NEXT APP_LIST BUNDLE(S) INTO THE MAIN BUNDLE bMain.putParcelableArray("APP_LIST", new Bundle[]{ bundleApp1 ,bundleApp2 ,bundleApp3 ,bundleApp4 }); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); this.sendBroadcast(i);

设置 RFID 输入配置

private void createProfile() {          // Create bundle for profile configuration         Bundle setConfigBundle = new Bundle();         setConfigBundle.putString("PROFILE_NAME","SampleConfigApi");         setConfigBundle.putString("PROFILE_ENABLED", "true");         setConfigBundle.putString("CONFIG_MODE","CREATE_IF_NOT_EXIST");         setConfigBundle.putString("RESET_CONFIG", "false");          // Associate profile with this app         Bundle appConfig = new Bundle();         appConfig.putString("PACKAGE_NAME", getPackageName());         appConfig.putStringArray("ACTIVITY_LIST", new String[]{"*"});         setConfigBundle.putParcelableArray("APP_LIST", new Bundle[]{appConfig});         setConfigBundle.remove("PLUGIN_CONFIG");          // Set RFID configuration         Bundle rfidConfigParamList  = new Bundle();         rfidConfigParamList.putString("rfid_input_enabled", "true");         rfidConfigParamList.putString("rfid_beeper_enable", "true");         rfidConfigParamList.putString("rfid_led_enable", "true");         rfidConfigParamList.putString("rfid_antenna_transmit_power", "30");         rfidConfigParamList.putString("rfid_memory_bank", "2");         rfidConfigParamList.putString("rfid_session", "1");         rfidConfigParamList.putString("rfid_trigger_mode", "1");         rfidConfigParamList.putString("rfid_filter_duplicate_tags", "true");         rfidConfigParamList.putString("rfid_hardware_trigger_enabled", "true");         rfidConfigParamList.putString("rfid_tag_read_duration", "250");         Bundle rfidConfigBundle = new Bundle();         rfidConfigBundle.putString("PLUGIN_NAME", "RFID");         rfidConfigBundle.putString("RESET_CONFIG", "true");         rfidConfigBundle.putBundle("PARAM_LIST", rfidConfigParamList);          // Configure intent output for captured data to be sent to this app         Bundle intentConfig = new Bundle();         intentConfig.putString("PLUGIN_NAME", "INTENT");         intentConfig.putString("RESET_CONFIG", "true");         Bundle intentProps = new Bundle();         intentProps.putString("intent_output_enabled", "true");         intentProps.putString("intent_action", "com.zebra.rfid.rwdemo.RWDEMO");         intentProps.putString("intent_category", "android.intent.category.DEFAULT");         intentProps.putString("intent_delivery", "0");         intentConfig.putBundle("PARAM_LIST", intentProps);          // Add configurations into a collection         ArrayList<Parcelable> configBundles = new ArrayList<>();         configBundles.add(rfidConfigBundle);         configBundles.add(intentConfig);         setConfigBundle.putParcelableArrayList("PLUGIN_CONFIG", configBundles);          // Broadcast the intent         Intent intent  = new Intent();         intent.setAction("com.symbol.datawedge.api.ACTION");         intent.putExtra("com.symbol.datawedge.api.SET_CONFIG", setConfigBundle);         sendBroadcast(intent); } 

设置串行输入配置

// // Port 1 Configuration [Start] // Bundle bPort1 = new Bundle(); bPort1.putString("serial_port_id", "0"); //Supported Values: 0,1 bPort1.putString("serial_input_enabled", "true"); // Supported Values: true, false bPort1.putString("serial_baudrate", "1200"); // Supported Values (some): 300, 1200, 2400, 4800, 19200, and more bPort1.putString("serial_databits", "8"); //Supported Values: 8, 7 bPort1.putString("serial_parity", "ODD"); //Supported Values: NONE, ODD, EVEN, MARK, SPACE bPort1.putString("serial_stopbits", "1"); //Supported Values: 1, 2 bPort1.putString("serial_flow", "FLOW_RTS_CTS"); //Supported Values: FLOW_NONE, FLOW_RTS_CTS, FLOW_DSR_DTR, FLOW_XON_XOFF // // Port 1 Configuration [End] // // Port 2 Configuration [Start] // Bundle bPort2 = new Bundle(); bPort2.putString("serial_port_id", "1"); bPort2.putString("serial_input_enabled", "true"); bPort2.putString("serial_baudrate", "300"); bPort2.putString("serial_databits", "7"); //bPort2.putString("abc", "123"); bPort2.putString("serial_stopbits", "2"); bPort2.putString("serial_flow", "FLOW_DSR_DTR"); bPort2.putString("serial_parity", "EVEN"); // // Port 2 Configuration [End] // Bundle bConfig = new Bundle(); bConfig.putString("RESET_CONFIG", "false"); bConfig.putString("PLUGIN_NAME", "SERIAL"); bConfig.putParcelableArray("DEVICE_LIST", new Bundle[]{ bPort1, bPort2 }); Bundle bMain = new Bundle(); bMain.putString("PROFILE_NAME", "Profile0 (default)"); bMain.putString("CONFIG_MODE", "UPDATE"); bMain.putBundle("PLUGIN_CONFIG", bConfig); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); i.putExtra("SEND_RESULT","LAST_RESULT"); // i.putExtra("SEND_RESULT", "true"); // For versions prior to DataWedge 7.1 i.putExtra("com.symbol.datawedge.api.RESULT_CATEGORY", DEFAULT_CATEGORY); i.putExtra("COMMAND_IDENTIFIER", "DW_SERIAL_COMMAND"); this.sendBroadcast(i);

设置 Simulscan 输入配置

// SetConfig [Start] Bundle bMain = new Bundle(); Bundle bConfigSimulScan = new Bundle(); Bundle bParamsSimulScan = new Bundle(); bParamsSimulScan.putString("simulscan_input_enabled", "true"); bParamsSimulScan.putString("simulscan_input_source", "Imager"); //Supported values: Camera, Imager, Default bParamsSimulScan.putString("simulscan_region_separator", "TAB"); //Supported Values:None, TAB, CR, LF, NONE bParamsSimulScan.putString("simulscan_log_dir", "/storage/zebra/intent/"); bParamsSimulScan.putString("simulscan_enable_timestamp", "true"); bParamsSimulScan.putString("simulscan_template", "UserDefinedQuantity.xml"); // Ex: UserDefinedQuantity.xml, Default - BankCheck.xml, Default - Barcode 1.xml, Default - Barcode 10.xml, Default - Barcode 2.xml, Default - Barcode 4.xml, Default - Barcode 5.xml, Default - BookNumber.xml, Default - DocCap + Optional Barcode.xml, Default - DocCap + Required Barcode.xml, Default - TravelDoc.xml, Default - Unstructured Multi-Line.xml, Default - Unstructured Single Line.xml //Setting dynamic template params Bundle templateParamsBundle = new Bundle(); templateParamsBundle.putString("dynamic_quantity", "100"); bParamsSimulScan.putBundle("simulscan_template_params",templateParamsBundle); // This param will work only for the templates that have dynamic params. For others, this will throw PARAMETER_NOT_SUPPORTED bConfigSimulScan.putString("PLUGIN_NAME", "SIMULSCAN"); bConfigSimulScan.putString("RESET_CONFIG", "true"); bConfigSimulScan.putBundle("PARAM_LIST", bParamsSimulScan); ArrayList<Bundle> bundlePluginConfig = new ArrayList<>(); bundlePluginConfig.add(bConfigSimulScan); bMain.putParcelableArrayList("PLUGIN_CONFIG", bundlePluginConfig); bMain.putString("PROFILE_NAME", "Profile007"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); Intent iSetConfig = new Intent(); iSetConfig.setAction("com.symbol.datawedge.api.ACTION"); iSetConfig.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); iSetConfig.putExtra("SEND_RESULT", "LAST_RESULT"); iSetConfig.putExtra("COMMAND_IDENTIFIER", "INTENT_API"); // SetConfig [End] this.sendBroadcast(iSetConfig);

设置 DCP 输入配置

//SetConfig [Start] Bundle bMain = new Bundle(); Bundle bConfigDCP = new Bundle(); Bundle bParamsDCP = new Bundle(); bParamsDCP.putString("dcp_input_enabled", "true"); bParamsDCP.putString("dcp_dock_button_on", "LEFT"); //Supported values: BOTH - Left or Right, LEFT - Left only, RIGHT - Right only bParamsDCP.putString("dcp_start_in", "FULLSCREEN"); //Supported Values: FULLSCREEN, BUTTON, BUTTON_ONLY bParamsDCP.putString("dcp_highest_pos", "30"); //Supported Values: 0 - 100, Highest pos can not be greater than lowest pos bParamsDCP.putString("dcp_lowest_pos", "40"); //Supported Values: 0 - 100, Highest pos can not be greater than lowest pos bParamsDCP.putString("dcp_drag_detect_time", "501"); //Supported Values: 0 - 1000 bConfigDCP.putString("RESET_CONFIG", "false"); bConfigDCP.putBundle("PARAM_LIST", bParamsDCP); bMain.putBundle("DCP", bConfigDCP); bMain.putString("PROFILE_NAME", "Profile007"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); Intent iSetConfig = new Intent(); iSetConfig.setAction("com.symbol.datawedge.api.ACTION"); iSetConfig.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); iSetConfig.putExtra("SEND_RESULT", "LAST_RESULT"); iSetConfig.putExtra("COMMAND_IDENTIFIER", "INTENT_API"); //SetConfig [End] this.sendBroadcast(iSetConfig);

设置 MSR 输入配置

// SetConfig [Start] Bundle bMain = new Bundle(); Bundle bConfigMSR = new Bundle(); Bundle bParamsMSR = new Bundle(); bParamsMSR.putString("msr_input_enabled", "true"); bConfigMSR.putString("PLUGIN_NAME", "MSR"); bConfigMSR.putString("RESET_CONFIG", "true"); bConfigMSR.putBundle("PARAM_LIST", bParamsMSR); bMain.putBundle("PLUGIN_CONFIG", bConfigMSR); bMain.putString("PROFILE_NAME", "Profile007"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); Intent iSetConfig = new Intent(); iSetConfig.setAction("com.symbol.datawedge.api.ACTION"); iSetConfig.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); iSetConfig.putExtra("SEND_RESULT", "LAST_RESULT"); iSetConfig.putExtra("COMMAND_IDENTIFIER", "INTENT_API"); // SetConfig [End] this.sendBroadcast(iSetConfig);

设置语音输入配置

Bundle bMain = new Bundle(); bMain.putString("PROFILE_NAME", "DWDemo"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME","VOICE"); bConfig.putString("RESET_CONFIG","false"); Bundle bParams = new Bundle(); bParams.putString("voice_input_enabled","true"); // Supported Values: true, false bParams.putString("voice_data_capture_start_phrase","hi"); bParams.putString("voice_data_capture_end_phrase","end"); bParams.putString("voice_end_detection_timeout","3"); bParams.putString("voice_tab_command","true"); // Supported Values: true, false bParams.putString("voice_enter_command","true"); // Supported Values: true, false bParams.putString("voice_data_type","1"); bParams.putString("voice_start_phrase_waiting_tone","true"); // Supported Values: true, false bParams.putString("voice_data_capture_waiting_tone","false"); // Supported Values: true, false bParams.putString("voice_validation_window","true"); // Supported Values: true, false bParams.putString("voice_offline_speech","true"); // Supported Values: true, false bConfig.putBundle("PARAM_LIST", bParams); bMain.putBundle("PLUGIN_CONFIG", bConfig); //true, false Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); i.putExtra("SEND_RESULT","LAST_RESULT"); // i.putExtra("SEND_RESULT", "true"); // For versions prior to DataWedge 7.1 i.putExtra("COMMAND_IDENTIFIER", "SET_CONFIG"); this.sendBroadcast(i);

设置 BDF 处理

在通过输出插件将获取的数据发送到关联的应用程序之前,处理插件以指定方式操作获取的数据。关于 BDF关于 ADF

// Main bundle properties Bundle bMain = new Bundle(); bMain.putString("PROFILE_NAME","Profile12"); bMain.putString("PROFILE_ENABLED","true"); bMain.putString("CONFIG_MODE","CREATE_IF_NOT_EXIST"); // plugin_config bundle properties Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME","BDF"); bConfig.putString("RESET_CONFIG","true"); bConfig.putString("OUTPUT_PLUGIN_NAME","KEYSTROKE"); // param_list bundle properties Bundle bParams = new Bundle(); bParams.putString("bdf_enabled","true"); bParams.putString("bdf_prefix","AAA"); bParams.putString("bdf_send_enter","true"); bConfig.putBundle("PARAM_LIST", bParams); bMain.putBundle("PLUGIN_CONFIG", bConfig); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); this.sendBroadcast(i);

设置 ADF 处理

//MAIN BUNDLE PROPERTIES Bundle bMain = new Bundle(); bMain.putString("PROFILE_NAME","ProfileTest"); bMain.putString("PROFILE_ENABLED","true"); bMain.putString("CONFIG_MODE","CREATE_IF_NOT_EXIST"); //PLUGIN_CONFIG BUNDLE PROPERTIES Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME","ADF"); bConfig.putString("RESET_CONFIG","true"); bConfig.putString("OUTPUT_PLUGIN_NAME","KEYSTROKE"); bConfig.putString("adf_enabled","true"); //PARAM_LIST BUNDLE PROPERTIES //RULE BUNDLE PROPERTIES Bundle bParamsRule1 = new Bundle(); bParamsRule1.putString("name","Rule1"); bParamsRule1.putString("enabled","true"); bParamsRule1.putString("alldevices","true"); bParamsRule1.putString("string","abc"); bParamsRule1.putString("string_pos","2"); bParamsRule1.putString("string_len","4"); //ACTION BUNDLE PROPERTIES Bundle bParamsAction1 = new Bundle(); bParamsAction1.putString("type","SEND_NEXT"); bParamsAction1.putString("action_param_1","5"); //ACTION BUNDLE PROPERTIES Bundle bParamsAction2 = new Bundle(); bParamsAction2.putString("type","SKIP_BACK"); //DEVICE BUNDLE PROPERTIES Bundle bParamsDevice1 = new Bundle(); bParamsDevice1.putString("device_id","BARCODE"); bParamsDevice1.putString("enabled","true"); bParamsDevice1.putString("alldecoders","false"); bParamsDevice1.putString("all_label_ids","false"); //DEVICE BUNDLE PROPERTIES Bundle bParamsDevice2 = new Bundle(); bParamsDevice2.putString("device_id","MSR"); bParamsDevice2.putString("enabled","true"); //DEVICE BUNDLE PROPERTIES Bundle bParamsDevice3 = new Bundle(); bParamsDevice3.putString("device_id","SIMULSCAN"); bParamsDevice3.putString("enabled","true"); //DECODER BUNDLE PROPERTIES Bundle bParamsDecoders1 = new Bundle(); bParamsDecoders1.putString("device_id","BARCODE"); bParamsDecoders1.putString("decoder","Australian Postal"); bParamsDecoders1.putString("enabled","true"); //DECODER BUNDLE PROPERTIES Bundle bParamsDecoders2 = new Bundle(); bParamsDecoders2.putString("device_id","BARCODE"); bParamsDecoders2.putString("decoder","Bookland"); bParamsDecoders2.putString("enabled","false"); //DECODER BUNDLE PROPERTIES Bundle bParamsDecoders3 = new Bundle(); bParamsDecoders3.putString("device_id","BARCODE"); bParamsDecoders3.putString("decoder","Codebar"); bParamsDecoders3.putString("enabled","true"); //LABEL ID BUNDLE PROPERTIES Bundle bParamsLabelID1 = new Bundle(); bParamsLabelID1.putString("device_id","BARCODE"); bParamsLabelID1.putString("label_id","UDI_GS1"); bParamsLabelID1.putString("enabled","true"); //LABEL ID BUNDLE PROPERTIES Bundle bParamsLabelID2 = new Bundle(); bParamsLabelID2.putString("device_id","BARCODE"); bParamsLabelID2.putString("label_id","UDI_HIBCC"); bParamsLabelID2.putString("enabled","true"); ArrayList<Bundle> bParamsActionList = new ArrayList<Bundle>(); bParamsActionList.add(bParamsAction1); bParamsActionList.add(bParamsAction2); ArrayList<Bundle> bParamsDeviceList = new ArrayList<Bundle>(); bParamsDeviceList.add(bParamsDevice1); bParamsDeviceList.add(bParamsDevice2); bParamsDeviceList.add(bParamsDevice3); ArrayList<Bundle> bParamsDecoderList = new ArrayList<Bundle>(); bParamsDecoderList.add(bParamsDecoders1); bParamsDecoderList.add(bParamsDecoders2); bParamsDecoderList.add(bParamsDecoders3); ArrayList<Bundle> bParamsLabelIDList = new ArrayList<Bundle>(); bParamsLabelIDList.add(bParamsLabelID1); bParamsLabelIDList.add(bParamsLabelID2); bParamsRule1.putParcelableArrayList("ACTIONS",bParamsActionList); bParamsRule1.putParcelableArrayList("DEVICES",bParamsDeviceList); bParamsRule1.putParcelableArrayList("DECODERS",bParamsDecoderList); bParamsRule1.putParcelableArrayList("LABEL_IDS",bParamsLabelIDList); Bundle bParamsRule2 = new Bundle(); bParamsRule2.putString("name","Rule30"); bParamsRule2.putString("enabled","true"); bParamsRule2.putString("alldevices","true"); bParamsRule2.putString("string","cde"); bParamsRule2.putString("string_pos","3"); bParamsRule2.putString("string_len","5"); ArrayList<Bundle> bParamsList = new ArrayList<Bundle>(); bParamsList.add(bParamsRule1); bParamsList.add(bParamsRule2); bConfig.putParcelableArrayList("PARAM_LIST", bParamsList); bMain.putBundle("PLUGIN_CONFIG", bConfig); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); i.putExtra("SEND_RESULT","LAST_RESULT"); // i.putExtra("SEND_RESULT", "true"); // For versions prior to DataWedge 7.1 i.putExtra("COMMAND_IDENTIFIER", "ADF_API"); this.sendBroadcast(i); // GET RESULT CODE public void onReceive(Context context, Intent intent){ String command = intent.getStringExtra("COMMAND"); String commandidentifier = intent.getStringExtra("COMMAND_IDENTIFIER"); String result = intent.getStringExtra("RESULT"); Bundle bundle = new Bundle(); String resultInfo = ""; if(intent.hasExtra("RESULT_INFO")){ bundle = intent.getBundleExtra("RESULT_INFO"); Set<String> keys = bundle.keySet(); for (String key: keys) { resultInfo += key + ": "+bundle.getString(key) + "\n"; } } String text = "Command: "+command+"\n" + "Result: " +result+"\n" + "Result Info: " +resultInfo + "\n" + "CID:"+commandidentifier; Toast.makeText(context, text, Toast.LENGTH_LONG).show(); };

设置 TOKEN 处理

// SetConfig [Start] Bundle bMain = new Bundle(); Bundle bConfigToken = new Bundle(); Bundle bParamsToken = new Bundle(); bParamsToken.putString("send_tokens_option", "BARCODES_TOKENS"); // Supported Values: DISABLED, TOKENS, BARCODES_TOKENS bParamsToken.putString("token_separator", "LF"); //Supported Values:None, TAB, CR, LF, NONE bParamsToken.putString("multibarcode_separator", "LF"); //Supported Values:None, TAB, CR, LF, NONE Bundle tokenOrder_manufacturing_date_original = new Bundle(); tokenOrder_manufacturing_date_original.putString("name", "manufacturing_date_original"); tokenOrder_manufacturing_date_original.putString("enabled", "true"); Bundle tokenOrder_expiration_date_original = new Bundle(); tokenOrder_expiration_date_original.putString("name", "expiration_date_original"); tokenOrder_expiration_date_original.putString("enabled", "true"); Bundle tokenOrder_di = new Bundle(); tokenOrder_di.putString("name", "di"); tokenOrder_di.putString("enabled", "true"); Bundle tokenOrder_lot_number = new Bundle(); tokenOrder_lot_number.putString("name", "lot_number"); tokenOrder_lot_number.putString("enabled", "true"); Bundle tokenOrder_serial_number = new Bundle(); tokenOrder_serial_number.putString("name", "serial_number"); tokenOrder_serial_number.putString("enabled", "true"); Bundle tokenOrder_mpho_lot_number = new Bundle(); tokenOrder_mpho_lot_number.putString("name", "mpho_lot_number"); tokenOrder_mpho_lot_number.putString("enabled", "true"); Bundle tokenOrder_donation_id = new Bundle(); tokenOrder_donation_id.putString("name", "donation_id"); tokenOrder_donation_id.putString("enabled", "true"); Bundle tokenOrder_labeler_identification_code = new Bundle(); tokenOrder_labeler_identification_code.putString("name", "labeler_identification_code"); tokenOrder_labeler_identification_code.putString("enabled", "true"); Bundle tokenOrder_product_or_catalog_number = new Bundle(); tokenOrder_product_or_catalog_number.putString("name", "product_or_catalog_number"); tokenOrder_product_or_catalog_number.putString("enabled", "true"); Bundle tokenOrder_unit_of_measure_id = new Bundle(); tokenOrder_unit_of_measure_id.putString("name", "unit_of_measure_id"); tokenOrder_unit_of_measure_id.putString("enabled", "false"); Bundle tokenOrder_quantity = new Bundle(); tokenOrder_quantity.putString("name", "quantity"); tokenOrder_quantity.putString("enabled", "false"); // Specify the token order ArrayList<Bundle> tokenOrderList = new ArrayList<>(); tokenOrderList.add(tokenOrder_manufacturing_date_original); tokenOrderList.add(tokenOrder_expiration_date_original); tokenOrderList.add(tokenOrder_lot_number); tokenOrderList.add(tokenOrder_di); tokenOrderList.add(tokenOrder_serial_number); tokenOrderList.add(tokenOrder_mpho_lot_number); tokenOrderList.add(tokenOrder_donation_id); tokenOrderList.add(tokenOrder_labeler_identification_code); tokenOrderList.add(tokenOrder_product_or_catalog_number); tokenOrderList.add(tokenOrder_unit_of_measure_id); tokenOrderList.add(tokenOrder_quantity); bParamsToken.putParcelableArrayList("token_order", tokenOrderList); bConfigToken.putString("PLUGIN_NAME", "TOKEN"); bConfigToken.putString("OUTPUT_PLUGIN_NAME", "KEYSTROKE"); // Tokens are supported only in KEYSTROKE and IP plugins only bConfigToken.putString("RESET_CONFIG", "true"); bConfigToken.putBundle("PARAM_LIST", bParamsToken); bMain.putBundle("PLUGIN_CONFIG", bConfigToken); bMain.putString("PROFILE_NAME", "Profile007"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); Intent iSetConfig = new Intent(); iSetConfig.setAction("com.symbol.datawedge.api.ACTION"); iSetConfig.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); iSetConfig.putExtra("SEND_RESULT", "LAST_RESULT"); iSetConfig.putExtra("COMMAND_IDENTIFIER", "INTENT_API"); // SetConfig [End] this.sendBroadcast(iSetConfig);

设置 KEYSTROKE 输出

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); registerReceivers(); } @Override protected void onResume() { super.onResume(); setKeystrokeOutputPluginConfiguration(); } private void registerReceivers() { IntentFilter filter = new IntentFilter(); filter.addAction("com.symbol.datawedge.api.RESULT_ACTION"); filter.addCategory("android.intent.category.DEFAULT"); registerReceiver(datawedgeKeystrokeNIntentStatusBR, filter); } private BroadcastReceiver datawedgeKeystrokeNIntentStatusBR = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String command = intent.getStringExtra("COMMAND").equals("") ? "EMPTY" : intent.getStringExtra("COMMAND"); String commandIdentifier = intent.getStringExtra("COMMAND_IDENTIFIER").equals("") ? "EMPTY" : intent.getStringExtra("COMMAND_IDENTIFIER"); String result = intent.getStringExtra("RESULT").equals("") ? "EMPTY" : intent.getStringExtra("RESULT"); Bundle bundle; String resultInfo = ""; if (intent.hasExtra("RESULT_INFO")) { bundle = intent.getBundleExtra("RESULT_INFO"); Set<String> keys = bundle.keySet(); for (String key : keys) { resultInfo += key + ": " + bundle.getString(key) + "\n"; } } String text="\n"+"Command: " + command + "\n" + "Result: " + result + "\n" + "Result Info: " + resultInfo + "\n" + "CID: " + commandIdentifier; Log.d("TAG”,text); } }; public void setKeystrokeOutputPluginConfiguration() { Bundle configBundle = new Bundle(); configBundle.putString("PROFILE_NAME","UserProfile"); configBundle.putString("PROFILE_ENABLED","true"); configBundle.putString("CONFIG_MODE","CREATE_IF_NOT_EXIST"); Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME", "KEYSTROKE"); Bundle bParams = new Bundle(); bParams.putString("keystroke_output_enabled","true"); bParams.putString("keystroke_action_char","9"); // 0, 9 , 10, 13 bParams.putString("keystroke_delay_extended_ascii","500"); bParams.putString("keystroke_delay_control_chars","800"); bConfig.putBundle("PARAM_LIST", bParams); configBundle.putBundle("PLUGIN_CONFIG", bConfig); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", configBundle); i.putExtra("SEND_RESULT","LAST_RESULT"); // i.putExtra("SEND_RESULT", "true"); // For versions prior to DataWedge 7.1 i.putExtra("COMMAND_IDENTIFIER", "KEYSTROKE_API"); this.sendBroadcast(i); } @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(datawedgeKeystrokeNIntentStatusBR); }

设置 IP 输出

// SetConfig [Start] Bundle bMain = new Bundle(); Bundle bConfigIPOutput = new Bundle(); Bundle bParamsIPOutput = new Bundle(); bParamsIPOutput.putString("ip_output_enabled", "true"); bParamsIPOutput.putString("ip_output_ip_wedge_enabled", "false"); bParamsIPOutput.putString("ip_output_protocol", "UDP"); //Supported Values: TCP: UDP bParamsIPOutput.putString("ip_output_address", "192.168.0.1"); //Supported Values : IP Address format bParamsIPOutput.putString("ip_output_port", "55555"); //Supported Values : 1 - 65535 bConfigIPOutput.putString("PLUGIN_NAME", "IP"); bConfigIPOutput.putString("RESET_CONFIG", "true"); bConfigIPOutput.putBundle("PARAM_LIST", bParamsIPOutput); ArrayList<Bundle> bundlePluginConfig = new ArrayList<>(); bundlePluginConfig.add(bConfigIPOutput); bMain.putParcelableArrayList("PLUGIN_CONFIG", bundlePluginConfig); bMain.putString("PROFILE_NAME", "Profile007"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); Intent iSetConfig = new Intent(); iSetConfig.setAction("com.symbol.datawedge.api.ACTION"); iSetConfig.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); iSetConfig.putExtra("SEND_RESULT", "LAST_RESULT"); iSetConfig.putExtra("COMMAND_IDENTIFIER", "INTENT_API"); // SetConfig [End] this.sendBroadcast(iSetConfig);

设置 INTENT 输出

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); registerReceivers(); } @Override protected void onResume() { super.onResume(); setIntentOutputPluginConfiguration(); } private void registerReceivers() { IntentFilter filter = new IntentFilter(); filter.addAction("com.symbol.datawedge.api.RESULT_ACTION"); filter.addCategory("android.intent.category.DEFAULT"); registerReceiver(datawedgeKeystrokeNIntentStatusBR, filter); } private BroadcastReceiver datawedgeKeystrokeNIntentStatusBR = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String command = intent.getStringExtra("COMMAND").equals("") ? "EMPTY" : intent.getStringExtra("COMMAND"); String commandIdentifier = intent.getStringExtra("COMMAND_IDENTIFIER").equals("") ? "EMPTY" : intent.getStringExtra("COMMAND_IDENTIFIER"); String result = intent.getStringExtra("RESULT").equals("") ? "EMPTY" : intent.getStringExtra("RESULT"); Bundle bundle; String resultInfo = ""; if (intent.hasExtra("RESULT_INFO")) { bundle = intent.getBundleExtra("RESULT_INFO"); Set<String> keys = bundle.keySet(); for (String key : keys) { resultInfo += key + ": " + bundle.getString(key) + "\n"; } } String text ="\n" + "Command: " + command + "\n" + "Result: " + result + "\n" + "Result Info: " + resultInfo + "\n" + "CID: " + commandIdentifier; Log.d("TAG”,text); } }; public void setIntentOutputPluginConfiguration() { Bundle bMain = new Bundle(); Bundle bConfig = new Bundle(); Bundle bParams = new Bundle(); bParams.putString("intent_output_enabled","true"); bParams.putString("intent_action","com.symbol.dwudiusertokens.udi"); bParams.putString("intent_category","zebra.intent.dwudiusertokens.UDI"); bParams.putInt("intent_delivery",2); //Use "0" for Start Activity, "1" for Start Service, "2" for Broadcast bConfig.putString("PLUGIN_NAME", "INTENT"); bConfig.putString("RESET_CONFIG","false"); bConfig.putBundle("PARAM_LIST", bParams); bMain.putBundle("PLUGIN_CONFIG", bConfig); bMain.putString("PROFILE_NAME","UserProfile"); bMain.putString("PROFILE_ENABLED","true"); bMain.putString("CONFIG_MODE","CREATE_IF_NOT_EXIST"); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG",bMain); i.putExtra("SEND_RESULT","LAST_RESULT"); // i.putExtra("SEND_RESULT", "true"); // For versions prior to DataWedge 7.1 i.putExtra("COMMAND_IDENTIFIER", "INTENT_API"); this.sendBroadcast(i); } @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(datawedgeKeystrokeNIntentStatusBR); }

设置/获取结果代码

命令和配置 Intent 参数决定是否发送结果代码(默认情况下处于禁用状态)。使用 SEND_RESULT 时,COMMAND_IDENTIFIER 用于将结果代码与起源 Intent 进行匹配。这些参数的示例用法如下所示。

注意:此通用代码必须进行修改才能匹配正在使用的 API

// send the intent Intent i = new Intent(); i.setAction(ACTION); i.putExtra("com.symbol.datawedge.api.CREATE_PROFILE", "Profile1"); // request and identify the result code i.putExtra("SEND_RESULT","LAST_RESULT"); // i.putExtra("SEND_RESULT", "true"); // For versions prior to DataWedge 7.1 i.putExtra("COMMAND_IDENTIFIER","123456789"); this.sendBroadcast(i); // register to receive the result public void onReceive(Context context, Intent intent){ String command = intent.getStringExtra("COMMAND"); String commandidentifier = intent.getStringExtra("COMMAND_IDENTIFIER"); String result = intent.getStringExtra("RESULT"); Bundle bundle = new Bundle(); String resultInfo = ""; if(intent.hasExtra("RESULT_INFO")){ bundle = intent.getBundleExtra("RESULT_INFO"); Set<String> keys = bundle.keySet(); for (String key: keys) { resultInfo += key + ": "+bundle.getString(key) + "\n"; } } String text = "Command: "+command+"\n" + "Result: " +result+"\n" + "Result Info: " +resultInfo + "\n" + "CID:"+commandidentifier; Toast.makeText(context, text, Toast.LENGTH_LONG).show(); };

使用内部成像器进行扫描

Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME","BARCODE"); Bundle bParams = new Bundle(); bParams.putString("scanner_input_enabled", "true"); // // auto or valid scanner identifier: // bParams.putString("scanner_selection_by_identifier", "INTERNAL_IMAGER"); bConfig.putBundle("PARAM_LIST",bParams);

配置字符间延迟

private Integer ctrlCharacterDelayValue; private Integer genericCharacterDelayValue; private Boolean flagExtendedASCIIOnly; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); registerReceivers(); ctrlCharacterDelayValue = null; genericCharacterDelayValue = null; flagExtendedASCIIOnly = null; } private void registerReceivers() { IntentFilter filter = new IntentFilter(); filter.addAction("com.symbol.datawedge.api.RESULT_ACTION"); filter.addCategory(Intent.CATEGORY_DEFAULT); registerReceiver(broadcastReceiver, filter); } @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(broadcastReceiver); } //Set configuration public void setKeystrokeOutputPluginConfiguration(View v) { Bundle configBundle = new Bundle(); configBundle.putString("PROFILE_NAME","Profile0 (default)"); configBundle.putString("PROFILE_ENABLED","true"); configBundle.putString("CONFIG_MODE","UPDATE"); Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME", "KEYSTROKE"); Bundle bParams = new Bundle(); bParams.putString("keystroke_output_enabled","true"); if(ctrlCharacterDelayValue!=null){ bParams.putString("keystroke_delay_control_chars",ctrlCharacterDelayValue+""); } if(genericCharacterDelayValue !=null){ bParams.putString("keystroke_character_delay", genericCharacterDelayValue +""); } if(flagExtendedASCIIOnly!=null){ bParams.putString("keystroke_delay_multibyte_chars_only", flagExtendedASCIIOnly +""); } bConfig.putBundle("PARAM_LIST", bParams); configBundle.putBundle("PLUGIN_CONFIG", bConfig); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", configBundle); i.putExtra("SEND_RESULT","LAST_RESULT"); // i.putExtra("SEND_RESULT", "true"); // For versions prior to DataWedge 7.1 i.putExtra("COMMAND_IDENTIFIER", "KEYSTROKE_API"); this.sendBroadcast(i); } //broadcast receiver private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.d(TAG, "#DataWedge-APP# Action: " + action); //result of set config if(action.equals("com.symbol.datawedge.api.RESULT_ACTION")){ Bundle extrasBundle = intent.getExtras(); Set<String> keys = extrasBundle.keySet(); if(keys!=null&&keys.contains("RESULT")){ String result = (String)extrasBundle.get("RESULT"); Log.d(TAG,"Result:"+result); //get additional info Bundle resultInforBundle = (Bundle) extrasBundle.get("RESULT_INFO"); Object resultCode = resultInforBundle.get("RESULT_CODE"); if(resultCode instanceof String){ String code = (String)resultCode; Log.d(TAG,"Code:"+code); }else if(resultCode instanceof String[]){ String[] codesArray = (String[])resultCode; if(codesArray!=null){ for(String code : codesArray){ Log.d(TAG,"Code:"+code); } } } } }//end result of set config }//end onReceive };

使用单个 Intent 设置多个模块的配置(完整配置文件)

从 DataWedge 7.1 开始支持。以前的 DataWedge 版本需要多个 Intent 调用,以设置多个模块(插件、APP_LIST 和 Data Capture Plus)的配置。

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); IntentFilter filter = new IntentFilter(); filter.addAction("com.symbol.datawedge.api.RESULT_ACTION"); filter.addCategory("android.intent.category.DEFAULT"); registerReceiver(broadcastReceiver, filter); setConfig(); } public void setConfig() { /** * Setting configuration for: * Intent Output Plugin * Barcode Input Plugin * SimulScan Input Plugin * MSR input Plugin * IP Output Plugin * Tokens for IP Output Plugin * Application Association * DCP (Data Capture Plus) */ // SetConfig [Start] Bundle bMain = new Bundle(); Bundle bConfigIntent = new Bundle(); Bundle bParamsIntent = new Bundle(); bParamsIntent.putString("intent_output_enabled", "true"); bParamsIntent.putString("intent_action", "com.symbol.dwudiusertokens.udi"); bParamsIntent.putString("intent_category", "zebra.intent.dwudiusertokens.UDI"); bParamsIntent.putInt("intent_delivery", 5); //Use "0" for Start Activity, "1" for Start Service, "2" for Broadcast, "3" for start foreground service bConfigIntent.putString("PLUGIN_NAME", "INTENT"); bConfigIntent.putString("RESET_CONFIG", "false"); bConfigIntent.putBundle("PARAM_LIST", bParamsIntent); Bundle bConfigSimulScan = new Bundle(); Bundle bParamsSimulScan = new Bundle(); bParamsSimulScan.putString("simulscan_input_enabled", "true"); bParamsSimulScan.putString("simulscan_input_source", "Imager"); //Supported values: Camera, Imager, Default bParamsSimulScan.putString("simulscan_region_separator", "TAB"); //Supported Values:None, TAB, CR, LF, NONE bParamsSimulScan.putString("simulscan_log_dir", "/storage/zebra/intent/"); bParamsSimulScan.putString("simulscan_enable_timestamp", "true"); Bundle templateParamsBundle = new Bundle(); templateParamsBundle.putString("dynamic_quantity", "99"); bParamsSimulScan.putString("simulscan_template", "UserDefinedQuantity.xml"); // Ex: UserDefinedQuantity.xml, Default - BankCheck.xml, Default - Barcode 1.xml, Default - Barcode 10.xml, Default - Barcode 2.xml, Default - Barcode 4.xml, Default - Barcode 5.xml, Default - BookNumber.xml, Default - DocCap + Optional Barcode.xml, Default - DocCap + Required Barcode.xml, Default - TravelDoc.xml, Default - Unstructured Multi-Line.xml, Default - Unstructured Single Line.xml bParamsSimulScan.putBundle("simulscan_template_params",templateParamsBundle); bConfigSimulScan.putString("PLUGIN_NAME", "SIMULSCAN"); bConfigSimulScan.putString("RESET_CONFIG", "false"); bConfigSimulScan.putBundle("PARAM_LIST", bParamsSimulScan); Bundle bConfigBarcode = new Bundle(); Bundle bParamsBarcode = new Bundle(); bParamsBarcode.putString("scanner_selection","auto"); bParamsBarcode.putString("scanner_input_enabled","true"); bConfigBarcode.putString("PLUGIN_NAME", "BARCODE"); bConfigBarcode.putString("RESET_CONFIG", "false"); bConfigBarcode.putBundle("PARAM_LIST", bParamsBarcode); Bundle bConfigMSR = new Bundle(); Bundle bParamsMSR = new Bundle(); bParamsMSR.putString("msr_input_enabled", "true"); bConfigMSR.putString("PLUGIN_NAME", "MSR"); bConfigMSR.putString("RESET_CONFIG", "false"); bConfigMSR.putBundle("PARAM_LIST", bParamsMSR); Bundle bConfigIPOutput = new Bundle(); Bundle bParamsIPOutput = new Bundle(); bParamsIPOutput.putString("ip_output_enabled", "true"); bParamsIPOutput.putString("ip_output_ip_wedge_enabled", "false"); bParamsIPOutput.putString("ip_output_protocol", "UDP"); //Supported Values: TCP: UDP bParamsIPOutput.putString("ip_output_address", "192.168.0.1"); //Supported Values : IP Address format bParamsIPOutput.putString("ip_output_port", "55555"); //Supported Values : 1 - 65535 bConfigIPOutput.putString("PLUGIN_NAME", "IP"); bConfigIPOutput.putString("RESET_CONFIG", "false"); bConfigIPOutput.putBundle("PARAM_LIST", bParamsIPOutput); Bundle bConfigToken = new Bundle(); Bundle bParamsToken = new Bundle(); bParamsToken.putString("send_tokens_option", "BARCODES_TOKENS"); // Supported Values: DISABLED, TOKENS, BARCODES_TOKENS bParamsToken.putString("token_separator", "LF"); //Supported Values:None, TAB, CR, LF, NONE bParamsToken.putString("multibarcode_separator", "LF"); //Supported Values:None, TAB, CR, LF, NONE Bundle tokenOrder_manufacturing_date_original = new Bundle(); tokenOrder_manufacturing_date_original.putString("name","manufacturing_date_original"); tokenOrder_manufacturing_date_original.putString("enabled","true"); Bundle tokenOrder_expiration_date_original = new Bundle(); tokenOrder_expiration_date_original.putString("name","expiration_date_original"); tokenOrder_expiration_date_original.putString("enabled","true"); Bundle tokenOrder_di = new Bundle(); tokenOrder_di.putString("name","di"); tokenOrder_di.putString("enabled","true"); Bundle tokenOrder_lot_number = new Bundle(); tokenOrder_lot_number.putString("name","lot_number"); tokenOrder_lot_number.putString("enabled","true"); Bundle tokenOrder_serial_number = new Bundle(); tokenOrder_serial_number.putString("name","serial_number"); tokenOrder_serial_number.putString("enabled","true"); Bundle tokenOrder_mpho_lot_number = new Bundle(); tokenOrder_mpho_lot_number.putString("name","mpho_lot_number"); tokenOrder_mpho_lot_number.putString("enabled","true"); Bundle tokenOrder_donation_id = new Bundle(); tokenOrder_donation_id.putString("name","donation_id"); tokenOrder_donation_id.putString("enabled","true"); Bundle tokenOrder_labeler_identification_code = new Bundle(); tokenOrder_labeler_identification_code.putString("name","labeler_identification_code"); tokenOrder_labeler_identification_code.putString("enabled","true"); Bundle tokenOrder_product_or_catalog_number = new Bundle(); tokenOrder_product_or_catalog_number.putString("name","product_or_catalog_number"); tokenOrder_product_or_catalog_number.putString("enabled","true"); Bundle tokenOrder_unit_of_measure_id = new Bundle(); tokenOrder_unit_of_measure_id.putString("name","unit_of_measure_id"); tokenOrder_unit_of_measure_id.putString("enabled","true"); Bundle tokenOrder_quantity = new Bundle(); tokenOrder_quantity.putString("name","quantity"); tokenOrder_quantity.putString("enabled","false"); ArrayList<Bundle> tokenOrderList = new ArrayList<>(); tokenOrderList.add(tokenOrder_manufacturing_date_original); tokenOrderList.add(tokenOrder_expiration_date_original); tokenOrderList.add(tokenOrder_lot_number); tokenOrderList.add(tokenOrder_di); tokenOrderList.add(tokenOrder_serial_number); tokenOrderList.add(tokenOrder_mpho_lot_number); tokenOrderList.add(tokenOrder_donation_id); tokenOrderList.add(tokenOrder_labeler_identification_code); tokenOrderList.add(tokenOrder_product_or_catalog_number); tokenOrderList.add(tokenOrder_unit_of_measure_id); tokenOrderList.add(tokenOrder_quantity); bParamsToken.putParcelableArrayList("token_order", tokenOrderList); bConfigToken.putString("PLUGIN_NAME", "TOKEN"); bConfigToken.putString("OUTPUT_PLUGIN_NAME","IP"); bConfigToken.putString("RESET_CONFIG", "true"); bConfigToken.putBundle("PARAM_LIST", bParamsToken); ArrayList<Bundle> bundlePluginConfig = new ArrayList<>(); bundlePluginConfig.add(bConfigIntent); bundlePluginConfig.add(bConfigBarcode); bundlePluginConfig.add(bConfigSimulScan); bundlePluginConfig.add(bConfigMSR); bundlePluginConfig.add(bConfigIPOutput); bundlePluginConfig.add(bConfigToken); bMain.putParcelableArrayList("PLUGIN_CONFIG", bundlePluginConfig); //AppList[Start] Bundle bundleApp1 = new Bundle(); bundleApp1.putString("PACKAGE_NAME", "com.symbol.emdk.simulscansample1"); bundleApp1.putStringArray("ACTIVITY_LIST", new String[]{ "com.symbol.emdk.simulscansample1.DeviceControl", "com.symbol.emdk.simulscansample1.MainActivity", "com.symbol.emdk.simulscansample1.ResultsActivity", "com.symbol.emdk.simulscansample1.ResultsActivity2", "com.symbol.emdk.simulscansample1.SettingsFragment1"}); Bundle bundleApp2 = new Bundle(); bundleApp2.putString("PACKAGE_NAME", "com.example.intents.datawedgeintent"); bundleApp2.putStringArray("ACTIVITY_LIST", new String[]{ "com.example.intents.datawedgeintent.DeviceControl", "com.example.intents.datawedgeintent.MainActivity", "com.example.intents.datawedgeintent.ResultsActivity", "com.example.intents.datawedgeintent.SettingsFragment1"}); Bundle bundleApp3 = new Bundle(); bundleApp3.putString("PACKAGE_NAME", "com.symbol.pubudu"); bundleApp3.putStringArray("ACTIVITY_LIST", new String[]{"*"}); Bundle bundleApp4 = new Bundle(); bundleApp4.putString("PACKAGE_NAME", "com.symbol.myzebraapp"); bundleApp4.putStringArray("ACTIVITY_LIST", new String[]{"*"}); // ADD APP_LIST BUNDLE(S) INTO THE MAIN BUNDLE bMain.putParcelableArray("APP_LIST", new Bundle[]{ bundleApp1 , bundleApp2 , bundleApp3 , bundleApp4 }); // AppList [End] Bundle bConfigDCP = new Bundle(); Bundle bParamsDCP = new Bundle(); bParamsDCP.putString("dcp_input_enabled", "true"); bParamsDCP.putString("dcp_dock_button_on", "LEFT"); //Supported values: BOTH - Left or Right, LEFT - Left only, RIGHT - Right only bParamsDCP.putString("dcp_start_in", "FULLSCREEN"); //Supported Values: FULLSCREEN, BUTTON, BUTTON_ONLY bParamsDCP.putString("dcp_highest_pos", "10"); //Supported Values: 0 - 100 bParamsDCP.putString("dcp_lowest_pos", "20"); //Supported Values: 0 - 100 bParamsDCP.putString("dcp_drag_detect_time", "501"); //Supported Values: 0 - 1000 bConfigDCP.putString("RESET_CONFIG", "true"); bConfigDCP.putBundle("PARAM_LIST", bParamsDCP); bMain.putBundle("DCP", bConfigDCP); bMain.putString("PROFILE_NAME", "Profile007"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); Intent iSetConfig = new Intent(); iSetConfig.setAction("com.symbol.datawedge.api.ACTION"); iSetConfig.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); iSetConfig.putExtra("SEND_RESULT", "COMPLETE_RESULT"); //Supported values: NONE, LAST_RESULT, COMPLETE_RESULT iSetConfig.putExtra("COMMAND_IDENTIFIER", "INTENT_API"); //SetConfig [End] this.sendBroadcast(iSetConfig); } private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); String strFinalResult = ""; String command = intent.getStringExtra("COMMAND"); String profileName = intent.getStringExtra("PROFILE_NAME"); String resultInfo = ""; if (action.equals("com.symbol.datawedge.api.RESULT_ACTION")) { if (intent.hasExtra("RESULT_LIST")) { // returns for COMPLETE_RESULT resultInfo += "ProfileName: " + profileName + "\n"; ArrayList<Bundle> result_list = (ArrayList)intent.getSerializableExtra("RESULT_LIST"); for (Bundle bundleResult : result_list) { resultInfo +="\n\n"; Set<String> keys = bundleResult.keySet(); for (String key : keys) { String val = bundleResult.getString(key); if (val == null) { if (bundleResult.getStringArray(key) != null) { val = ""; for (String s : bundleResult.getStringArray(key)) { val += "" + s + "\n"; } } } resultInfo += key + ": " + val + "\n"; } } } if (command != null) { if (command.equalsIgnoreCase("com.symbol.datawedge.api.SET_CONFIG")) { Log.d("TAG", "#IntentApp# \n\nSetConfig status received:\nResultInfo: \n" + resultInfo); } } } } };

设置全局扫描器配置

Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME","BARCODE"); Bundle bParams = new Bundle(); bParams.putString("scanner_input_enabled", "true"); bParams.putString("configure_all_scanners", "true"); // configure for all scanners bConfig.putBundle("PARAM_LIST", bParams);

设置显示模式

// MAIN BUNDLE PROPERTIES Bundle bMain = new Bundle(); bMain.putString("PROFILE_NAME", "Profile1"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); // PLUGIN_CONFIG BUNDLE PROPERTIES Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME", "BARCODE"); bConfig.putString("RESET_CONFIG", "true"); // PARAM_LIST BUNDLE PROPERTIES Bundle bParams = new Bundle(); bParams.putString("scanner_selection_by_identifier", "INTERNAL_IMAGER"); bParams.putString("scanner_input_enabled" , "true"); bParams.putString("aim_type", "4"); // presentation mode bParams.putString("scene_detect_qualifier ", "0"); // 0- None and 1- Proximity Sensor Input … bConfig.putBundle("PARAM_LIST", bParams); bMain.putBundle("PLUGIN_CONFIG", bConfig); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); this.sendBroadcast(i);

字符集配置

// MAIN BUNDLE PROPERTIES Bundle bMain = new Bundle(); bMain.putString("PROFILE_NAME", "ProfileCharSet"); bMain.putString("PROFILE_ENABLED", "true"); bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST"); // PLUGIN_CONFIG BUNDLE PROPERTIES Bundle bConfig = new Bundle(); bConfig.putString("PLUGIN_NAME", "BARCODE"); bConfig.putString("RESET_CONFIG", "true"); // PARAM_LIST BUNDLE PROPERTIES Bundle bParams = new Bundle(); bParams.putString("scanner_selection_by_identifier", "INTERNAL_IMAGER"); bParams.putString("charset_name", "AUTO"); bParams.putString("auto_charset_preferred_order", "GB2312;UTF-8"); bParams.putString("auto_charset_failure_option", "UTF-8"); bConfig.putBundle("PARAM_LIST", bParams); bMain.putBundle("PLUGIN_CONFIG", bConfig); Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain); this.sendBroadcast(i);

另请参阅

Zebra 支持中心 | 集成商指南、产品手册、软件下载和支持

LaunchPad | Zebra 开发人员社区

Intent | Android 开发人员

Intent 和 Intent 过滤器 | Android 开发人员

Android Intent | 教程