IntenFilter 用于 zebra WS50 扫描事件

huangapple go评论71阅读模式
英文:

IntenFilter for zebra WS50 scan event

问题

我曾经在一台斑马扫描仪设备上运行,注册了一个广播接收器事件:

var filter = new IntentFilter("com.rs5100.data");
RegisterReceiver(receiver, filter);

该操作字符串在DataWedge应用程序中定义,可以接收扫描事件。

现在我正在尝试在一台斑马WS50设备上运行它,但我无法弄清楚要注册BroadcastReceiver的操作是什么。
当扫描时,logcat会发出以下内容:

> 扫描数据已接收:
> Bundle[{com.motorolasolutions.emdk.datawedge.source=scanner,
> com.symbol.datawedge.source=scanner,
> com.symbol.datawedge.label_type=LABEL-TYPE-CODABAR,
> com.motorolasolutions.emdk.datawedge.data_string=C9991C,
> com.symbol.datawedge.data_string=C9991C,
> com.symbol.datawedge.scanner_identifier=INTERNAL_IMAGER,
> com.motorolasolutions.emdk.datawedge.label_type=LABEL-TYPE-CODABAR,
> com.motorolasolutions.emdk.datawedge.decode_data=[[B@b604fd],
> com.symbol.datawedge.decode_data=[[B@b604fd],
> com.symbol.datawedge.decoded_mode=single_decode}]

但无论我尝试注册的操作是什么,都无法在应用程序中接收到扫描。

  • com.symbol.datawedge.api.ACTION
  • com.symbol.datawedge.DWDEMO
  • com.symbol.datawedge.intent.ACTION_DATAWEDGE_BROADCAST

还是需要使用Bundle?因为这是logcat发出的内容。Bundle{....}

英文:

I used to have a zebra scanner device running where a broadcatreceiver event was registered

var filter = new IntentFilter("com.rs5100.data");

RegisterReceiver(receiver, filter);

the action string was defined in the dataWedge app and scan events were received.

Now I'm trying to get it running on a zebra ws50 device, but I cant figure out what action to register the BroadcastReceiver to.
When scanning logcat emits:

> scanner data received:
> Bundle[{com.motorolasolutions.emdk.datawedge.source=scanner,
> com.symbol.datawedge.source=scanner,
> com.symbol.datawedge.label_type=LABEL-TYPE-CODABAR,
> com.motorolasolutions.emdk.datawedge.data_string=C9991C,
> com.symbol.datawedge.data_string=C9991C,
> com.symbol.datawedge.scanner_identifier=INTERNAL_IMAGER,
> com.motorolasolutions.emdk.datawedge.label_type=LABEL-TYPE-CODABAR,
> com.motorolasolutions.emdk.datawedge.decode_data=[[B@b604fd],
> com.symbol.datawedge.decode_data=[[B@b604fd],
> com.symbol.datawedge.decoded_mode=single_decode}]

but no matter what action I try, the scan is not received in the application.

  • com.symbol.datawedge.api.ACTION
  • com.symbol.datawedge.DWDEMO
  • com.symbol.datawedge.intent.ACTION_DATAWEDGE_BROADCAST

or do something with a Bundle? As that is what logcat emit. Bundle{....}

答案1

得分: 0

通过编程方式发送给Zebra的Datawedge应用程序的Intent已经生效。我剪裁了一些设置,其中条形码扫描器的设置已更改。

public static Intent ConfigWS50()
{
    Bundle bMain = new Bundle();

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

    Bundle sorterAppBundle = new Bundle();
    sorterAppBundle.PutString("PACKAGE_NAME", "com.fips.RopsSorterApp");
    sorterAppBundle.PutStringArray("ACTIVITY_LIST", new string[] { "*" });

    bMain.PutParcelableArray("APP_LIST", new Bundle[] { sorterAppBundle });

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

    Bundle ipOutput = new Bundle();
    ipOutput.PutString("PLUGIN_NAME", "IP");
    ipOutput.PutString("RESET_CONFIG", "true");

    Bundle ipOutputProps = new Bundle();
    ipOutputProps.PutString("ip_output_enabled", "false");

    ipOutput.PutBundle("PARAM_LIST", ipOutputProps);
    bMain.PutBundle("PLUGIN_CONFIG", ipOutput);

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

    barCodeConfig.PutBundle("PARAM_LIST", barCodeProps);

    Bundle bConfigIntent = new Bundle();
    Bundle intentOutput = new Bundle();
    intentOutput.PutString("intent_output_enabled", "true");
    intentOutput.PutString("intent_action", "com.device.data");
    intentOutput.PutString("intent_category", Intent.CategoryDefault);
    intentOutput.PutInt("intent_delivery", 2);

    bConfigIntent.PutString("PLUGIN_NAME", "INTENT");
    bConfigIntent.PutString("RESET_CONFIG", "true");
    bConfigIntent.PutBundle("PARAM_LIST", intentOutput);

    bMain.PutParcelableArray("PLUGIN_CONFIG", new Bundle[] { bConfigIntent, barCodeConfig });

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

    return dataWedgeIntent;
}

SendBroadcast(AutoConfig.ConfigWS50());

然后,每个应用程序都可以订阅已注册的Intent操作,并使用与"com.device.data"相同的字符串。

```csharp
intentOutput.PutString("intent_action", "com.device.data");
英文:

Programmatically sending Intent to Zebra's Datawedge app worked. I snipped out some settings where barcode scanner settings were chenged

    public static Intent ConfigWS50()
    {
        Bundle bMain = new Bundle();

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

        Bundle sorterAppBundle = new Bundle();
        sorterAppBundle.PutString("PACKAGE_NAME", "com.fips.RopsSorterApp");
        sorterAppBundle.PutStringArray("ACTIVITY_LIST", new string[] { "*" });

        bMain.PutParcelableArray("APP_LIST", new Bundle[] { sorterAppBundle });

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

        Bundle ipOutput = new Bundle();
        ipOutput.PutString("PLUGIN_NAME", "IP");
        ipOutput.PutString("RESET_CONFIG", "true");

        Bundle ipOutputProps = new Bundle();
        ipOutputProps.PutString("ip_output_enabled", "false");

        ipOutput.PutBundle("PARAM_LIST", ipOutputProps);
        bMain.PutBundle("PLUGIN_CONFIG", ipOutput);

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

        barCodeConfig.PutBundle("PARAM_LIST", barCodeProps);

        Bundle bConfigIntent = new Bundle();
        Bundle intentOutput = new Bundle();
        intentOutput.PutString("intent_output_enabled", "true");
        intentOutput.PutString("intent_action", "com.device.data");
        intentOutput.PutString("intent_category", Intent.CategoryDefault);
        intentOutput.PutInt("intent_delivery", 2);

        bConfigIntent.PutString("PLUGIN_NAME", "INTENT");
        bConfigIntent.PutString("RESET_CONFIG", "true");
        bConfigIntent.PutBundle("PARAM_LIST", intentOutput);

        bMain.PutParcelableArray("PLUGIN_CONFIG", new Bundle[] { bConfigIntent, barCodeConfig });

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

        return dataWedgeIntent;
    }

SendBroadcast(AutoConfig.ConfigWS50());

Then every app can subscribe to the registered intent action and make to use the same string as com.device.data.

intentOutput.PutString("intent_action", "com.device.data");

huangapple
  • 本文由 发表于 2023年7月3日 14:47:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76602427.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定