15d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*
25d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Copyright (C) 2010 NXP Semiconductors
35d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
45d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Licensed under the Apache License, Version 2.0 (the "License");
55d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * you may not use this file except in compliance with the License.
65d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * You may obtain a copy of the License at
75d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
85d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      http://www.apache.org/licenses/LICENSE-2.0
95d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Unless required by applicable law or agreed to in writing, software
115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * distributed under the License is distributed on an "AS IS" BASIS,
125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * See the License for the specific language governing permissions and
145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * limitations under the License.
155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \file  phFriNfc_NdefReg.h
195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief NFC Ndef Registration / Listening.
205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Project: NFC-FRI
225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Date: Fri Oct  5 10:10:07 2007 $
245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Author: frq05303 $
255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Revision: 1.1 $
265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Aliases: NFC_FRI1.1_WK826_PREP1,NFC_FRI1.1_WK826_R1,NFC_FRI1.1_WK826_R2,NFC_FRI1.1_WK830_PREP1,NFC_FRI1.1_WK830_PREP2,NFC_FRI1.1_WK830_R5_1,NFC_FRI1.1_WK830_R5_2,NFC_FRI1.1_WK830_R5_3,NFC_FRI1.1_WK832_PREP1,NFC_FRI1.1_WK832_PRE2,NFC_FRI1.1_WK832_PREP2,NFC_FRI1.1_WK832_PREP3,NFC_FRI1.1_WK832_R5_1,NFC_FRI1.1_WK832_R6_1,NFC_FRI1.1_WK834_PREP1,NFC_FRI1.1_WK834_PREP2,NFC_FRI1.1_WK834_R7_1,NFC_FRI1.1_WK836_PREP1,NFC_FRI1.1_WK836_R8_1,NFC_FRI1.1_WK838_PREP1,NFC_FRI1.1_WK838_R9_PREP2,NFC_FRI1.1_WK838_R9_1,NFC_FRI1.1_WK840_R10_PREP1,NFC_FRI1.1_WK840_R10_1,NFC_FRI1.1_WK842_R11_PREP1,NFC_FRI1.1_WK842_R11_PREP2,NFC_FRI1.1_WK842_R11_1,NFC_FRI1.1_WK844_PREP1,NFC_FRI1.1_WK844_R12_1,NFC_FRI1.1_WK846_PREP1,NFC_FRI1.1_WK846_R13_1,NFC_FRI1.1_WK848_PREP1,NFC_FRI1.1_WK848_R14_1,NFC_FRI1.1_WK850_PACK1,NFC_FRI1.1_WK851_PREP1,NFC_FRI1.1_WK850_R15_1,NFC_FRI1.1_WK902_PREP1,NFC_FRI1.1_WK902_R16_1,NFC_FRI1.1_WK904_PREP1,NFC_FRI1.1_WK904_R17_1,NFC_FRI1.1_WK906_R18_1,NFC_FRI1.1_WK908_PREP1,NFC_FRI1.1_WK908_R19_1,NFC_FRI1.1_WK910_PREP1,NFC_FRI1.1_WK910_R20_1,NFC_FRI1.1_WK912_PREP1,NFC_FRI1.1_WK912_R21_1,NFC_FRI1.1_WK914_PREP1,NFC_FRI1.1_WK914_R22_1,NFC_FRI1.1_WK914_R22_2,NFC_FRI1.1_WK916_R23_1,NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,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 $
275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifndef PHFRINFC_NDEFREG_H
315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PHFRINFC_NDEFREG_H
325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifndef PH_FRINFC_EXCLUDE_FROM_TESTFW /* */
345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \name NDEF Registry and Listening
375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFREG_FILEREVISION "$Revision: 1.1 $" /** \ingroup grp_file_attributes */
415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFREG_FILEALIASES  "$Aliases: NFC_FRI1.1_WK826_PREP1,NFC_FRI1.1_WK826_R1,NFC_FRI1.1_WK826_R2,NFC_FRI1.1_WK830_PREP1,NFC_FRI1.1_WK830_PREP2,NFC_FRI1.1_WK830_R5_1,NFC_FRI1.1_WK830_R5_2,NFC_FRI1.1_WK830_R5_3,NFC_FRI1.1_WK832_PREP1,NFC_FRI1.1_WK832_PRE2,NFC_FRI1.1_WK832_PREP2,NFC_FRI1.1_WK832_PREP3,NFC_FRI1.1_WK832_R5_1,NFC_FRI1.1_WK832_R6_1,NFC_FRI1.1_WK834_PREP1,NFC_FRI1.1_WK834_PREP2,NFC_FRI1.1_WK834_R7_1,NFC_FRI1.1_WK836_PREP1,NFC_FRI1.1_WK836_R8_1,NFC_FRI1.1_WK838_PREP1,NFC_FRI1.1_WK838_R9_PREP2,NFC_FRI1.1_WK838_R9_1,NFC_FRI1.1_WK840_R10_PREP1,NFC_FRI1.1_WK840_R10_1,NFC_FRI1.1_WK842_R11_PREP1,NFC_FRI1.1_WK842_R11_PREP2,NFC_FRI1.1_WK842_R11_1,NFC_FRI1.1_WK844_PREP1,NFC_FRI1.1_WK844_R12_1,NFC_FRI1.1_WK846_PREP1,NFC_FRI1.1_WK846_R13_1,NFC_FRI1.1_WK848_PREP1,NFC_FRI1.1_WK848_R14_1,NFC_FRI1.1_WK850_PACK1,NFC_FRI1.1_WK851_PREP1,NFC_FRI1.1_WK850_R15_1,NFC_FRI1.1_WK902_PREP1,NFC_FRI1.1_WK902_R16_1,NFC_FRI1.1_WK904_PREP1,NFC_FRI1.1_WK904_R17_1,NFC_FRI1.1_WK906_R18_1,NFC_FRI1.1_WK908_PREP1,NFC_FRI1.1_WK908_R19_1,NFC_FRI1.1_WK910_PREP1,NFC_FRI1.1_WK910_R20_1,NFC_FRI1.1_WK912_PREP1,NFC_FRI1.1_WK912_R21_1,NFC_FRI1.1_WK914_PREP1,NFC_FRI1.1_WK914_R22_1,NFC_FRI1.1_WK914_R22_2,NFC_FRI1.1_WK916_R23_1,NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,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 */
425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc_NdefRecord.h>
445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* Exclude from test fw */
465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*
485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * NDEF Registration And Listening - States of the Finite State machine
495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFREG_STATE_INIT        0       /**< \internal Init state. The start-up state */
525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFREG_STATE_DIS_PKT     1       /**< \internal Dispatch Packet is in progress */
535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFREG_STATE_DIS_RCD     2       /**< \internal Dispatch Record is in progress */
545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*
565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * NDEF Registration And Listening internal definitions
575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFRECORD_TNF_MASK       0x07    /**< \internal */
595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFREG_CH_FLG_ARR_INDEX  50      /**< \internal */
605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/** \defgroup grp_fri_nfc_ndef_reg NDEF Registry
655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  This component implements the NDEF Registration and Listening functionality.
675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*
715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name NDEF Registration And Listening callback and node definitions
725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \ref PH_FRINFC_NDEFREG_MAX_RTD_REGISTERED is the maximum number of RTDs
745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  that can be registered in a node.\n
755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \ref PH_FRINFC_NDEFREG_MAX_RTD is the maximum number of Records that can
765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  be present in a single callback function.
775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFREG_MAX_RTD_REGISTERED    64    /**< Maximum number of RTDs per node */
805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFREG_MAX_RTD                8    /**< Maximum number of RTDs per callback function. */
815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \brief NDEF Callback
855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc page_reg
875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  Upon reception of a NDEF record the component calls into the function registered as a listener
895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  for a NDEF type. The function must be compatible to the declaration of the pointer described in
905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  this section.
915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par Parameter
935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      The underlying type of the callback parameter (void pointer) is \ref phFriNfc_NdefReg_CbParam_t .
945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note On systems, requiring non-blocking operation, the user-defined callback function must not block,
965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       but just deliver the data and return immediately. In this case the CB must make a copy of the
975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       parameter structure (\ref phFriNfc_NdefReg_CbParam_t) and store it within the environment of the
985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       registered listener. A copy is needed because once the CB returns the values behind the parameter
995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       pointer become invalid. We observe the following rules:
1005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       - This component does not rely on lower layers (e.g. HAL), therefore it doesn't need to handle
1015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *         completion routines.
1025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       - This library gets a NDEF message and extracts the records using the NDEF Record (Tools) Library.
1035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       - Alternatively, this component can process pre-extracted NDEF records.
1045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       - This library only handles TOP level records, cascaded content is ignored.
1055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       - Functions do not block: The \ref phFriNfc_NdefReg_Process "Process" function needs to be called
1065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *         periodically until completion.
1075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       .
1085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef void(*pphFriNfc_NdefReg_Cb_t)(void*);
1105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
1135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Callback Parameter. This parameter is provided to the CB function that serves
1145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        as the notifier for services/applicatioon/software components registered for a specific
1155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        NDEF Type.
1165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * All information required to perform the \ref pphFriNfc_Cr_t "callback" operation is contained
1185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * within the structure. The members of the structure may only be read, changing them is not allowed.
1195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef struct phFriNfc_NdefReg_CbParam
1235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
1245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /**
1255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * Number of array Positions. Each array position carries data from a NDEF Record. The maximum
1265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * number is \ref PH_FRINFC_NDEFREG_MAX_RTD .
1275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
1285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                 Count;
1295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /**
1315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * The records that matched with the registred RTDs for this callback.
1325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * The number of records here will be equal to the first parameter Count.
1335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
1345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_NdefRecord_t   Records[PH_FRINFC_NDEFREG_MAX_RTD];
1355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Indicates whether a record is chunked or not. */
1375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                 Chunked[PH_FRINFC_NDEFREG_MAX_RTD];
1385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Pointer to the raw record. */
1405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                 *RawRecord[PH_FRINFC_NDEFREG_MAX_RTD];
1415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Size of the raw record */
1435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint32_t                RawRecordSize[PH_FRINFC_NDEFREG_MAX_RTD];
1445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Pointer for usage by the registering entity. The software component that registers for
1465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        a specific RTD can specify this \b context pointer. With the help of the pointer
1475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        the component is able to resolve its own address, context or object, respectively.\n
1485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        \b Example: \ref grp_fri_nfc_ndef_reg "This SW component" is embedded into a C++ system
1495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        that has one object registered for a certain RTD. \ref grp_fri_nfc_ndef_reg "This library"
1505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        itself is written in C and therefore it requires a pure "C" callback that can be provided by
1515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        C++ through a \b static member function. The registering C++ object will consequently set the
1525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        \ref phFriNfc_NdefReg_CbParam_t::CbContext pointer to its \c this pointer. When the static
1535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        member function of the C++ class is called it immediately knows the instance and can
1545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        call into one of the C++ instance members again (\ref phFriNfc_NdefReg_CbParam_t::CbContext
1555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        needs to be casted back to the original C++ class type).
1565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    */
1575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    void                    *CbContext;
1585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} phFriNfc_NdefReg_CbParam_t;
1595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
1635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Registration of a Callback - Parameter Structure
1645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This structure is used by the registering software. The registering listener has to \b initialise
1665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \b all \b members of the structure that are \b not \b internal. Members for \b internal use \b must
1675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \b not be set by the registering entity. Used by \ref phFriNfc_NdefReg_CbParam_t .
1685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef struct phFriNfc_NdefReg_Cb
1715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
1725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /**
1735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * Number of array Positions. Each array position carries data specifying a RTD. The maximum number
1745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * is \ref PH_FRINFC_NDEFREG_MAX_RTD .
1755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *
1765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * \li Needs to be set by the registering entity.
1775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
1785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     NumberOfRTDs;
1795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /**
1805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  The Type Name Format, according to the NDEF specification, see the NDEF Record (Tools) component.
1815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *
1825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * \li Needs to be set by the registering entity.
1835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
1845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     Tnf[PH_FRINFC_NDEFREG_MAX_RTD_REGISTERED];
1855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /**
1875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * Array of pointers to the individual RTD buffers.
1885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *
1895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * \li Needs to be set by the registering entity.
1905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
1915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     *NdefType[PH_FRINFC_NDEFREG_MAX_RTD_REGISTERED];
1925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /**
1945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * Array of length indicators of the RTD buffers.
1955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *
1965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * \li Needs to be set by the registering entity.
1975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
1985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                      NdeftypeLength[PH_FRINFC_NDEFREG_MAX_RTD_REGISTERED];
1995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /**
2015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * Function pointer to the C-style function within the registering entity.
2025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *
2035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * \li Needs to be set by the registering entity.
2045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    pphFriNfc_NdefReg_Cb_t       NdefCallback;
2065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /**
2085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * Context pointer of the registering entity (see \ref phFriNfc_NdefReg_CbParam_t).
2095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *
2105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * \li Needs to be set by the registering entity.
2115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    void                        *CbContext;
2135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** \internal
2155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * This member is required by the library to link to the previous registered item. In case of the
2165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * first item this member is NULL.
2175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    struct phFriNfc_NdefReg_Cb  *Previous;
2195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** \internal
2205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * This member is required by the library to link to the next registered item. In case of the
2215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     * last item this member is NULL.
2225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    struct phFriNfc_NdefReg_Cb  *Next;
2245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} phFriNfc_NdefReg_Cb_t;
2255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
2285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \brief NFC NDEF Registry Compound
2295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  The NDEF Registry Compound. This is the context structure of the NDEF Registry and
2315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  Listener.
2325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
2345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef struct phFriNfc_NdefReg
2355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
2365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_NdefReg_Cb_t       *NdefTypeList;    /**< \internal List of Callback Structures (Listeners). */
2375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     *NdefData;        /**< \internal Data to process. */
2385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint32_t                    NdefDataLength;   /**< \internal Length of the NDEF data. */
2395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     State;            /**< \internal The state of the library. */
2405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                   **NdefTypes;        /**< \internal */
2415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_NdefRecord_t      *RecordsExtracted; /**< \internal */
2435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_NdefReg_CbParam_t  *CbParam;         /**< \internal */
2455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /*  Harsha: Fix for 0000252: [JF] Buffer overshoot in phFriNfc_NdefRecord_GetRecords */
2475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     *IsChunked;       /**< \internal Array of chunked flags */
2485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /*  Harsha: Fix for 0000252: [JF] Buffer overshoot
2505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        in phFriNfc_NdefRecord_GetRecords   */
2515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint32_t                    NumberOfRecords;  /**< \internal Space available in NdefTypes
2525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                                and IsChunked arrays */
2535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /*  Harsha: Fix for 0000243: [JF] phFriNfc_NdefReg_Process
2555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        won't parse correctly chunked records   */
2565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /*  Used to remember the last valid TNF */
2575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     validPreviousTnf; /**< \internal The last valid TNF that we had. */
2585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint32_t                    NumberOfNdefTypes;/**< \internal */
2605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint32_t                    RecordIndex;      /**< \internal */
2625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint32_t                    RtdIndex;         /**< \internal */
2645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /*  This flag is used to remember whether we have found a
2665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        TNF which matches with the Registered RTD */
2675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     MainTnfFound;     /**< \internal */
2685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /*  This flag is used to tell whether the present record
2705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        being processed is newly extracted */
2715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                     newRecordextracted;/**< \internal */
2725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}phFriNfc_NdefReg_t;
2745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifndef PH_FRINFC_EXCLUDE_FROM_TESTFW /* */
2775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
2795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Ndef Registry \b Reset function
2805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc page_reg
2825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Resets the component instance to the initial state and lets the component forget about
2845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * the list of registered items. Does basic initialisation.
2855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefReg Pointer to a valid or uninitialised instance of \ref phFriNfc_NdefReg_t .
2875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefTypesarray Array of pointers to individual NDEF Types. Later used to store
2895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            the NdefTypes
2905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] RecordsExtracted Pointer to an uninitialised instance of the NDEF Record structure
2925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            that is later used to retrieve the record information.
2935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] CbParam Pointer to an un-initialised instance of \ref phFriNfc_NdefReg_CbParam_t
2955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            structure, which is later used to store the callback parameters.
2965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] ChunkedRecordsarray Pointer to an array of bytes. Later used to store the
2985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            Chunked record flags.
2995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NumberOfRecords The number of members in the arrays NdefTypesarray and ChunkedRecordsarray.
3015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                The operation has been successful.
3035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the function is invalid.
3045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note  This function has to be called at the beginning, after creating an instance of
3065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        \ref phFriNfc_NdefReg_t .
3075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_NdefReg_Reset(phFriNfc_NdefReg_t          *NdefReg,
3095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                 uint8_t                    **NdefTypesarray,
3105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                 phFriNfc_NdefRecord_t       *RecordsExtracted,
3115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                 phFriNfc_NdefReg_CbParam_t  *CbParam,
3125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                 uint8_t                     *ChunkedRecordsarray,
3135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                 uint32_t                     NumberOfRecords);
3145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
3175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Ndef Registry \b Add \b Callback function
3185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc page_reg
3205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Adds an NDEF type listener to the (internal) list of listeners:
3225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The registering caller or embedding SW must create an instance of \ref phFriNfc_NdefReg_Cb_t and
3235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * hand the reference over to this function. The library does no allocation of memory.
3245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefReg Pointer to an initialised instance of \ref phFriNfc_NdefReg_t that holds the
3265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            context of the current component instance.
3275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefCb Pointer to a caller-initialised structure describing the context of a Listener
3295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            that requests its registration.
3305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                                        The operation has been successful.
3325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER                              At least one parameter of the function
3335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                                  is invalid. or Number of RTDs in NdefCb
3345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                                  Structure is greater than
3355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                                  PH_FRINFC_NDEFREG_MAX_RTD_REGISTERED
3365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note This function returns once the listener is registered successfully or an error occurs.
3385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_NdefReg_AddCb(phFriNfc_NdefReg_t     *NdefReg,
3405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                 phFriNfc_NdefReg_Cb_t  *NdefCb);
3415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
3445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief NDEF Registry \b Remove \b Callback function
3455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc page_reg
3475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Removes a specific listener from the list: The element to remove is specified by its address.
3495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * As the library does no de-allocation the caller of this function  needs to take care of the
3505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * correct disposal of the removed \ref phFriNfc_NdefReg_Cb_t instance once this function returns
3515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * successfully.
3525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefReg Pointer to an initialised instance of \ref phFriNfc_NdefReg_t that holds the
3545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            context of this component.
3555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefCb Pointer to a caller-initialised structure describing the context of a Listener
3575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            that requests its un-registration.
3585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                The operation has been successful.
3605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the function is invalid.
3615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_NODE_NOT_FOUND         If the internal list is NULL or a list node is not found.
3625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note This function returns once the listener is removed successfully or an error occurs.
3645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_NdefReg_RmCb(phFriNfc_NdefReg_t    *NdefReg,
3665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                phFriNfc_NdefReg_Cb_t *NdefCb);
3675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
3715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief NDEF Registry \b Dispatch \b Packet function
3725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc page_reg
3745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The entry point for NDEF \b PACKETS retrieved from the Peer (Remote) Device:
3765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function performs a reset of the state. It starts the action (state machine). For actual
3775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * processing a periodic call of \ref phFriNfc_NdefReg_Process has to be done. This
3785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * function parses the Message, isolates the record, looks for a match with the registered
3795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * RTDs and if a match is found, it calls the related callback. This procedure is done for each
3805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * record in the Message
3815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefReg Pointer to an initialised instance of \ref phFriNfc_NdefReg_t that holds the
3835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            context of this component.
3845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] PacketData Pointer to a NDEF Packet that has been received.
3865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] PacketDataLength Length of the NDEF packet to process.
3885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                The operation has been successfully initiated.
3905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the function is invalid.
3915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note This function returns once the operation is initiated or an error occurs.
3935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_NdefReg_DispatchPacket(phFriNfc_NdefReg_t    *NdefReg,
3965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                          uint8_t               *PacketData,
3975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                          uint16_t               PacketDataLength);
3985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
4015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief NDEF Registry \b Dispatch \b Record function
4025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc page_reg
4045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The entry point for NDEF \b RECORDS retrieved from the Peer (Remote) Device:
4065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function performs a reset of the state. It starts the action (state machine). For actual
4075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * processing a periodic call of \ref phFriNfc_NdefReg_Process has to be done. This
4085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * function compares the given record with the registered RTDs and if a match is found it calls
4095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * the related callback.
4105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefReg Pointer to an initialised instance of \ref phFriNfc_NdefReg_t that holds the
4125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            context of this component.
4135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] RecordsExtracted Pointer to a NDEF Record that has been received.
4155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                The operation has been successfully initiated.
4175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the function is invalid.
4185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note This function returns once the process is initiated or an error occurs.
4205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
4215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_NdefReg_DispatchRecord(phFriNfc_NdefReg_t     *NdefReg,
4225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                          phFriNfc_NdefRecord_t  *RecordsExtracted);
4235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
4265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief NDEF Registry \b Process function
4275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc page_reg
4295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Processing function, needed to avoid long blocking and to give control to other parts of the software
4315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * between the internal dispatching of data.
4325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function needs to be called during processing, within a message loop or a simple loop until its
4335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * return value tells that it has finished. No State reset is performed during operation.
4345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param NdefReg Pointer to a valid instance of the \ref phFriNfc_NdefReg_t structure describing
4365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                the component context.
4375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param Status  Pointer to a variable receiving the final result of the NDEF data processing operation.
4395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                There are the following values:
4405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                \li NFCSTATUS_SUCCESS                   The operation has been successful.
4415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                \li NFCSTATUS_INVALID_PARAMETER         At least one parameter of the function is invalid.
4425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                \li NFCSTATUS_NODE_NOT_FOUND            If the List is NULL or Node is not found.
4435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                \li NFCSTATUS_INVALID_DEVICE_REQUEST    State other than the specified in the File.
4445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval        FALSE Processing has finished, no more function call is needed.
4465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval        TRUE  Processing is ongoing, the function must be called again.
4475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
4485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyuint8_t phFriNfc_NdefReg_Process(phFriNfc_NdefReg_t  *NdefReg,
4495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                 NFCSTATUS           *Status);
4505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/ /* defgroup */
4525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* PH_FRINFC_EXCLUDE_FROM_TESTFW */
4545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* PHFRINFCNDEFREG_H */
4565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
457