终于弄明白了,也许有一天会有人发现它的用处。
只是加上
barCodeProps.PutString("decoder_codabar_enabled", "true");
barCodeProps.PutString("decoder_codabar_length1", "3");
这还不够。
只有在将“扫描仪自动选择”添加到捆绑包中后,它才起作用。
barCodeProps.PutString("scanner_selection", "auto");
以下是完整的功能
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应用程序。
SendBroadcast(AutoConfig.Init());
注意使用覆盖重置
所有其他设置
bMain.PutString("CONFIG_MODE", "OVERWRITE");
如果你不想使用更新
bMain.PutString("CONFIG_MODE", "UPDATE");