0

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);
        });
    }
}
DaveR
  • 63
  • 1
  • 10
  • The server and client need to be compiled with the same version of the class. Make sure when you compile you do a clean build so everything gets compiled using same version of the class. – jdweng Jul 05 '23 at 12:24
  • By server, do you mean the app I send the inetnt to? If so, I can't imagine that, because the 1st intent is answered correctly. Only if I change the profile of the Datawedge app dynamically during the process by an intent, no further events are sent. – DaveR Jul 06 '23 at 06:01
  • A connection has two ends. One end is the client and the other end the server. The data is sent by serializing the class data at client and then deserialize at server. The serialize class has to be the same at both client and server. – jdweng Jul 06 '23 at 08:51

0 Answers0