首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Zebra Datawedge应用程序中为意图添加正确的捆绑包顺序

在Zebra Datawedge应用程序中为意图添加正确的捆绑包顺序
EN

Stack Overflow用户
提问于 2021-10-20 08:36:38
回答 1查看 81关注 0票数 1

我开发了一个带有斑马RS5100指纹扫描仪的安卓应用程序。到目前为止,扫描仪与设备配对,然后我手动打开"Datawedge“,启用codabar,最小长度为4,最大长度为20。

根据文件所说

https://techdocs.zebra.com/datawedge/6-9/guide/api/setconfig/

可以在Bundle + Intent中设置'decoder_codabar‘、'decoder_codabar_length1’和'decoder_codabar_length2‘。

要传递给SendBroadcast的捆绑包及其设置的正确列表是什么?下面的代码在datawedge中启用配置文件,并将扫描仪输入设置为启用。但更深一层的是,没有例子。我应该创建一个新的捆绑包并将其添加到bParams捆绑包中,还是将设置添加到bParams捆绑包本身?

代码语言:javascript
复制
public static Intent Init()
{
    Bundle bMain = new Bundle();

    bMain.PutString("PROFILE_NAME", "SorterApp");
    bMain.PutString("PROFILE_ENABLED", "true");
    bMain.PutString("CONFIG_MODE", "UPDATE");

    Bundle bConfig = new Bundle();
    bConfig.PutString("PLUGIN_NAME", "BARCODE");
    bConfig.PutString("RESET_CONFIG", "false");

    Bundle bParams = new Bundle();
    bParams.PutString("scanner_input_enabled", "true");

    bConfig.PutBundle("PARAM_LIST", bParams);

    bMain.PutBundle("PLUGIN_CONFIG", bConfig);

    // decoder_codabar ??????
    // decoder_i2of5 ????????
    // decoder_codabar_length1 ?????

    Intent dataWedgeIntent = new Intent();
    dataWedgeIntent.SetAction("com.symbol.datawedge.api.ACTION");
    dataWedgeIntent.PutExtra("com.symbol.datawedge.api.SET_CONFIG", bMain);

    return dataWedgeIntent;
}
EN

回答 1

Stack Overflow用户

发布于 2021-10-20 13:20:33

最终弄明白了,也许有一天会有人发现它的用处。

只是添加

代码语言:javascript
复制
    barCodeProps.PutString("decoder_codabar_enabled", "true");
    barCodeProps.PutString("decoder_codabar_length1", "3");

是不够的。只有在将scanner_selection auto添加到捆绑包之后,它才能工作。

代码语言:javascript
复制
barCodeProps.PutString("scanner_selection", "auto");

下面是完整的函数

代码语言:javascript
复制
    public static Intent Init()
    {
        Bundle profileConfig = new Bundle();

        profileConfig.PutString("PROFILE_NAME", "RopsSorterApp");
        profileConfig.PutString("PROFILE_ENABLED", "true");
        profileConfig.PutString("CONFIG_MODE", "OVERWRITE");

        Bundle barCodeConfig = new Bundle();
        barCodeConfig.PutString("PLUGIN_NAME", "BARCODE");
        barCodeConfig.PutString("RESET_CONFIG", "true");

        Bundle barCodeProps = new Bundle();
        barCodeProps.PutString("scanner_selection", "auto");
        barCodeProps.PutString("scanner_input_enabled", "true");

        barCodeProps.PutString("decoder_codabar_enabled", "true");
        barCodeProps.PutString("decoder_codabar_length1", "3");

        barCodeProps.PutString("decoder_i2of5", "true");
        barCodeProps.PutString("decoder_i2of5_length1", "3");

        barCodeConfig.PutBundle("PARAM_LIST", barCodeProps);            
        profileConfig.PutBundle("PLUGIN_CONFIG", barCodeConfig);

        Intent dataWedgeIntent = new Intent();
        dataWedgeIntent.SetAction("com.symbol.datawedge.api.ACTION");
        dataWedgeIntent.PutExtra("com.symbol.datawedge.api.SET_CONFIG", profileConfig);

        return dataWedgeIntent;
    }

然后将意图广播到datawedge应用程序。

代码语言:javascript
复制
SendBroadcast(AutoConfig.Init());

请注意,使用覆盖重置所有其他设置

代码语言:javascript
复制
bMain.PutString("CONFIG_MODE", "OVERWRITE");

如果您不想使用更新

代码语言:javascript
复制
bMain.PutString("CONFIG_MODE", "UPDATE");
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69642798

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档