hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
Data Structures | Macros | Typedefs | Enumerations | Functions
ifx-ndef-record.h File Reference

Model interface to create record types and set/get record fields. More...

#include <stddef.h>
#include <stdint.h>
#include "infineon/ifx-error.h"
#include "infineon/ifx-utils.h"

Go to the source code of this file.

Data Structures

struct  ifx_ndef_record_t
 Data storage for NDEF Records. More...
 
struct  ifx_record_handle_t
 Defines the handle for specific record type. More...
 
struct  ifx_record_init_t
 This Structure holds record's type information and function pointer which retrieves record handle based on type. More...
 

Macros

#define IFX_RECORD_SET   UINT8_C(0x01)
 Identifier for model set data ID.
 
#define IFX_RECORD_GET   UINT8_C(0x02)
 Identifier for model get data ID.
 
#define IFX_RECORD_REGISTER   UINT8_C(0x03)
 Identifier for model register record ID.
 
#define IFX_RECORD_RETRIEVE   UINT8_C(0x04)
 Identifier for model retrieve record ID.
 
#define IFX_RECORD_DEREGISTER   UINT8_C(0x05)
 Identifier for model deregister record ID.
 
#define IFX_RECORD_DATA_FIELD_NA   UINT8_C(0xF1)
 Error id for unavailable data field in record handle.
 
#define IFX_RECORD_HEADER_MASK_SR_FLAG   UINT8_C(0x10)
 Mask value to extract SR bit in header.
 
#define IFX_RECORD_HEADER_MASK_ID_FLAG   UINT8_C(0x08)
 Mask value to extract ID bit in header.
 
#define IFX_RECORD_TNF_MASK   UINT8_C(0x27)
 Mask value of TNF field in header.
 
#define IFX_RECORD_TNF_TYPE_KNOWN   UINT8_C(0x01)
 TNF of known NDEF records such as URI, Text, Smart poster.
 
#define IFX_RECORD_TNF_TYPE_MEDIA   UINT8_C(0x02)
 TNF of Media NDEF record types.
 
#define IFX_RECORD_TNF_TYPE_EXT   UINT8_C(0x04)
 TNF of External NDEF record types.
 

Typedefs

typedef ifx_status_t(* ifx_record_encoder_t) (const void *record_details, uint8_t **payload, uint32_t *payload_length)
 Function prototype declaration for specific record encode operation.
 
typedef ifx_status_t(* ifx_record_decoder_t) (const uint8_t *payload, uint32_t payload_length, void *record_details)
 Function prototype declaration for specific record decode operation.
 
typedef ifx_status_t(* ifx_record_deinit_t) (void *record_data)
 Function prototype declaration for specific record's data release memory operation.
 
typedef ifx_status_t(* ifx_record_init_handler_t) (ifx_record_handle_t *handle)
 Function prototype declarations that map to creation of new record handle APIs.
 

Enumerations

enum  ifx_ndef_record_type {
  IFX_RECORD_TYPE_URI , IFX_RECORD_TYPE_HANDOVER_SELECT , IFX_RECORD_TYPE_ALT_CARRIER , IFX_RECORD_TYPE_BT ,
  IFX_RECORD_TYPE_BLE , IFX_RECORD_TYPE_ERROR , IFX_RECORD_MAX
}
 Defines list of available record types. More...
 

Functions

ifx_status_t ifx_ndef_record_set_record_id (ifx_record_handle_t *handle, const ifx_blob_t *record_id)
 Sets the record ID to the handle of record.
 
ifx_status_t ifx_ndef_record_get_record_id (const ifx_record_handle_t *handle, ifx_blob_t *record_id)
 Gets the record ID from the handle of record.
 
ifx_status_t ifx_ndef_record_retrieve_handle (uint8_t tnf, const uint8_t *type, uint32_t type_length, ifx_record_handle_t *handle)
 Retrieves the record handle for the given type of record type information.
 
ifx_status_t ifx_ndef_record_register_handle (ifx_record_init_t *init_handler)
 Register a new record service to the record init handler list based on the type data.
 
ifx_status_t ifx_ndef_record_release_resource (void)
 This method will free-up the internally allocated memory for ndef registered records.
 
ifx_status_t ifx_ndef_record_dispose (ifx_record_handle_t *record_handle)
 This method will free-up the internally allocated memory of a record.
 
ifx_status_t ifx_ndef_record_dispose_list (ifx_record_handle_t *record_handles, uint32_t number_of_records)
 This method will free-up the internally allocated memory for the list of records.
 

Detailed Description

Model interface to create record types and set/get record fields.

Definition in file ifx-ndef-record.h.

Macro Definition Documentation

◆ IFX_RECORD_DATA_FIELD_NA

#define IFX_RECORD_DATA_FIELD_NA   UINT8_C(0xF1)

Error id for unavailable data field in record handle.

Definition at line 51 of file ifx-ndef-record.h.

◆ IFX_RECORD_DEREGISTER

#define IFX_RECORD_DEREGISTER   UINT8_C(0x05)

Identifier for model deregister record ID.

Definition at line 46 of file ifx-ndef-record.h.

◆ IFX_RECORD_GET

#define IFX_RECORD_GET   UINT8_C(0x02)

Identifier for model get data ID.

Definition at line 31 of file ifx-ndef-record.h.

◆ IFX_RECORD_HEADER_MASK_ID_FLAG

#define IFX_RECORD_HEADER_MASK_ID_FLAG   UINT8_C(0x08)

Mask value to extract ID bit in header.

Definition at line 61 of file ifx-ndef-record.h.

◆ IFX_RECORD_HEADER_MASK_SR_FLAG

#define IFX_RECORD_HEADER_MASK_SR_FLAG   UINT8_C(0x10)

Mask value to extract SR bit in header.

Definition at line 56 of file ifx-ndef-record.h.

◆ IFX_RECORD_REGISTER

#define IFX_RECORD_REGISTER   UINT8_C(0x03)

Identifier for model register record ID.

Definition at line 36 of file ifx-ndef-record.h.

◆ IFX_RECORD_RETRIEVE

#define IFX_RECORD_RETRIEVE   UINT8_C(0x04)

Identifier for model retrieve record ID.

Definition at line 41 of file ifx-ndef-record.h.

◆ IFX_RECORD_SET

#define IFX_RECORD_SET   UINT8_C(0x01)

Identifier for model set data ID.

Definition at line 26 of file ifx-ndef-record.h.

◆ IFX_RECORD_TNF_MASK

#define IFX_RECORD_TNF_MASK   UINT8_C(0x27)

Mask value of TNF field in header.

Definition at line 66 of file ifx-ndef-record.h.

◆ IFX_RECORD_TNF_TYPE_EXT

#define IFX_RECORD_TNF_TYPE_EXT   UINT8_C(0x04)

TNF of External NDEF record types.

Definition at line 81 of file ifx-ndef-record.h.

◆ IFX_RECORD_TNF_TYPE_KNOWN

#define IFX_RECORD_TNF_TYPE_KNOWN   UINT8_C(0x01)

TNF of known NDEF records such as URI, Text, Smart poster.

Definition at line 71 of file ifx-ndef-record.h.

◆ IFX_RECORD_TNF_TYPE_MEDIA

#define IFX_RECORD_TNF_TYPE_MEDIA   UINT8_C(0x02)

TNF of Media NDEF record types.

Definition at line 76 of file ifx-ndef-record.h.

Typedef Documentation

◆ ifx_record_decoder_t

typedef ifx_status_t(* ifx_record_decoder_t) (const uint8_t *payload, uint32_t payload_length, void *record_details)

Function prototype declaration for specific record decode operation.

Parameters
[in]payloadpointer to payload to be decoded
[in]payload_lengthpointer to payload length
[out]record_detailspointer to details of respective record
Returns
ifx_status_t IFX_SUCCESS, if encode successful, error information in case of error.

Definition at line 137 of file ifx-ndef-record.h.

◆ ifx_record_deinit_t

typedef ifx_status_t(* ifx_record_deinit_t) (void *record_data)

Function prototype declaration for specific record's data release memory operation.

Parameters
[in]record_dataPointer to the record data field of the record handle.
Returns
ifx_status_t IFX_SUCCESS, if memory release successful, error information in case of error.

Definition at line 149 of file ifx-ndef-record.h.

◆ ifx_record_encoder_t

typedef ifx_status_t(* ifx_record_encoder_t) (const void *record_details, uint8_t **payload, uint32_t *payload_length)

Function prototype declaration for specific record encode operation.

Parameters
[in]record_detailspointer to details of respective record
[out]payloadpointer to encoded payload
[out]payload_lengthpointer to encoded payload length
Returns
ifx_status_t IFX_SUCCESS, if encode successful, error information in case of error.

Definition at line 125 of file ifx-ndef-record.h.

◆ ifx_record_init_handler_t

typedef ifx_status_t(* ifx_record_init_handler_t) (ifx_record_handle_t *handle)

Function prototype declarations that map to creation of new record handle APIs.

Definition at line 174 of file ifx-ndef-record.h.

Enumeration Type Documentation

◆ ifx_ndef_record_type

Defines list of available record types.

Enumerator
IFX_RECORD_TYPE_URI 

URI record

IFX_RECORD_TYPE_HANDOVER_SELECT 

Handover select record

IFX_RECORD_TYPE_ALT_CARRIER 

Alternative carrier record

IFX_RECORD_TYPE_BT 

Bluetooth record

IFX_RECORD_TYPE_BLE 

Bluetooth low energy record

IFX_RECORD_TYPE_ERROR 

Error record

IFX_RECORD_MAX 

Record Maximum

Definition at line 88 of file ifx-ndef-record.h.

89{
ifx_ndef_record_type
Defines list of available record types.
@ IFX_RECORD_TYPE_BT
@ IFX_RECORD_TYPE_URI
@ IFX_RECORD_MAX
@ IFX_RECORD_TYPE_ALT_CARRIER
@ IFX_RECORD_TYPE_BLE
@ IFX_RECORD_TYPE_ERROR
@ IFX_RECORD_TYPE_HANDOVER_SELECT

Function Documentation

◆ ifx_ndef_record_dispose()

ifx_status_t ifx_ndef_record_dispose ( ifx_record_handle_t * record_handle)

This method will free-up the internally allocated memory of a record.

Parameters
[in]record_handlePointer to the record handle.
Returns
ifx_status_t
Return values
IFX_SUCCESSif releasing memory resources is done successfully

◆ ifx_ndef_record_dispose_list()

ifx_status_t ifx_ndef_record_dispose_list ( ifx_record_handle_t * record_handles,
uint32_t number_of_records )

This method will free-up the internally allocated memory for the list of records.

Parameters
[in]record_handlesPointer to the array of NDEF record handles.
[in]number_of_recordsNumber of NDEF records
Returns
ifx_status_t
Return values
IFX_SUCCESSif releasing memory resources is done successfully

◆ ifx_ndef_record_get_record_id()

ifx_status_t ifx_ndef_record_get_record_id ( const ifx_record_handle_t * handle,
ifx_blob_t * record_id )

Gets the record ID from the handle of record.

Parameters
[in]handlePointer to the record handle.
[out]record_idPointer to the record ID.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf the record ID is read from the handle successfully
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function
IFX_OUT_OF_MEMORYIf memory allocation is invalid

◆ ifx_ndef_record_register_handle()

ifx_status_t ifx_ndef_record_register_handle ( ifx_record_init_t * init_handler)

Register a new record service to the record init handler list based on the type data.

Parameters
[in]init_handlerHandler that holds the type and handle retrieval APIs.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf init handler is registered properly to the record init handler list ER_INFO_ALREADY_REGISTERED_RECORD if already same record type is registered
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function
IFX_OUT_OF_MEMORYIf memory allocation is invalid
Note
Use this API for registering the record service whose type value is known and fixed.

◆ ifx_ndef_record_release_resource()

ifx_status_t ifx_ndef_record_release_resource ( void )

This method will free-up the internally allocated memory for ndef registered records.

Returns
ifx_status_t
Return values
IFX_SUCCESSif freeing up of memory is done successfully

◆ ifx_ndef_record_retrieve_handle()

ifx_status_t ifx_ndef_record_retrieve_handle ( uint8_t tnf,
const uint8_t * type,
uint32_t type_length,
ifx_record_handle_t * handle )

Retrieves the record handle for the given type of record type information.

Parameters
[in]tnfType name format (TNF) value of the record.
[in]typePointer to the record type data.
[in]type_lengthRecord type data length
[out]handleRecord handle that will be retrieved through the type information.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf handler is retrieved properly
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function
IFX_OUT_OF_MEMORYIf memory allocation is invalid

◆ ifx_ndef_record_set_record_id()

ifx_status_t ifx_ndef_record_set_record_id ( ifx_record_handle_t * handle,
const ifx_blob_t * record_id )

Sets the record ID to the handle of record.

Parameters
[out]handlePointer to the record handle.
[in]record_idPointer to the record ID.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf the record ID is set to the handle successfully
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function
IFX_OUT_OF_MEMORYIf memory allocation is invalid