NXP Reader Library  v17.1.0.2535
Commands_DataManagement

Describes about the MIFARE DUOX Data Management commands. More...

Collaboration diagram for Commands_DataManagement:

Modules

 Defines
 Macro Definitions for Data Management commands.
 

Functions

phStatus_t phalMfDuoX_ReadData (void *pDataParams, uint8_t bOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pOffset, uint8_t *pLength, uint8_t **ppResponse, uint16_t *pRspLen)
 Reads data from Standard data files, Backup data files or TransactionMAC File. More...
 
phStatus_t phalMfDuoX_WriteData (void *pDataParams, uint8_t bOption, uint8_t bIns, uint8_t bFileNo, uint16_t wCRLVer, uint8_t *pOffset, uint8_t *pData, uint8_t *pLength)
 Writes data to standard data files, backup data files or these files enabled to store CRL information. More...
 
phStatus_t phalMfDuoX_GetValue (void *pDataParams, uint8_t bOption, uint8_t bFileNo, uint8_t **ppValue, uint16_t *pValueLen)
 Reads the currently stored value from value files. More...
 
phStatus_t phalMfDuoX_Credit (void *pDataParams, uint8_t bOption, uint8_t bFileNo, uint8_t *pData)
 Increases a value stored in a Value File. More...
 
phStatus_t phalMfDuoX_Debit (void *pDataParams, uint8_t bOption, uint8_t bFileNo, uint8_t *pData)
 Decreases a value stored in a Value File. More...
 
phStatus_t phalMfDuoX_LimitedCredit (void *pDataParams, uint8_t bOption, uint8_t bFileNo, uint8_t *pData)
 Allows a limited increase of a value stored in a Value file without having full Cmd.Credit permissions to the file. More...
 
phStatus_t phalMfDuoX_ReadRecords (void *pDataParams, uint8_t bOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pRecNo, uint8_t *pRecCount, uint8_t *pRecSize, uint8_t **ppResponse, uint16_t *pRspLen)
 Reads out a set of complete records from a Cyclic or Linear Record File. More...
 
phStatus_t phalMfDuoX_WriteRecord (void *pDataParams, uint8_t bOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pOffset, uint8_t *pData, uint8_t *pLength)
 Writes data to a record in a Cyclic or Linear Record File. More...
 
phStatus_t phalMfDuoX_UpdateRecord (void *pDataParams, uint8_t bOption, uint8_t bIns, uint8_t bFileNo, uint8_t *pRecNo, uint8_t *pOffset, uint8_t *pData, uint8_t *pLength)
 Updates data of an existing record in a LinearRecord or CyclicRecord file. More...
 
phStatus_t phalMfDuoX_ClearRecordFile (void *pDataParams, uint8_t bFileNo)
 Resets a Cyclic or Linear Record File. More...
 

Detailed Description

Describes about the MIFARE DUOX Data Management commands.

Function Documentation

◆ phalMfDuoX_ReadData()

phStatus_t phalMfDuoX_ReadData ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pOffset,
uint8_t pLength,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Reads data from Standard data files, Backup data files or TransactionMAC File.

Note
  • Chaining upto the size of below mentioned buffers are handled within this interface. If more data is to be read, the user has to call this function again with bOption = PH_EXCHANGE_RXCHAINING | one of the communication options.
    • In case of ISO/IEC 14443-4 Chaining, HAL response buffer is utilized. The buffer can be updated during HAL initialization.
    • In case of Native Chaining, Processing buffer is utilized. The buffer can be updated during this layer initialization.
  • In either of the exchange options, its must to provide the communication mode also.
  • If reading of data is performed using ISO / IEC 14443-4 chaining mode with wrapped enabled, make sure to disable ShortLen APDU configuration for data larger than frame size.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_SUCCESS_CHAININGIndicating more data to be read.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • For Invalid File Number (bFileNo).
  • For Invalid Chaining value (bIns).
  • For Invalid Communication option value (bOption).
  • For Invalid Exchange option value (bOption).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Options for processing of Secure Messaging and reading of data.
[in]bIns[In] Type of chaining needs to be applied. One of the below values.
[in]bFileNo[In] The file number from where the data to be read. ORed with Secondary Application indicator.
[in]pOffset[In] The offset from where the data should be read. Will be of 3 bytes with LSB first. If 0x10 need to be offset, then it will be 10 00 00.
  • 0 to (FixeSize - 1): Starting position of Read operation.
  • 0xFFFFFFFF : Return CRLFile Meta-Data
[in]pLength[In] The number of bytes to be read. Will be of 3 bytes with LSB first.
  • If 0x10 bytes need to be read, then it will be 10 00 00.
  • If complete file need to be read, then it will be 00 00 00.
[out]ppResponse[Out] The data returned by the PICC.
[out]pRspLen[Out] Length of bytes available in ppResponse buffer.

◆ phalMfDuoX_WriteData()

phStatus_t phalMfDuoX_WriteData ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint16_t  wCRLVer,
uint8_t pOffset,
uint8_t pData,
uint8_t pLength 
)

Writes data to standard data files, backup data files or these files enabled to store CRL information.

Note
  • If writing of data is performed using ISO / IEC 14443-4 chaining mode with wrapped enabled, make sure to disable ShortLen APDU configuration for data larger than frame size.
  • Implements chaining to the card. The data provided on pData will be chained to the card by sending data upto the frame size of the MIFARE PICC, at a time.
  • CRLSignature should be computed externally and provided as part of pData parameter along with Data.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • For Invalid File Number (bFileNo).
  • For Invalid Chaining value (bIns).
  • For Invalid Communication option value (bOption).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Options for processing of Secure Messaging and writing of data.

ORed with CRLFile as target file.

Parameters
[in]bIns[In] Type of chaining needs to be applied. One of the below values.
[in]bFileNo[In] The file number to which the data to be written. ORed with Secondary Application indicator.
[in]wCRLVer[In] CRLVersion is a 16-bit value encoding the current version of the CRLFile. Valid if targeting CRL File.
[in]pOffset[In] The offset from where the data should be written. Will be of 3 bytes with LSB first. If 0x10 need to be offset, then it will be 10 00 00.
[in]pData[In] The data to be written to the PICC.
  • Complete Data to be provided if not targeting CRL File
  • Complete Data including CRLSignature should be provided if targeting CRF File.
[in]pLength[In] The number of bytes to be written. Will be of 3 bytes with LSB first.
  • If 0x10 bytes need to be written, then it will be 10 00 00.
Note
  • If not targeting CRF File, the length will be as mentioned above.
  • If targeting CRL file, then the length will be Length of Data + Length of CRL Signature In this case if Data Length is 10 bytes and CRL Signature Length is 64 bytes, then pLength will be (10 + 40) 00 00 => 50 00 00

◆ phalMfDuoX_GetValue()

phStatus_t phalMfDuoX_GetValue ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bFileNo,
uint8_t **  ppValue,
uint16_t pValueLen 
)

Reads the currently stored value from value files.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffer is null.
  • For Invalid File Number (bFileNo).
  • For Invalid Communication option value (bOption).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Options for processing of Secure Messaging while retrieving Value information.
[in]bFileNo[In] The file number from which the value to be retrieved. ORed with Secondary Application indicator.
[out]ppValue[Out] The value returned by the PICC.
[out]pValueLen[Out] Length of bytes available in ppValue buffer.

◆ phalMfDuoX_Credit()

phStatus_t phalMfDuoX_Credit ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bFileNo,
uint8_t pData 
)

Increases a value stored in a Value File.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffer is null.
  • For Invalid File Number (bFileNo).
  • For Invalid Communication option value (bOption).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Communication settings for the file.
[in]bFileNo[In] The file number to which the value should be credited. ORed with Secondary Application indicator.
[in]pData[In] The value to be credited. Will be of 4 bytes with LSB first. If value 0x10 need to be credited, then it will be 10 00 00 00.

◆ phalMfDuoX_Debit()

phStatus_t phalMfDuoX_Debit ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bFileNo,
uint8_t pData 
)

Decreases a value stored in a Value File.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffer is null.
  • For Invalid File Number (bFileNo).
  • For Invalid Communication option value (bOption).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Communication settings for the file.
[in]bFileNo[In] The file number to which the value should be debited. ORed with Secondary Application indicator.
[in]pData[In] The value to be debited. Will be of 4 bytes with LSB first. If value 0x10 need to be debited, then it will be 10 00 00 00.

◆ phalMfDuoX_LimitedCredit()

phStatus_t phalMfDuoX_LimitedCredit ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bFileNo,
uint8_t pData 
)

Allows a limited increase of a value stored in a Value file without having full Cmd.Credit permissions to the file.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffer is null.
  • For Invalid File Number (bFileNo).
  • For Invalid Communication option value (bOption).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Communication settings for the file.
[in]bFileNo[In] The file number to which the value should be credited. ORed with Secondary Application indicator.
[in]pData[In] The value to be credited. Will be of 4 bytes with LSB first. If value 0x10 need to be credited, then it will be 10 00 00 00.

◆ phalMfDuoX_ReadRecords()

phStatus_t phalMfDuoX_ReadRecords ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pRecNo,
uint8_t pRecCount,
uint8_t pRecSize,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Reads out a set of complete records from a Cyclic or Linear Record File.

Note
  • Chaining upto the size of below mentioned buffers are handled within this interface. If more data is to be read, the user has to call this function again with bOption = PH_EXCHANGE_RXCHAINING | one of the communication options.
    • In case of ISO/IEC 14443-4 Chaining, HAL response buffer is utilized. The buffer can be updated during HAL initialization.
    • In case of Native Chaining, Processing buffer is utilized. The buffer can be updated during this layer initialization.
  • In either of the exchange options, its must to provide the communication mode also.
  • If reading of data is performed using ISO / IEC 14443-4 chaining mode with wrapped enabled, make sure to disable ShortLen APDU configuration for data larger than frame size.
  • If TMI collection is ON and
    • If pRecCount is zero then pRecSize is a mandatory parameter.
    • If pRecSize and pRecCount are zero, then PH_ERR_INVALID_PARAMETER "Invalid Parameter" error will be returned.
    • If wrong pRecSize is provided, then wrong pRecCount value will be calculated and updated for TMI collection.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_SUCCESS_CHAININGIndicating more data to be read.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • For Invalid File Number (bFileNo).
  • For Invalid Chaining value (bIns).
  • For Invalid Communication option value (bOption).
  • For Invalid Exchange option value (bOption).
  • If pRecSize and pRecCount are zero and TMI Collection is enabled.
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Options for processing ofSecure Messaging and reading of data.
[in]bIns[In] Type of chaining needs to be applied. One of the below values.
[in]bFileNo[In] The file number from where the data to be read. ORed with Secondary Application indicator.
[in]pRecNo[In] Record number of the newest record targeted, starting to count from the latest record written. Will be of 3 bytes with LSB first. If 0x10 need to be record number, then it will be 10 00 00.
[in]pRecCount[In] Number of records to be read. If 0x10 need to be record number, then it will be 10 00 00.
[in]pRecSize[In] The number of bytes to be read. Will be of 3 bytes with LSB first.
[out]ppResponse[Out] The data returned by the PICC.
[out]pRspLen[Out] Length of bytes available in ppResponse buffer.

◆ phalMfDuoX_WriteRecord()

phStatus_t phalMfDuoX_WriteRecord ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pOffset,
uint8_t pData,
uint8_t pLength 
)

Writes data to a record in a Cyclic or Linear Record File.

Remarks
  • If writing of data is performed using ISO / IEC 14443-4 chaining mode with wrapped enabled, make sure to disable ShortLen APDU configuration for data larger than frame size.
  • Implements chaining to the card. The data provided on pData will be chained to the card by sending data upto the frame size of the MIFARE DUOX PICC, at a time.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • For Invalid File Number (bFileNo).
  • For Invalid Chaining value (bIns).
  • For Invalid Communication option value (bOption).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Options for processing of Secure Messaging and writing of data.
[in]bIns[In] Type of chaining needs to be applied. One of the below values.
[in]bFileNo[In] The file number to which the data to be written. ORed with Secondary Application indicator.
[in]pOffset[In] The offset from where the data should be written. Will be of 3 bytes with LSB first. If 0x10 need to be offset, then it will be 10 00 00.
[in]pData[In] The data to be written to the PICC.
[in]pLength[In] The number of bytes to be written. Will be of 3 bytes with LSB first. If 0x10 bytes need to be written, then it will be 10 00 00.

◆ phalMfDuoX_UpdateRecord()

phStatus_t phalMfDuoX_UpdateRecord ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bIns,
uint8_t  bFileNo,
uint8_t pRecNo,
uint8_t pOffset,
uint8_t pData,
uint8_t pLength 
)

Updates data of an existing record in a LinearRecord or CyclicRecord file.

Remarks
  • If updating of data is performed using ISO / IEC 14443-4 chaining mode with wrapped enabled, make sure to disable ShortLen APDU configuration for data larger than frame size.
  • Implements chaining to the card. The data provided on pData will be chained to the card by sending data upto the frame size of the MIFARE DUOX PICC, at a time.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • For Invalid File Number (bFileNo).
  • For Invalid Chaining value (bIns).
  • For Invalid Communication option value (bOption).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Options for processing of Secure Messaging and updating of data.
[in]bIns[In] Type of chaining needs to be applied. One of the below values.
[in]bFileNo[In] The file number to which the data to be updated. ORed with Secondary Application indicator.
[in]pRecNo[In] Record number of the newest record targeted, starting to count from the latest record updated. Will be of 3 bytes with LSB first. If 0x10 need to be record number, then it will be 10 00 00.
[in]pOffset[In] The offset from where the data should be updated. Will be of 3 bytes with LSB first. If 0x10 need to be offset, then it will be 10 00 00.
[in]pData[In] The data to be updated to the PICC.
[in]pLength[In] The number of bytes to be updated. Will be of 3 bytes with LSB first. If 0x10 bytes need to be updated, then it will be 10 00 00.

◆ phalMfDuoX_ClearRecordFile()

phStatus_t phalMfDuoX_ClearRecordFile ( void *  pDataParams,
uint8_t  bFileNo 
)

Resets a Cyclic or Linear Record File.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETERFor Invalid File Number (bFileNo).
XXXX
  • Depending on status codes return by PICC.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bFileNo[In] The file number which needs to be cleared. ORed with Secondary Application indicator.