NHS31xx SW API
ndeft2t.h
1 /*
2  * Copyright 2014-2020 NXP
3  * This software is owned or controlled by NXP and may only be used strictly
4  * in accordance with the applicable license terms. By expressly accepting
5  * such terms or by downloading, installing, activating and/or otherwise using
6  * the software, you are agreeing that you have read, and that you agree to
7  * comply with and are bound by, such license terms. If you do not agree to
8  * be bound by the applicable license terms, then you may not retain, install,
9  * activate or otherwise use the software.
10  */
11 
12 #ifndef __NDEFT2T_H_
13 #define __NDEFT2T_H_
14 
15 #include "chip.h"
16 #include "ndeft2t/ndeft2t_dft.h"
17 
164 #define NDEFT2T_INSTANCE_SIZE 24
165 
173 #define NDEFT2T_TEXT_RECORD_OVERHEAD(shortRecord, localeLength) (4 + ((shortRecord) ? 1 : 4) + (localeLength))
174 
182 #define NDEFT2T_MIME_RECORD_OVERHEAD(shortRecord, typeLength) (2 + ((shortRecord) ? 1 : 4) + (typeLength))
183 
191 #define NDEFT2T_EXT_RECORD_OVERHEAD(shortRecord, typeLength) (2 + ((shortRecord) ? 1 : 4) + (typeLength))
192 
198 #define NDEFT2T_URI_RECORD_OVERHEAD(shortRecord) (4 + ((shortRecord) ? 1 : 4))
199 
209 #define NDEFT2T_MSG_OVERHEAD(shortMessage, totalRecordOverhead) (8 + 2 + ((shortMessage) ? 1 : 3) + (totalRecordOverhead))
210 
211 /* ------------------------------------------------------------------------- */
212 
214 typedef enum NDEFT2T_RECORD_TYPE {
225 
227 typedef struct {
237  uint8_t *pString;
238 
239  bool shortRecord;
258  uint32_t uriCode;
260 
266 typedef struct {
272  uint8_t *pString;
273 
281  bool chunked;
283 
284 /* ------------------------------------------------------------------------- */
285 
291 typedef void (*pNdeft2t_FieldStatus_Cb_t)(bool isPresent);
292 
297 typedef void (*pNdeft2t_MsgAvailable_Cb_t)(void);
298 
299 #ifdef NDEFT2T_MSG_READ_CB
300 
305 typedef void (*pNdeft2t_MsgRead_Cb_t)(void);
306 #endif
307 
308 /* ------------------------------------------------------------------------- */
309 
314 void NDEFT2T_Init(void);
315 
320 void NDEFT2T_DeInit(void);
321 
328 void NDEFT2T_ResetNfcMemory(void);
329 
330 #ifdef NDEFT2T_MSG_READ_CB
331 
351 void NDEFT2T_EnableMessageReadDetection(unsigned int lastPageOfMessage);
352 
354 #define NDEFT2T_EnableAutomaticMode() NDEFT2T_EnableMessageReadDetection(0)
355 
360 #endif
361 
376 void NDEFT2T_CreateMessage(void *pInstance, uint8_t *pBuffer, int bufLen, bool shortMessage);
377 
395 bool NDEFT2T_CreateTextRecord(void *pInstance, const NDEFT2T_CREATE_RECORD_INFO_T *pRecordInfo);
396 
414 bool NDEFT2T_CreateExtRecord(void *pInstance, const NDEFT2T_CREATE_RECORD_INFO_T *pRecordInfo);
415 
433 bool NDEFT2T_CreateMimeRecord(void *pInstance, const NDEFT2T_CREATE_RECORD_INFO_T *pRecordInfo);
434 
453 bool NDEFT2T_CreateUriRecord(void *pInstance, const NDEFT2T_CREATE_RECORD_INFO_T *pRecordInfo);
454 
476 bool NDEFT2T_WriteRecordPayload(void *pInstance, const void * pData, int size);
477 
482 void NDEFT2T_CommitRecord(void *pInstance);
483 
490 bool NDEFT2T_CommitMessage(void *pInstance);
491 
512 bool NDEFT2T_GetMessage(void *pInstance, uint8_t *pBuffer, int bufLen);
513 
527 bool NDEFT2T_GetNextRecord(void *pInstance, NDEFT2T_PARSE_RECORD_INFO_T *pRecordInfo);
528 
542 void* NDEFT2T_GetRecordPayload(void *pInstance, int *pLen);
543 
544 #endif
void NDEFT2T_Init(void)
void(* pNdeft2t_FieldStatus_Cb_t)(bool isPresent)
Definition: ndeft2t.h:291
Definition: ndeft2t.h:217
void(* pNdeft2t_MsgRead_Cb_t)(void)
Definition: ndeft2t.h:305
bool NDEFT2T_CreateMimeRecord(void *pInstance, const NDEFT2T_CREATE_RECORD_INFO_T *pRecordInfo)
void NDEFT2T_DeInit(void)
void NDEFT2T_CreateMessage(void *pInstance, uint8_t *pBuffer, int bufLen, bool shortMessage)
Definition: ndeft2t.h:220
Definition: ndeft2t.h:215
void NDEFT2T_CommitRecord(void *pInstance)
bool NDEFT2T_CommitMessage(void *pInstance)
Definition: ndeft2t.h:223
bool NDEFT2T_GetNextRecord(void *pInstance, NDEFT2T_PARSE_RECORD_INFO_T *pRecordInfo)
Definition: ndeft2t.h:221
bool chunked
Definition: ndeft2t.h:281
Definition: ndeft2t.h:218
void NDEFT2T_EnableMessageReadDetection(unsigned int lastPageOfMessage)
bool shortRecord
Definition: ndeft2t.h:239
bool NDEFT2T_CreateExtRecord(void *pInstance, const NDEFT2T_CREATE_RECORD_INFO_T *pRecordInfo)
void(* pNdeft2t_MsgAvailable_Cb_t)(void)
Definition: ndeft2t.h:297
bool NDEFT2T_GetMessage(void *pInstance, uint8_t *pBuffer, int bufLen)
Definition: ndeft2t.h:216
NDEFT2T_RECORD_TYPE_T type
Definition: ndeft2t.h:267
void * NDEFT2T_GetRecordPayload(void *pInstance, int *pLen)
Definition: ndeft2t.h:227
Definition: ndeft2t.h:266
bool NDEFT2T_CreateUriRecord(void *pInstance, const NDEFT2T_CREATE_RECORD_INFO_T *pRecordInfo)
NDEFT2T_RECORD_TYPE_T
Definition: ndeft2t.h:214
bool NDEFT2T_WriteRecordPayload(void *pInstance, const void *pData, int size)
int stringLength
Definition: ndeft2t.h:274
void NDEFT2T_DisableMessageReadDetection(void)
Definition: ndeft2t.h:219
uint32_t uriCode
Definition: ndeft2t.h:258
Definition: ndeft2t.h:222
void NDEFT2T_ResetNfcMemory(void)
uint8_t * pString
Definition: ndeft2t.h:237
bool NDEFT2T_CreateTextRecord(void *pInstance, const NDEFT2T_CREATE_RECORD_INFO_T *pRecordInfo)