DataWedge
112
Return Values
The enumerated list of scanners will be returned via a broadcast Intent. The broadcast Intent action is
"com.symbol.datawedge.api.ACTION_ENUMERATEDSCANNERLIST" and the list of scanners is returned as a
string array (see the example below).
Error and debug messages will be logged to the Android logging system which then can be viewed and filtered by
the logcat command. You can use logcat from an ADB shell to view the log messages, e.g.
Error messages will be logged for invalid actions and parameters.
Example
$ adb logcat -s DWAPI
// first send the intent to enumerate the available scanners on the device
// define action string
String enumerateScanners = "com.symbol.datawedge.api.ACTION_ENUMERATESCANNERS";
// create the intent
Intent i = new Intent();
// set the action to perform
i.setAction(enumerateScanners);
// send the intent to DataWedge
context.this.sendBroadcast(i);
// now we need to be able to receive the enumerate list of available scanners
String enumeratedList = "com.symbol.datawedge.api.ACTION_ENUMERATEDSCANNERLIST";
String KEY_ENUMERATEDSCANNERLIST = "DataWedgeAPI_KEY_ENUMERATEDSCANNERLIST";
// Create a filter for the broadcast intent
IntentFilter filter = new IntentFilter();
filter.addAction(enumeratedList);
registerReceiver(myBroadcastReceiver, filter);
// now we need a broadcast receiver
private BroadcastReceiver myBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(enumeratedList)) {
Bundle b = intent.getExtras();
String[] scanner_list = b.getStringArray(KEY_ENUMERATEDSCANNERLIST);
}
}
};