# tmr_tag_data.h File Reference

Mercury API - Tag and tag read data structures. More...

`#include "tmr_tag_protocol.h"`
`#include "tmr_gen2.h"`

## Classes

struct | TMR_TagData
struct | TMR_TagReadData

## Typedefs

typedef struct TMR_TagData | TMR_TagData
typedef enum TMR_TRD_MetadataFlag | TMR_TRD_MetadataFlag
typedef struct TMR_TagReadData | TMR_TagReadData

## Enumerations

enum | TMR_TRD_MetadataFlag

## Functions

TMR_Status | TMR_hexToBytes (const char *hex, uint8_t *bytes, uint32_t size, uint32_t *convertLen)
void | TMR_bytesToHex (const uint8_t *bytes, uint32_t size, char *hex)
TMR_Status | TMR_TRD_init (TMR_TagReadData *trd)
TMR_Status | TMR_TRD_init_data (TMR_TagReadData *trd, uint16_t size, uint8_t *buf)
TMR_Status | TMR_TRD_MEMBANK_init_data (TMR_uint8List *data, uint16_t size, uint8_t *buf)

## Detailed Description

Mercury API - Tag and tag read data structures.

Author:
  Brian Fiegel

Date:
  5/7/2009

## Typedef Documentation

typedef struct TMR_TagReadData TMR_TagReadData

A class to represent a read of an RFID tag. Provides access to the TMR_TRD_METADATA_FLAG_FREQUENCY tag structure and the metadata of the read event, such as the time of the read, the antenna that read the tag, and the number of times the tag was seen by the air protocol.

typedef enum TMR_TRD_MetadataFlag TMR_TRD_MetadataFlag

Defines the constants that may be combined to form the metadata bitmask argument to the TMR_SR_cmdReadTagSingle, TMR_SR_cmdReadTagData, and TMR_SR_cmdGetTagBuffer methods.

## Enumeration Type Documentation

enum TMR_TRD_MetadataFlag

Defines the constants that may be combined to form the metadata bitmask argument to the TMR_SR_cmdReadTagSingle, TMR_SR_cmdReadTagData, and TMR_SR_cmdGetTagBuffer methods.

## Function Documentation

void TMR_bytesToHex | ( | const uint8_t * | bytes,
|  | uint32_t | size,
|  | char * | hex |
| ) |  |  |

Convert an array of bytes, such as a tag EPC, into a hexadecimal string.

Parameters:

  | bytes | The byte array to convert.
  | size | The length of the byte array to convert.
  `[out]` | hex | The converted hexadecimal string, null-terminated.

Test:
  If size is 0, *hex should point to an empty string.

TMR_Status TMR_hexToBytes | ( | const char * | hex,
|  | uint8_t * | bytes,
|  | uint32_t | size,
|  | uint32_t * | convertLen |
| ) |  |  |

Convert a hexadecimal string into an array of bytes. The string may optionally include a "0x" prefix, which will be ignored.

Parameters:

  | hex | The hexadecimal string to convert.
  `[out]` | bytes | The array to store the converted bytes.
  | size | The length of the byte array to store into.
  `[out]` | convertLen | The number of bytes written to the array, or `NULL`.

Test:

  If hex string is empty, *bytes should not be altered.

  *convertLen is set to the correct value.

  Function works when convertLen is `NULL`.

  Specific values: `"00"`, `"0000"`, `"ffff"`, `"0xffff"`, `"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabb"`.

TMR_Status TMR_TRD_init | ( | TMR_TagReadData * | trd | ) |

Initialize TMR_TagReadData with default values. The tagData buffer will be initialized to TMR_MAX_EMBEDDED_DATA_LENGTH which can be found in tm_config.h. If this value is zero, then the buffer is pointed to NULL.

Parameters:

  | trd | Pointer to the TMR_TagReadData structure to initialize

TMR_Status TMR_TRD_init_data | ( | TMR_TagReadData * | trd,
|  | uint16_t | size,
|  | uint8_t * | buf |
| ) |  |  |

Initialize a TMR_TagReadData with the provided data storage area.

Parameters:

  | trd | Pointer to the TMR_TagReadData structure to initialize
  | size | The number of bytes pointed to
  | buf | Pointer to the uint8_t storage area

TMR_Status TMR_TRD_MEMBANK_init_data | ( | TMR_uint8List * | data,
|  | uint16_t | size,
|  | uint8_t * | buf |
| ) |  |  |

Initialize a TMR_TagReadDataMemBank with provided data storage area

Parameters:

  | data | to the TMR_uint8List structure to initialize
  | size | The nuber of bytes pointed to
  | buf | pointer to the uint8_t storage area