Tag Write Operation

// Expert user has replied.
M Mugileeshwaran Sugumar 9 months 3 weeks ago
79 1 0

Hi, i just grabbed the piece of code from the devloper docs, while performing the write, it giving only one beep sound, i cant able to receive any exceptions or results from the tag data, can anyone tell me what am i missing?

In my case both the TargetEPC values is the same value i want to write

I also set the antenna and other configurtions as mentioned in the docs

 public void WriteTag()
{
    try
    {
        if(mReader != null && mReader.IsConnected)
        {
            TagData tagData = null;
            String tagId = QctrackSettings.RFIDEPCValue;
            TagAccess tagAccess = new TagAccess();
            TagAccess.WriteAccessParams writeAccessParams = new TagAccess.WriteAccessParams(tagAccess);
            String writeData = QctrackSettings.RFIDEPCValue; 
            writeAccessParams.AccessPassword = 0;
            writeAccessParams.MemoryBank = MEMORY_BANK.MemoryBankEpc;
            writeAccessParams.Offset = 2; //offset is 2 for EPCID
            writeAccessParams.SetWriteData(writeData);
            // data length in words
            writeAccessParams.WriteDataLength = writeData.Length / 4;
            // synchronous write
            mReader.Actions.TagAccess.WriteWait(tagId,writeAccessParams,null,tagData);

            if (tagData != null)
            {
                if (tagData.OpStatus == ACCESS_OPERATION_STATUS.AccessSuccess)
                {
                    Console.WriteLine("Write operation successful");
                }
                else
                {
                    Console.WriteLine("Write operation failed. Error code: " + tagData.OpStatus);
                }

                Console.WriteLine("Operation Code: " + tagData.OpCode);

                Console.WriteLine("Number of words written: " + tagData.NumberOfWords);
            }
            else
            {
                Console.WriteLine("TagData is null. Write operation might not have been performed.");
            }
        }
       

        
    }
    catch(Exception ex)
    {

    }
    
}

Please Register or Login to post a reply

1 Replies

S Sean Kennedy

So if you are working with TechDocs and the sample code - please understand that code snippets by themselves do not reveal what you need to know / understand.

I recommend for Android Studio developers - to use / look at the 123RFID Mobile app and Source code.

https://www.zebra.com/us/en/support-downloads/software/demo/123rfid-mobile.html

For Xamarin - the RFID SDK for Xamarin Android Devices - has the sample code in the SDK - Look for the "ZebraRFIDXamarinDemo" project in the SDK.  (There is also a signed APK if you want to just sideload / run the app and look at code offline / not debugging.)

https://www.zebra.com/us/en/support-downloads/software/developer-tools/zebra-rfid-xamarin-sdk-and-demoapp-for-android.html

 

For Either - you are looking at the "Tag Write" Activity / operation - and you will then understand all the surrounding code you need to work with to make an effective RFID app.

CONTACT
Can’t find what you’re looking for?