开发者

Write data to specific tag

Is it possible to write data to a specific RFID tag (to its user memory actually) by using Motorola's EMDK for .NET / the Symbol.rfid2.device dll ? Imagine you have 2 tags in front of you and you want to write data only to one of them.

The WriteTag method doesn't s开发者_如何学编程eem to support this.


I believe there is a new EMDK with Symbol.RFID3.device that allows you to perform tag specific operations. Check CS_RFID3Sample3.

Signature:

    // Summary:
    //     This method is used to write data to the memory bank of a specific tag.
    //
    // Parameters:
    //   tagID:
    //     EPC-ID of the Tag on which the Write operation is to be performed.
    //
    //   writeAccessParams:
    //     Parameters required for the Write operation.
    //
    //   antennaInfo:
    //     Antennas on which the current operation is to be performed. If this is null,
    //     operation will be performed on all Antennas.
    public void WriteWait(string tagID, TagAccess.WriteAccessParams writeAccessParams, AntennaInfo antennaInfo);

Usage example:

public RFIDResults WriteTag(string tagId, string writeData, MEMORY_BANK mb, Int32 offset)
    {
        byte[] writeUserData = null;
        writeUserData = new byte[writeData.Length / 2];

        ConvertStringToByteArray(writeData, ref writeUserData);

        TagAccess.WriteAccessParams writeParams = new TagAccess.WriteAccessParams();
        writeParams.AccessPassword = 0;
        writeParams.WriteData = writeUserData;
        writeParams.WriteDataLength = (uint)writeUserData.Length;
        writeParams.MemoryBank = mb;
        writeParams.ByteOffset = (uint)offset;
        try
        {
            m_RfidReader.Actions.TagAccess.WriteWait(tagId, writeParams, null);
            return RFIDResults.RFID_API_SUCCESS;
        }
        catch (OperationFailureException e)
        {
            return e.Result;
        }
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜