NurApiTagWriteTag(UInt32, Boolean, Byte, UInt32, Byte) Method

Write data to tag's memory

Definition

Namespace: NurApiDotNet
Assembly: NordicID.NurApi.Net (in NordicID.NurApi.Net.dll) Version: 4.0.0
C#
public void WriteTag(
	uint passwd,
	bool secured,
	byte wrBank,
	uint wrAddress,
	byte[] wrBuffer
)

Parameters

passwd  UInt32
Password
secured  Boolean
Set true if secured tag
wrBank  Byte
Memory bank to write to.

Password/reserved memory: BANK_PASSWD

EPC memory: BANK_EPC

TID memory BANK_TID

User memory: BANK_USER

wrAddress  UInt32
Word address for write operation
wrBuffer  Byte
Write buffer

Example

The example shows how to write a kill password bytes to a tag.

In the tag the password memory has been locked so that the reading and writeing require a pssword.

The password is given to the function as the password bank is known to be locked in whole.

For lock operations, see also SetLock(UInt32, UInt32, UInt32), SetLock(UInt32, Byte, UInt32, Byte, UInt32, UInt32) and

SetLockByEPC(UInt32, Byte, UInt32, UInt32). 'aTag' is the tag that has been retrieved from the tag storage after an inventory (see example in Inventory(Int32, Int32, Int32)).

C#
void WriteNewKillPassword(uint killPwd, uint accessPwd)
{
    byte []killPwdBytes;        // Final bytes to write

    // Make byte array...
    killPwdBytes = BitConverter.GetBytes(killPwd);
    // ...and reverse: the tag's notation is big-endian.
    System.Array.Reverse(killPwdBytes);

    try
    {
        aTag.WriteTag(accessPwd, true, NurApi.BANK_PASSWD, 0, killPwdBytes);
    }
    catch (NurApiException e)
    {
        HandleKillPwdWriteError(e.error);
    }
}

See Also