将数据写入特定标签

时间:2010-01-08 15:16:42

标签: .net rfid motorola-emdk

是否可以使用摩托罗拉的EMDK for .NET / Symbol.rfid2.device dll将数据写入特定的RFID标签(实际上是用户的内存)?想象一下,你面前有2个标签,你只想把数据写入其中一个。

WriteTag方法似乎不支持此功能。

1 个答案:

答案 0 :(得分:4)

我相信有一个新的EMDK,带有Symbol.RFID3.device,允许您执行特定于标签的操作。检查CS_RFID3Sample3。

签名:

    // 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);

用法示例:

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;
        }
    }