Reputation: 173
I am currently developing an RFID app for a Zebra MC33 device to read tag ID and tag user data( Memorybank NONE and USER). Unfortunately I can't use the SDK from Zebra because the app is 2 versions too low and not upgradeable. At the beginning the app is on Memorybank NONE and reads the ID and gets it via Intent. However, as soon as I set the memory bank to User on the software side, no more intents seem to be sent, at least the receiver no longer responds.
But the memorybank was changed correctly in the Datawedge App.
Change Memory Bank method:
public static void ChangeMemoryBank(Android.Content.Context context, string memoryBank)
{
setConfigBundle.PutString("PROFILE_NAME", PROFILE_NAME);
setConfigBundle.PutString("PROFILE_ENABLED", "true");
setConfigBundle.PutString("CONFIG_MODE", "UPDATE");
setConfigBundle.PutString("RESET_CONFIG", "false");
rfidConfigParamBundle.PutString("rfid_memory_bank", memoryBank);
rfidConfigBundle.PutString("PLUGIN_NAME", "RFID");
rfidConfigBundle.PutString("RESET_CONFIG", "false");
rfidConfigBundle.PutBundle("PARAM_LIST", rfidConfigParamBundle);
IList<IParcelable> configBundles = new List<IParcelable>
{
rfidConfigBundle
};
setConfigBundle.PutParcelableArrayList("PLUGIN_CONFIG", configBundles);
// Broadcast the intent
Intent intent = new Intent();
intent.SetAction("com.symbol.datawedge.api.ACTION");
intent.PutExtra("com.symbol.datawedge.api.SET_CONFIG", setConfigBundle);
context.SendBroadcast(intent);
}
StopRFID Scan
public void StopRFIDScan(Object source, ElapsedEventArgs e) {
Intent intent = new Intent();
intent.SetAction("com.symbol.datawedge.api.ACTION");
intent.PutExtra("com.symbol.datawedge.api.SOFT_RFID_TRIGGER", "STOP_SCANNING");
SendBroadcast(intent);
}
Start RFID Scan
public void StartRFIDScan() {
Intent intent = new Intent();
intent.SetAction("com.symbol.datawedge.api.ACTION");
intent.PutExtra("com.symbol.datawedge.api.SOFT_RFID_TRIGGER", "START_SCANNING");
SendBroadcast(intent);
}
Intent Listener (Called by the broadcast receiver when an intent was sent)
public void IntentListener(string data)
{
if(data.Length < 50) // True if data contains the Tag ID (always smaller than 50
characters)
{
ValueText.Text = data;
ChangeMemoryBank("1"); //Switch to USER Memorybank
} else {
ValueText.Text = "|" + data;
ChangeMemoryBank("0"); //Switch to NO Memorybank
}
}
Broadcast Receiver
[BroadcastReceiver(Enabled = true)]
public class ScanReceiver:BroadcastReceiver
{
/// <summary>
/// Called if the broadcast receiver gets an intent
/// </summary>
/// <param name="context"></param>
/// <param name="intent"></param>
public override void OnReceive(Context context, Intent intent) {
string dataString = intent.GetStringExtra("com.symbol.datawedge.data_string");
SingleInActivity.Instance.RunOnUiThread(() => {
SingleInActivity.Instance.IntentListener(dataString);
});
}
}
Upvotes: 0
Views: 298