RFID_STATUS WINAPI RFID_WriteTagID ( RFID_HANDLE32  readerHandle,
UINT8 *  pTagID,
UINT32  tagIDLength,
LPWRITE_SPECIFIC_FIELD_ACCESS_PARAMS  lpWriteSpecificFieldAccessParams,
LPANTENNA_INFO  lpAntennaInfo,
LPVOID  rsvd 
)

This function writes to TagID of a specific tag and adjusts the PC bits according to the length of the TagID.

Parameters:
[in] readerHandle 
Handle to the RFID device.
[in] pTagID 
Access-Operation will be performed on Tag with mentioned TagID.
[in] tagIDLength 
Tag Length.
[in] lpWriteAccessParams 
Pointer to WRITE_SPECIFIC_FIELD_ACCESS_PARAMS.
[in] lpAntennaInfo 
Antenna List on which the access operation is to be performed. If this is NULL, access is performed on ALL antennas.
[in] rsvd 
Reserved for future use.
Returns:
If the function succeeds the return value is RFID_API_SUCCESS. If the function fails the return value is one of the following:
  • RFID_API_INVALID_HANDLE Handle provided is invalid
  • RFID_API_PARAM_ERROR Parameter is invalid
  • RFID_API_COMMAND_TIMEOUT Timeout and no responses from the reader
  • RFID_COMM_NO_CONNECTION No Connection exists to the Host
  • RFID_INVENTORY_IN_PROGRESS Inventory in progress, cannot perform requested operation
  • RFID_ACCESS_IN_PROGRESS Access Operation in progress, cannot perform requested operation
  • RFID_ACCESS_TAG_WRITE_FAILED Tag write failed
Remarks:
This function behaves synchronously i.e the function waits for the operation to complete and returns with the result of the operation.
See also:
RFID_WriteKillPassword, RFID_WriteAccessPassword RFID_Read, RFID_Kill, RFID_Lock, RFID_BlockWrite, RFID_BlockErase, RFID_GetLastAccessResult
Remarks:
Example:
RFID_HANDLE32 readerHandle;
RFID_STATUS rfidStatus = RFID_API_SUCCESS;
WRITE_SPECIFIC_FIELD_ACCESS_PARAMS writeSpecificFieldAccessParams;
UINT8 writeData[64] = {0x11, 0x22, 0x33, 0x44};
UINT8 passwordData[4] = {0,};// zero password
TAG_DATA* pTagData = NULL;
ERROR_INFO errorInfo;
if(RFID_API_SUCCESS == RFID_Connect(&readerHandle, TEXT("157.235.208.51"), 0, 0, 0))
{
        pTagData = RFID_AllocateTag(readerHandle);
        RFID_PerformInventory(readerHandle, NULL, NULL, NULL, NULL);
        Sleep(1000);
        RFID_StopInventory(readerHandle);
        while(RFID_GetReadTag(readerHandle, pTagData) == RFID_API_SUCCESS)
        {
                printf("\n ***********************************");
                printTagData(pTagData->pTagID, pTagData->tagIDLength);
                writeSpecificFieldAccessParams.accessPassword = 0;
                writeSpecificFieldAccessParams.writeDataLength = 4;
                writeSpecificFieldAccessParams.pWriteData = passwordData;                               
                if(RFID_API_SUCCESS == RFID_WriteKillPassword(readerHandle, pTagData->pTagID, pTagData->tagIDLength, &writeSpecificFieldAccessParams, NULL, NULL))
                {
                        printf("\n WriteKillPassword - Success");
                }
                else
                {
                        RFID_GetLastErrorInfo(readerHandle, &errorInfo);
                        printf("\n WriteKillPassword - Failed - %S %S", errorInfo.statusDesc, errorInfo.vendorMessage);
                }
                if(RFID_API_SUCCESS == RFID_WriteAccessPassword(readerHandle, pTagData->pTagID, pTagData->tagIDLength, &writeSpecificFieldAccessParams, NULL, NULL))
                {
                        printf("\n WriteAccessPassword - Success");
                }
                else
                {
                        RFID_GetLastErrorInfo(readerHandle, &errorInfo);
                        printf("\n WriteAccessPassword  - Failed - %S %S", errorInfo.statusDesc, errorInfo.vendorMessage);
                }
                UINT32 uniqueValue = GetTickCount();
                // Write Tag ID
                writeData[4] = (UINT8) uniqueValue & 0xFF;
                writeData[5] = (UINT8) ((uniqueValue >> 12 ) & 0xFF);
                writeSpecificFieldAccessParams.writeDataLength = 6;
                writeSpecificFieldAccessParams.pWriteData = writeData;          

                if(RFID_API_SUCCESS == RFID_WriteTagID(readerHandle, pTagData->pTagID, pTagData->tagIDLength, &writeSpecificFieldAccessParams, NULL, NULL))
                {
                        printf("\n WriteTagID - Success");
                }
                else
                {
                        RFID_GetLastErrorInfo(readerHandle, &errorInfo);
                        printf("\n WriteTagID  - Failed - %S %S", errorInfo.statusDesc, errorInfo.vendorMessage);
                }
        }
        rfidStatus = RFID_Disconnect(readerHandle);
}


Generated on Fri Mar 4 02:25:30 2016 for RFIDAPI3 1.1 C API Documentation by  doxygen 1.5.6