tmr_tag_data.h
Go to the documentation of this file.
00001 /* ex: set tabstop=2 shiftwidth=2 expandtab cindent: */
00002 #ifndef _TMR_TAG_DATA_H
00003 #define _TMR_TAG_DATA_H
00004 
00011 /*
00012  * Copyright (c) 2009 ThingMagic, Inc.
00013  *
00014  * Permission is hereby granted, free of charge, to any person obtaining a copy
00015  * of this software and associated documentation files (the "Software"), to deal
00016  * in the Software without restriction, including without limitation the rights
00017  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00018  * copies of the Software, and to permit persons to whom the Software is
00019  * furnished to do so, subject to the following conditions:
00020  *
00021  * The above copyright notice and this permission notice shall be included in
00022  * all copies or substantial portions of the Software.
00023  * 
00024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00025  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00026  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00027  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00028  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00029  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00030  * THE SOFTWARE.
00031  */
00032 
00033 #include "tmr_tag_protocol.h"
00034 #include "tmr_gen2.h"
00035 
00036 #ifdef  __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 #define TMR_MAX_EPC_BYTE_COUNT (62)
00041 
00046 typedef struct TMR_TagData
00047 {
00049   uint8_t epc[TMR_MAX_EPC_BYTE_COUNT];
00051   TMR_TagProtocol protocol;
00053   uint8_t epcByteCount;
00055   uint16_t crc;
00057   union
00058   {
00060     TMR_GEN2_TagData gen2;
00061   }u;
00062 } TMR_TagData;
00063   
00078 TMR_Status TMR_hexToBytes(const char *hex, uint8_t *bytes, uint32_t size, 
00079                           uint32_t *convertLen);
00080 
00090 void TMR_bytesToHex(const uint8_t *bytes, uint32_t size, char *hex);
00091 
00097 typedef enum TMR_TRD_MetadataFlag
00098 {
00099   TMR_TRD_METADATA_FLAG_NONE      = 0x0000,
00100   TMR_TRD_METADATA_FLAG_READCOUNT = 0x0001,
00101   TMR_TRD_METADATA_FLAG_RSSI      = 0x0002,
00102   TMR_TRD_METADATA_FLAG_ANTENNAID = 0x0004,
00103   TMR_TRD_METADATA_FLAG_FREQUENCY = 0x0008,
00104   TMR_TRD_METADATA_FLAG_TIMESTAMP = 0x0010,
00105   TMR_TRD_METADATA_FLAG_PHASE     = 0x0020,
00106   TMR_TRD_METADATA_FLAG_PROTOCOL  = 0x0040,
00107   TMR_TRD_METADATA_FLAG_DATA      = 0x0080,
00108   TMR_TRD_METADATA_FLAG_GPIO_STATUS = 0x0100,
00109   TMR_TRD_METADATA_FLAG_ALL       =                         
00110                                        (TMR_TRD_METADATA_FLAG_READCOUNT |
00111                                         TMR_TRD_METADATA_FLAG_RSSI      |
00112                                         TMR_TRD_METADATA_FLAG_ANTENNAID |
00113                                         TMR_TRD_METADATA_FLAG_FREQUENCY |
00114                                         TMR_TRD_METADATA_FLAG_TIMESTAMP |
00115                                         TMR_TRD_METADATA_FLAG_PHASE |
00116                                         TMR_TRD_METADATA_FLAG_PROTOCOL  |
00117                                         TMR_TRD_METADATA_FLAG_DATA |
00118                                         TMR_TRD_METADATA_FLAG_GPIO_STATUS)
00119 } TMR_TRD_MetadataFlag;
00120 
00127 typedef struct TMR_TagReadData
00128 {
00130   TMR_TagData tag;
00132   uint16_t metadataFlags;
00134   uint16_t phase;
00136   uint8_t antenna;
00138   TMR_GpioPin gpio[16];
00140   uint8_t gpioCount;
00142   uint32_t readCount;
00144   int32_t rssi;
00146   uint32_t frequency;
00148   uint32_t timestampLow;
00150   uint32_t timestampHigh;
00152   TMR_uint8List data;
00154   TMR_uint8List epcMemData;
00156   TMR_uint8List tidMemData;
00158   TMR_uint8List userMemData;
00160   TMR_uint8List reservedMemData;
00164   bool isAsyncRead;
00165   uint32_t dspMicros;
00166 #if TMR_MAX_EMBEDDED_DATA_LENGTH
00167 
00168   uint8_t _dataList[TMR_MAX_EMBEDDED_DATA_LENGTH];
00169   uint8_t _epcMemDataList[TMR_MAX_EMBEDDED_DATA_LENGTH];
00170   uint8_t _tidMemDataList[TMR_MAX_EMBEDDED_DATA_LENGTH];
00171   uint8_t _userMemDataList[TMR_MAX_EMBEDDED_DATA_LENGTH];
00172   uint8_t _reservedMemDataList[TMR_MAX_EMBEDDED_DATA_LENGTH];
00173 #endif 
00174 
00175   TMR_Reader *reader;
00176 } TMR_TagReadData;
00177 
00178 TMR_Status TMR_TRD_init(TMR_TagReadData *trd);
00179 TMR_Status TMR_TRD_init_data(TMR_TagReadData *trd, uint16_t size, uint8_t *buf);
00180 TMR_Status TMR_TRD_MEMBANK_init_data(TMR_uint8List *data, uint16_t size, uint8_t *buf);
00181 
00182 #ifdef  __cplusplus
00183 }
00184 #endif
00185 
00186 #endif /* __TAG_DATA_H */


thingmagic_rfid
Author(s): Brian Bingham
autogenerated on Thu May 16 2019 03:01:24