影视久久国产高清_成人毛片网站av_国产天堂AV在线色_亚洲国产精品人人爽夜夜爽_91免费观看国产_亚洲av网站在线播放_中文字幕日韩在线观看_欧美精品乱码在线看_亚洲AⅤ永久无码毛片蜜桃_日韩激情无码专区精品

新聞資訊

斑馬PDA的安卓Datawedge API掃描開發(fā)接口

2025-03-19 09:58:03


工業(yè)手持PDA的領(lǐng)導(dǎo)者斑馬技術(shù)

在Apk中如何快速的輸入數(shù)據(jù)

傳統(tǒng)的光標(biāo)位置,鍵盤仿真輸入數(shù)據(jù)

較容易替代,

遇到復(fù)雜問題不容易解決,

例如掃描前清空輸入框,

或是掃描數(shù)據(jù)全選的需求

ZEBRA 也支持更加安全可靠

功能更加豐富的Intent 廣播模式

將掃描數(shù)據(jù)送入輸入框


DataWedge 功能強(qiáng)大,提高生產(chǎn)力

DataWedge是在所有Zebra Android設(shè)備上運(yùn)行的服務(wù)

可被其他應(yīng)用程序用來(lái)控制數(shù)據(jù)捕獲,

而無(wú)需直接訪問DataWedge UI。

可以控制大大方便DataWedge的數(shù)據(jù)捕獲

參考《DataWedge API  接口說(shuō)明》

如果有異議以官網(wǎng)內(nèi)容為準(zhǔn)

本手冊(cè)內(nèi)容原版信息

https://techdocs.zebra.com/datawedge/8-2/guide/api/

image.png

相關(guān)官方開發(fā)樣例和源碼參考

https://techdocs.zebra.com/datawedge/8-2/guide/samples/

image.png

或參考Github網(wǎng)站 

 https://github.com/Zebra/techdocs-archive

image.png


DataWedge  配置架構(gòu)

image.png

通過(guò)指定不同的Bundle,我們可以實(shí)現(xiàn)不同框架下配置屬性的快速修改

DataWedge 調(diào)用流程

1. 創(chuàng)建一個(gè)配置文件。

如果未創(chuàng)建和分配任何配置文件,則DataWedge將使用Profile0,但我們建議為你的apk單獨(dú)創(chuàng)建Profile進(jìn)行管理

//創(chuàng)建一個(gè)獨(dú)立的profile名字為 zebraIntent

private void createProfile() {

 Intent i = new Intent(); 

i.setAction("com.symbol.datawedge.api.ACTION");

 i.putExtra("com.symbol.datawedge.api.CREATE_PROFILE", "zebraIntent");

 this.sendBroadcast(i); 

}

  • 2.  目標(biāo)應(yīng)用程序關(guān)聯(lián)新建的profile

一個(gè)Activity不能關(guān)聯(lián)到兩個(gè)profile。應(yīng)用運(yùn)行中可以通過(guò)使用SwitchProfile來(lái)切換不同的profile來(lái)實(shí)現(xiàn)不同的配置。

/* * DataWedge設(shè)置關(guān)聯(lián)應(yīng)用程序zebrascan 到profile文件zebraIntent */

public void setAppListConfiguration() 

{

Bundle bMain = new Bundle();

Bundle app1 = new Bundle();     

app1.putString("PACKAGE_NAME","com.example.zebrascan");

app1.putStringArray("ACTIVITY_LIST", new String[]{"*"});  

bMain.putParcelableArray("APP_LIST", new Bundle[]{app1});

bMain.putString("PROFILE_NAME","zebraIntent");

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", "true");

i.putExtra("COMMAND_IDENTIFIER", "APP_LIST");

this.sendBroadcast(i);

}

也可以通過(guò)修改profile來(lái)實(shí)現(xiàn)設(shè)置的切換,例如下面通過(guò)修改aim_type 的值,實(shí)現(xiàn)按鍵“連續(xù)掃描”的的設(shè)置。我們可以在 Set Config 網(wǎng)頁(yè)中,查詢?cè)敿?xì)的設(shè)置項(xiàng)說(shuō)明。(此節(jié)為可選說(shuō)明)

/* * DataWedge設(shè)置連續(xù)掃描 Intent輸出  */

public void setContinuousConfiguration()

 {

Bundle bMain = new Bundle();

Bundle bConfig = new Bundle();

Bundle bParams = new Bundle();

bParams.putString("scanner_selection","auto");

bParams.putString("aim_type","5"); 

//AIM_TYPE 0單一掃描,5連續(xù)掃描

bConfig.putBundle("PARAM_LIST", bParams);

bConfig.putString("PLUGIN_NAME","BARCODE");

bConfig.putString("RESET_CONFIG","true");

bMain.putBundle("PLUGIN_CONFIG", bConfig);

bMain.putString("PROFILE_NAME","zebraIntent");

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", "true");

i.putExtra("COMMAND_IDENTIFIER", "BARCODE_SETTING_API");

this.sendBroadcast(i);

}


3. DataWedge設(shè)置并啟用Intent輸出

設(shè)置“intent_output_enabled” 生效,此profile啟用intent傳遞數(shù)據(jù)。

定義Intent

操作字串"com.symbol.mybroadcast",

類別字串"com.symbol.category.DEFAULT"。

/* * DataWedge設(shè)置連續(xù)掃描 Intent輸出  */

public void setContinuousConfiguration()

 {

Bundle bMain = new Bundle();

Bundle bConfig = new Bundle();

Bundle bParams = new Bundle();

bParams.putString("scanner_selection","auto");

bParams.putString("aim_type","5"); 

//AIM_TYPE 0單一掃描,5連續(xù)掃描

bConfig.putBundle("PARAM_LIST", bParams);

bConfig.putString("PLUGIN_NAME","BARCODE");

bConfig.putString("RESET_CONFIG","true");


bMain.putBundle("PLUGIN_CONFIG", bConfig);

bMain.putString("PROFILE_NAME","zebraIntent");

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", "true");

i.putExtra("COMMAND_IDENTIFIER", "BARCODE_SETTING_API");

this.sendBroadcast(i);

}

4. 設(shè)置 intent 的操作字串

com.symbol.datawedge.data_string 是通過(guò)Intent捕獲到的Datawedge返回的條碼數(shù)據(jù)(字串格式)名稱,無(wú)法修改請(qǐng)注意。

//定義Intent的操作字串

private String INTENT_ACTION = "com.symbol.mybroadcast";

//定義Intent的類別字串

private String INTENT_CATEGORY = "com.symbol.category.DEFAULT";

//API中定義,通過(guò)Intent捕獲到的Datawedge返回的條碼數(shù)據(jù)(字串格式)名稱

private String DATA_STRING_TAG = "com.symbol.datawedge.data_string";

        其他       


?將DataWedge Profile的添加和配置放在程序中,通過(guò)API來(lái)實(shí)現(xiàn),這樣一方面可以避免手動(dòng)配置設(shè)備的繁瑣工作,也可以避免手動(dòng)設(shè)置失誤可能帶來(lái)的錯(cuò)誤。


?無(wú)論是使用鍵盤輸出,還是Intent輸出,建議用戶開發(fā)人員不要直接使用Profile0,建立并關(guān)聯(lián)自己的配置文件,避免其他程序的操作造成無(wú)法預(yù)測(cè)的影響。


感謝斑馬SE:Max  & Wangjian 的指導(dǎo)

客服