hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
Macros | Functions
ifx-record-handler.h File Reference

NDEF record encoding/decoding utility. More...

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

Go to the source code of this file.

Macros

#define IFX_RECORD_HANDLER_ENCODE   UINT8_C(0x01)
 Identifier for NDEF record encode ID.
 
#define IFX_RECORD_HANDLER_DECODE   UINT8_C(0x02)
 Identifier for NDEF record decode ID.
 
#define IFX_NDEF_HEADER_FIELD_LEN   UINT32_C(0x01)
 Length of header field in bytes.
 
#define IFX_NDEF_TYPE_FIELD_LEN   UINT32_C(0x01)
 Length of type length field in bytes.
 
#define IFX_NDEF_ID_FIELD_LEN   UINT32_C(0x01)
 Length of id length field in bytes.
 
#define IFX_NDEF_SR_PAYLOAD_LEN_FIELD_LEN   UINT32_C(0x01)
 Length of short record payload length field in bytes.
 
#define IFX_NDEF_PAYLOAD_LEN_FIELD_LEN   UINT32_C(0x04)
 Length of payload length field in bytes.
 
#define IFX_NDEF_SR_PAYLOAD_LEN_FIELD_MAX_LEN   UINT32_C(0xFF)
 Maximum payload length value of short record.
 
#define IFX_NDEF_ID_LEN_FIELD_NONE   UINT32_C(0x00)
 Invalid id length.
 
#define IFX_NDEF_EMPTY_MESSAGE_LEN   UINT32_C(0x03)
 Length of empty ndef message.
 

Functions

ifx_status_t record_handler_encode (const ifx_record_handle_t *handle, ifx_blob_t *record_bytes)
 Encodes the record bytes for the specific record type handle given as input.
 
ifx_status_t record_handler_decode (ifx_blob_t *record_bytes, ifx_record_handle_t *handle)
 Decodes the record handles information from the given record bytes as input.
 

Detailed Description

NDEF record encoding/decoding utility.

Definition in file ifx-record-handler.h.

Macro Definition Documentation

◆ IFX_NDEF_EMPTY_MESSAGE_LEN

#define IFX_NDEF_EMPTY_MESSAGE_LEN   UINT32_C(0x03)

Length of empty ndef message.

Definition at line 72 of file ifx-record-handler.h.

◆ IFX_NDEF_HEADER_FIELD_LEN

#define IFX_NDEF_HEADER_FIELD_LEN   UINT32_C(0x01)

Length of header field in bytes.

Definition at line 37 of file ifx-record-handler.h.

◆ IFX_NDEF_ID_FIELD_LEN

#define IFX_NDEF_ID_FIELD_LEN   UINT32_C(0x01)

Length of id length field in bytes.

Definition at line 47 of file ifx-record-handler.h.

◆ IFX_NDEF_ID_LEN_FIELD_NONE

#define IFX_NDEF_ID_LEN_FIELD_NONE   UINT32_C(0x00)

Invalid id length.

Definition at line 67 of file ifx-record-handler.h.

◆ IFX_NDEF_PAYLOAD_LEN_FIELD_LEN

#define IFX_NDEF_PAYLOAD_LEN_FIELD_LEN   UINT32_C(0x04)

Length of payload length field in bytes.

Definition at line 57 of file ifx-record-handler.h.

◆ IFX_NDEF_SR_PAYLOAD_LEN_FIELD_LEN

#define IFX_NDEF_SR_PAYLOAD_LEN_FIELD_LEN   UINT32_C(0x01)

Length of short record payload length field in bytes.

Definition at line 52 of file ifx-record-handler.h.

◆ IFX_NDEF_SR_PAYLOAD_LEN_FIELD_MAX_LEN

#define IFX_NDEF_SR_PAYLOAD_LEN_FIELD_MAX_LEN   UINT32_C(0xFF)

Maximum payload length value of short record.

Definition at line 62 of file ifx-record-handler.h.

◆ IFX_NDEF_TYPE_FIELD_LEN

#define IFX_NDEF_TYPE_FIELD_LEN   UINT32_C(0x01)

Length of type length field in bytes.

Definition at line 42 of file ifx-record-handler.h.

◆ IFX_RECORD_HANDLER_DECODE

#define IFX_RECORD_HANDLER_DECODE   UINT8_C(0x02)

Identifier for NDEF record decode ID.

Definition at line 32 of file ifx-record-handler.h.

◆ IFX_RECORD_HANDLER_ENCODE

#define IFX_RECORD_HANDLER_ENCODE   UINT8_C(0x01)

Identifier for NDEF record encode ID.

Definition at line 27 of file ifx-record-handler.h.

Function Documentation

◆ record_handler_decode()

ifx_status_t record_handler_decode ( ifx_blob_t * record_bytes,
ifx_record_handle_t * handle )

Decodes the record handles information from the given record bytes as input.

Parameters
[in]record_bytesPointer to the record bytes whose details to be decoded to the record handle.
[out]handlePointer to the record handle where record details are updated.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf decoding is successful
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function

◆ record_handler_encode()

ifx_status_t record_handler_encode ( const ifx_record_handle_t * handle,
ifx_blob_t * record_bytes )

Encodes the record bytes for the specific record type handle given as input.

Parameters
[in]handlePointer to the handle of specific record type.
[out]record_bytesPointer to the encoded record bytes.
Returns
ifx_status_t
Return values
IFX_SUCCESSIf encoding is successful
IFX_ILLEGAL_ARGUMENTIf invalid/NULL parameter is passed to function