2 * Copyright (C) 2010 NXP Semiconductors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * \file phFriNfc_NdefRecord.h
19 * \brief NFC Ndef Record component header file.
23 * $Date: Wed Jun 17 14:17:53 2009 $
26 * $Aliases: NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
30 #ifndef PHFRINFC_NDEFRECORD_H
31 #define PHFRINFC_NDEFRECORD_H
33 #ifndef PH_FRINFC_EXCLUDE_FROM_TESTFW /* */
36 * \name NDEF Record Tools Header
38 * File: \ref phFriNfc_NdefRecord.h
42 #define PHFRINFC_NDEFRECORD_FILEREVISION "$Revision: 1.6 $" /**< \ingroup grp_file_attributes */
43 #define PHFRINFC_NDEFRECORD_FILEALIASES "$Aliases: NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */
46 #endif /* PH_FRINFC_EXCLUDE_FROM_TESTFW */
48 #include <phNfcTypes.h>
49 #include <phNfcStatus.h>
50 /* Mantis 0000214 - Platform and language dependency found in some files */
51 /* To Fix: 0000358: phFriNfc_NdefRecord.h: includes should be moved */
52 /* stdlib.h and string.h - header file inclusion removed */
55 * This component implements Ndef Message composing and processing routines.
57 * The Ndef Record is a data structure used by NFC Forum compliant devices for data transfer.
59 * The capabilities of this module are:
60 * \li Interprete a given buffer by listing the embedded NDEF records
61 * \li Extract a Ndef record from a given buffer
62 * \li Compose a NDEF record and optionally append it to an existing buffer/message
68 * \brief The TNF specifies the structure of the NDEF Record TYPE field.
70 * \name NDEF Record Type Name Format
74 #define PH_FRINFC_NDEFRECORD_TNF_EMPTY ((uint8_t)0x00) /**< Empty Record, no type, ID or payload present. */
75 #define PH_FRINFC_NDEFRECORD_TNF_NFCWELLKNOWN ((uint8_t)0x01) /**< NFC well-known type (RTD). */
76 #define PH_FRINFC_NDEFRECORD_TNF_MEDIATYPE ((uint8_t)0x02) /**< Media Type. */
77 #define PH_FRINFC_NDEFRECORD_TNF_ABSURI ((uint8_t)0x03) /**< Absolute URI. */
78 #define PH_FRINFC_NDEFRECORD_TNF_NFCEXT ((uint8_t)0x04) /**< Nfc Extenal Type (following the RTD format). */
79 #define PH_FRINFC_NDEFRECORD_TNF_UNKNOWN ((uint8_t)0x05) /**< Unknown type; Contains no Type information. */
80 #define PH_FRINFC_NDEFRECORD_TNF_UNCHANGED ((uint8_t)0x06) /**< Unchanged: Used for Chunked Records. */
81 #define PH_FRINFC_NDEFRECORD_TNF_RESERVED ((uint8_t)0x07) /**< RFU, must not be used. */
86 * \brief These are the flags specifying the content, structure or purpose of a NDEF Record.
87 * \name NDEF Record Header Flags
89 * Flags of the first record byte, as defined by the NDEF specification.
93 #define PH_FRINFC_NDEFRECORD_FLAGS_MB ((uint8_t)0x80) /**< This marks the begin of a NDEF Message. */
94 #define PH_FRINFC_NDEFRECORD_FLAGS_ME ((uint8_t)0x40) /**< Set if the record is at the Message End. */
95 #define PH_FRINFC_NDEFRECORD_FLAGS_CF ((uint8_t)0x20) /**< Chunk Flag: The record is a record chunk only. */
96 #define PH_FRINFC_NDEFRECORD_FLAGS_SR ((uint8_t)0x10) /**< Short Record: Payload Length is encoded in ONE byte only. */
97 #define PH_FRINFC_NDEFRECORD_FLAGS_IL ((uint8_t)0x08) /**< The ID Length Field is present. */
101 * NDEF Record #defines for constant value
103 #define PHFRINFCNDEFRECORD_CHUNKBIT_SET 1 /** \internal Chunk Bit is set. */
104 #define PHFRINFCNDEFRECORD_CHUNKBIT_SET_ZERO 0 /** \internal Chunk Bit is not set. */
105 #define PHNFCSTSHL16 16 /** \internal Shift 16 bits(left or right). */
106 #define PHNFCSTSHL24 24 /** \internal Shift 24 bits(left or right). */
107 #define PHFRINFCNDEFRECORD_NORMAL_RECORD_BYTE 4 /** \internal Normal record. */
108 #define PH_FRINFC_NDEFRECORD_TNFBYTE_MASK ((uint8_t)0x07) /** \internal For masking */
109 #define PH_FRINFC_NDEFRECORD_BUF_INC1 1 /** \internal Increment Buffer Address by 1 */
110 #define PH_FRINFC_NDEFRECORD_BUF_INC2 2 /** \internal Increment Buffer Address by 2 */
111 #define PH_FRINFC_NDEFRECORD_BUF_INC3 3 /** \internal Increment Buffer Address by 3 */
112 #define PH_FRINFC_NDEFRECORD_BUF_INC4 4 /** \internal Increment Buffer Address by 4 */
113 #define PH_FRINFC_NDEFRECORD_BUF_INC5 5 /** \internal Increment Buffer Address by 5 */
114 #define PH_FRINFC_NDEFRECORD_BUF_TNF_VALUE ((uint8_t)0x00) /** \internal If TNF = Empty, Unknown and Unchanged, the id, type and payload length is ZERO */
115 #define PH_FRINFC_NDEFRECORD_FLAG_MASK ((uint8_t)0xF8) /** \internal To Mask the Flag Byte */
120 *\ingroup grp_lib_nfc
121 *\brief <b> NFC NDEF Record structure definition.</b>
123 *The NDEF Record Compound used for:
124 *\li \b Extraction: The calling function(-ality) receives the NDEF data of an extracted
125 * record in this structure.
126 *\li \b Composition The caller is required to specify the data to write within this structure
127 * in order to have it serialized into a new NDEF record.
128 * The structure offers a user-friendly way to accomplish this.
130 typedef struct phFriNfc_NdefRecord
133 * The flags control (or inform about) the structure of a record.
135 * \li \b Extraction: The component fills in the flags, extracted from the NDEF record.
136 * \li \b Composition: The caller has to specify the proper flags (OR'ing of the individual
137 * flag definitions (such as \ref PH_FRINFC_NDEFRECORD_FLAGS_MB). This
138 * information goes into the generated (composed) record. The caller
139 * is responsible for applying the correct flags in order to mark the
140 * begin or end of a message or other conditions.
145 * The Type Name Format, according to the NDEF specification, e.g. \ref PH_FRINFC_NDEFRECORD_TNF_NFCWELLKNOWN .
147 * \li \b Extraction: The component fills the TNF value, extracted from the NDEF record.
148 * \li \b Composition: The caller needs to specify the TNF according to the definitions in the
149 * NDEF specification.
154 * The length of the Type field. See \ref phFriNfc_NdefRecord_t::Tnf and
155 * \ref phFriNfc_NdefRecord_t::Type .
157 * \li \b Extraction: If the TNF indicates that a type field is present this
158 * member contains its length. Otherwise the length is set
159 * to zero by the library.
160 * \li \b Composition: If the caller specifies via TNF that a Type field is present
161 * the length of the Type has to be specified in this member.
162 * Otherwise, this member is ignored by the library.
167 * Contained record type: This is a buffer holding the Type
168 * as defined in the NDEF specification of the NFC Forum.
169 * No zero-termination is present, the length is determined by
170 * \ref phFriNfc_NdefRecord_t::TypeLength .
172 * \li \b Extraction: If the record holds a type (see TNF) the function sets the pointer to the
173 * beginning of the Type field of the record. Otherwise, if no type is present
174 * this member is set to NULL by the library.
175 * \li \b Composition: The caller has to specify a pointer to a buffer holding the record type. If the
176 * caller specifies that the record is without type (TNF) this member is ignored
182 * The length of the ID field. See \ref phFriNfc_NdefRecord_t::Flags .
184 * \li \b Extraction: If the IL flag indicates that an ID field is present this
185 * member contains its length. Otherwise the length is set
186 * to zero by the library.
187 * \li \b Composition: If the caller specifies via IL that an ID field is present
188 * the length of the ID has to be specified in this member.
189 * Otherwise, this member is ignored by the library.
194 * Record ID: This is a buffer holding the ID
195 * as written in the NDEF specification of the NFC Forum.
196 * No zero-termination is present, the length is determined by
197 * \ref phFriNfc_NdefRecord_t::IdLength .
199 * \li \b Extraction: If the record holds an ID (IL Flag) the function sets the pointer to the
200 * beginning of the ID field of the record. Otherwise, if no ID is present
201 * this member is set to NULL by the library.
202 * \li \b Composition: The caller has to specify a pointer to a buffer holding the record ID. If the
203 * caller specifies that the record is without ID (IL Flag) this member is ignored
210 * The length of the Payload, in bytes. The maximum length is 2^32 - 1.
212 * \li \b Extraction: The value is set by the function. In case that the extraction encounters
213 * an error, this member is set to zero.
214 * \li \b Composition: The value must be different from ZERO and and less than 2^32 and has to be
215 * provided by the caller.
217 uint32_t PayloadLength;
220 * Payload Data, pointer to a buffer containing the payload data.
222 * \li \b Extraction: The pointer is set to the beginning of the payload.
223 * No pre-set is required before the extraction function call.
224 * \li \b Composition: The referenced data is copied to buffer where the library composes the record.
225 * The pointer is provided by the caller and must not be NULL and valid.
227 uint8_t *PayloadData;
229 } phFriNfc_NdefRecord_t;
232 #ifndef PH_FRINFC_EXCLUDE_FROM_TESTFW /* */
236 *\ingroup grp_lib_nfc
237 *\brief <b> NDEF Record \b Get \b Records function.</b>
240 * Get a list of NDEF records from the raw data as provided by the caller. This data is a
241 * buffer holding one or more NDEF records within a NDEF message (received from a NFC peer
242 * device, for example). The function returns the NumberOfRawRecords present in the message
243 * with pointers to the records stored in the array RawRecords. The function also tells
244 * whether a record is chunked.
246 * \param[in] Buffer The data buffer holding the NDEF Message, as provided
248 * \param[in] BufferLength The data length, as provided by the caller.
249 * \param[in,out] RawRecords Array of pointers, receiving the references to the found
250 * Ndef Records in the given Message. The caller has to provide the
251 * array of pointers. The array is filled with valid pointers
252 * up to the number of records found or the array size if the
253 * number of found records exceeds the size.\n
254 * If this parameter is set to NULL by the caller it is ignored.
255 * \param[in,out] IsChunked This array of booleans indicates whether a record has the
256 * CHUNKED flag set (is a partial record).
257 * The number of caller-provided array positions has to be the same
258 * as "NumberOfRawRecords".
259 * If the caller sets this parameter to NULL it is ignored.
260 * \param[in,out] NumberOfRawRecords Length of the RawRecords array and IsChunked list.
261 * The value is set by the extracting function to the actual number
262 * of records found in the data. If the user specifies 0 (zero)
263 * the function only yields the number of records without filling
264 * in pointers.\n The value NULL is invalid.
266 * \retval NFCSTATUS_SUCCESS Operation successful.
267 * \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
268 * \retval NFCSTATUS_INVALID_FORMAT This error is returned in the following scenarios
270 *<br>1. There is no Message Begin (MB) Bit in the Message.
271 *<br>2. Type Name Format (TNF) Bits are set to 0x07 (Reserved)
272 * which is reserved and has not to be used.
273 *<br>3. MB Bit is set to 1 and TNF bits are set to 0x06 (unchanged).
274 *<br>4. MB Bit is set to 1 and TNF bits are not set to 0x05 or 0x00 (unknown or Empty). However,Type Length equals 0.
275 *<br>5. Message End Bit is set to 1 and Chunked Flag(CF)is set to 1 in the same record.
276 *<br>6. Not a First Record, either the MB Bit OR the CF bit is set to 1. IDLength (IL) Bit is set to 1 and TNF bits are set to 0x06 (Unchanged).
277 *<br>7. Not a First Record, the CF Bit of previous record is set to 1 and TNF bits are not set to 0x06 (unchanged) OR\n The CF Bit of the previous record is not set to 1 and TNF bits are not set to 0x06 (unchanged).
278 *<br>8. Check for Last Chunk, CF Bit of previous record is set to 1 and CF Bit of present record is set to 0, but Type Length or ID Length is not equal to zero.
279 *<br>9. Inconsistency between the calculated length of the message and the length provided by the caller.or if TNF bits are set to 0x00 or 0x05 or 0x06 (Empty,Unknown and Unchanged), but Type Length is not equal to zero
280 *<br>10.TNF bits are set to 0x00 (Empty), but Payload Length is not equal to zero.
281 *<br>11.TNF bits are set to 0x00 (Empty),but ID Length is not equal to zero.
283 * \note The correct number of found records is returned by the function also in case that:
284 * - The "RawRecords" array is too short to hold all values: It is filled up to the allowed maximum.
285 * - The "RawRecords" array is NULL: Only the number is returned.
286 * - The "NumberOfRawRecords" parameter is zero: The array is not filled, just the number is returned.
288 * This can be used for targeted memory allocation: Specify NULL for "RawRecords" and/or
289 * zero for "NumberOfRawRecords" and the function just yields the correct array size to allocate
291 * \note \b Security: This function verifies the given NDEF message buffer integrity. Its purpose is to
292 * initially check incoming data and taking this effort away from \ref phFriNfc_NdefRecord_Parse.
293 * It is a strong requirement for \ref phFriNfc_NdefRecord_GetRecords to be called to check incoming data
294 * before it is handed over to further processing stages.
297 *LibNfcClient,LibNfc;
298 *--- [label="Tag discovered and tag found to be NDEF compliant "];
299 *LibNfcClient=>LibNfc [label="phLibNfc_Ndef_Read()",URL="\ref phLibNfc_Ndef_Read"];
300 *LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
301 *LibNfcClient<-LibNfc [label="pNdefRead_RspCb",URL="\ref pphLibNfc_RspCb_t"];
302 *--- [label="Determine No of NDEF records present."];
303 *--- [label="Note : ensure pRawRecords set to NULL"];
304 *LibNfcClient=>LibNfc [label="phFriNfc_NdefRecord_GetRecords(pBuffer,BufferLength,NULL,)",URL="\ref phFriNfc_NdefRecord_GetRecords"];
305 *LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
306 *--- [label="Now get list of raw Records present"];
307 *LibNfcClient=>LibNfc [label="phFriNfc_NdefRecord_GetRecords()",URL="\ref phFriNfc_NdefRecord_GetRecords"];
308 *LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
309 *--- [label="Now pRawRecords[] contains list of links to Records"];
313 NFCSTATUS phFriNfc_NdefRecord_GetRecords(uint8_t* pBuffer,
314 uint32_t BufferLength,
315 uint8_t* pRawRecords[ ],
316 uint8_t IsChunked[ ],
317 uint32_t* pNumberOfRawRecords
322 *\ingroup grp_lib_nfc
324 *\brief <b>NDEF Record \b Parse function</b>
327 * Extract a specific NDEF record from the data, provided by the caller. The data is a buffer holding
328 * at least the entire NDEF record (received via the NFC link, for example).
330 * \param[out] Record The NDEF record structure. The storage for the structure has to
331 * be provided by the caller matching the requirements for \b Extraction,
332 * as described in the compound documentation. It is important to note
333 * that all the pointers inside the extracted record structure direct
334 * to the \b original buffer and not to a copy (see notes) after extraction.
335 * \param[in] RawRecord The Pointer to the record location, selected out of the records array,
336 * returned by the \ref phFriNfc_NdefRecord_GetRecords function.
338 * \retval NFCSTATUS_SUCCESS Operation successful.
339 * \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
340 * \retval NFCSTATUS_INVALID_FORMAT This error is returned in the following scenarios
341 *<br>1. Type Name Format (TNF) Bits are set to 0x07 (Reserved) which is reserved and has not to be used.
342 *<br>2. TNF bits are set to 0x00 or 0x05 or 0x06 (Empty,Unknown and Unchanged), but Type Length is not
344 *<br>3. TNF bits are set to 0x00 (Empty),but Payload Length is not equal to 0.
345 *<br>4. TNF bits are set to 0x00 (Empty),but ID Length is not equal to 0.
347 * \note There are some caveats:
348 * \li The "RawRecord" Data buffer must exist at least as long as the function execution time
349 * plus the time needed by the caller to evaluate the extracted information. No copying of
350 * the contained data is done internally.
351 * \li \b Security: It is not allowed to feed an unchecked NDEF message into the RawRecord
352 * parameter of the function in an attempt to extract just the first record. The
353 * rule is always to use \ref phFriNfc_NdefRecord_GetRecords in order to retrieve the
354 * verified pointers to the individual records within a raw message. A violation of this
355 * rule leads to the loss of buffer boundary overflow protection.
358 *LibNfcClient,LibNfc;
359 *--- [label="Tag discovered and tag found to be NDEF compliant "];
360 *LibNfcClient=>LibNfc [label="phLibNfc_Ndef_Read()",URL="\ref phLibNfc_Ndef_Read"];
361 *LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
362 *LibNfcClient<-LibNfc [label="pNdefRead_RspCb",URL="\ref pphLibNfc_RspCb_t"];
363 *--- [label="Determine No of NDEF records present."];
364 *--- [label="Note : ensure pRawRecords set to NULL"];
365 *LibNfcClient=>LibNfc [label="phFriNfc_NdefRecord_GetRecords(pBuffer,BufferLength,NULL,)",URL="\ref phFriNfc_NdefRecord_GetRecords "];
366 *LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
367 *--- [label="Now get list of Raw Records present"];
368 *LibNfcClient=>LibNfc [label="phFriNfc_NdefRecord_GetRecords()",URL="\ref phFriNfc_NdefRecord_GetRecords "];
369 *LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
370 *--- [label="Now pRawRecords[] contains list of links to Records "];
371 *--- [label="Now parse each of these records"];
372 *--- [label="Note : Parse specific record from above list"];
373 *LibNfcClient=>LibNfc [label="phFriNfc_NdefRecord_Parse(pRawRecords[i],pRawRecord)",URL="\ref phFriNfc_NdefRecord_Parse "];
374 *LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
377 NFCSTATUS phFriNfc_NdefRecord_Parse(phFriNfc_NdefRecord_t* pRecord,
378 uint8_t* pRawRecord);
383 *\ingroup grp_lib_nfc
384 *\brief <b>NDEF Record \b Generate function</b>
386 * The function writes one NDEF record to a specified memory location. Called within a loop, it is
387 * possible to write more records into a contiguous buffer, in each cycle advancing by the number
388 * of bytes written for each record.
390 * \param[in] Record The NDEF record structure to append. The structure
391 * has to be initialized by the caller matching the requirements for
392 * \b Composition, as described in the documentation of
393 * the \ref phFriNfc_NdefRecord_t "NDEF Record" structure.
394 * \param[in] Buffer The pointer to the buffer to which the record shall be written.
395 * \param[in] MaxBufferSize The data buffer's (remaining) maximum size, provided by the caller.
396 * This must be the \b actual number of bytes that can be written into
397 * the buffer. The user must update this value for each call.
398 * \param[out] BytesWritten The actual number of bytes written to the buffer during the recent call.
399 * This can be used by the caller to serialize more than one record
400 * into the same buffer (composing a NDEF message).
402 * \retval NFCSTATUS_SUCCESS Operation successful.
403 * \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
404 * \retval NFCSTATUS_BUFFER_TOO_SMALL The data buffer, provided by the caller is to small to
405 * hold the composed NDEF record. The existing content is
406 * not changed, no data have been written.
408 * \note The Caller of this function must take care that, with each call, the parameters are
410 * \li MaxBufferSize must decreased by the previous call number of \b BytesWritten
411 * \li Pointer to Buffer is advanced by the previous call number of \b BytesWritten.
414 *LibNfcClient,LibNfc;
415 *--- [label="Tag discovered and tag found to be NDEF compliant "];
416 *--- [label="Create NDEF raw buffer based of NDEF record details"];
417 *LibNfcClient=>LibNfc [label="phFriNfc_NdefRecord_Generate()",URL="\ref phFriNfc_NdefRecord_Generate "];
418 *LibNfcClient<<LibNfc [label="NFCSTATUS_SUCCESS"];
419 *--- [label="Now NDEF record can be written to Tag"];
420 *LibNfcClient=>LibNfc [label="phLibNfc_Ndef_Write()",URL="\ref phLibNfc_Ndef_Write "];
421 *LibNfcClient<<LibNfc [label="NFCSTATUS_PENDING"];
422 *LibNfcClient<-LibNfc [label="pphLibNfc_RspCb_t()",URL="\ref pphLibNfc_RspCb_t"];
425 NFCSTATUS phFriNfc_NdefRecord_Generate(phFriNfc_NdefRecord_t* pRecord,
427 uint32_t MaxBufferSize,
428 uint32_t* pBytesWritten
432 /* Helper function Prototypes - Used only internally */
436 * This is a sub function to the Generate Function. This function gives the length of a record given as
437 * input and this will not check for any errors in the Record.
439 * \note <b>This is not a user API. This should not be exposed in the SDK.</b>
441 uint32_t phFriNfc_NdefRecord_GetLength(phFriNfc_NdefRecord_t* pRecord);
445 * This is a sub function to the Generate Function. This function will get bit fields of the Flags Byte
446 * and returns the Status Flag. No Error Checks done here.
448 * \note <b>This is not a user API. This should not be exposed in the SDK.</b>
450 static uint8_t phFriNfc_NdefRecord_NdefFlag(uint8_t Flags,uint8_t Mask);
454 * This is a sub function to the Parse Function. This function will get only flag bits in a Packet
455 * and omit the Type Name Format bits. No Error Checks done here.
457 * \note <b>This is not a user API. This should not be exposed in the SDK.</b>
459 static uint8_t phFriNfc_NdefRecord_RecordFlag ( uint8_t* pRecord);
463 * This is a sub function to the Parse Function. This function will get only Type Name Format bits in a Packet
464 * and omit the other Flags bits. No Error Checks done here.
466 * \note <b>This is not a user API. This should not be exposed in the SDK.</b>
468 static uint8_t phFriNfc_NdefRecord_TypeNameFormat ( uint8_t* pRecord);
472 * This function is a sub function of both Get Records and Parse function. This function extracts the
473 * Type Length, Payload Length and ID Length for the respective Type, Payload and ID Data.
475 * \param[in] Record The data buffer holding the NDEF Message, as provided by the caller.
476 * \param[out] TypeLength Length of the Type Data.
477 * \param[out] TypeLengthByte Number of Bytes required to store Type Length.
478 * \param[out] PayloadLengthByte Number of Bytes required to store Payload Length depends on Short and
480 * \param[out] PayloadLength Length of the Payload Data.
481 * \param[out] IDLengthByte Number of Bytes required to store ID Length.
482 * \param[out] IDLength Length of the ID Data.
484 * \note <b>This is not a user API. This should not be exposed in the SDK.</b>
487 static NFCSTATUS phFriNfc_NdefRecord_RecordIDCheck (uint8_t* pRecord,
488 uint8_t* pTypeLength,
489 uint8_t* pTypeLengthByte,
490 uint8_t* pPayloadLengthByte,
491 uint32_t* pPayloadLength,
492 uint8_t* pIDLengthByte,
497 * This is a sub function to the Parse Function. This function will get only Type Name Format bits in a Packet
498 * and omit the other Flags bits. No Error Checks done here.
500 * \note <b>This is not a user API. This should not be exposed in the SDK.</b>
501 * \param[in] s1 String to compare.
502 * \param[out] s2 String to compare.
503 * \param[out] count Number of characters to compare.
506 int16_t phFriNfc_NdefReg_Strnicmp(const int8_t *s1, const int8_t *s2, uint32_t count);
508 /*@}*/ /* defgroup */
510 #endif /* PH_FRINFC_EXCLUDE_FROM_TESTFW */
512 #endif /* PHFRINFC_NDEFRECORD_H */