Record API provides an NDEF record.
Required Header
#include <nfc.h>
Overview
The NDEF record api provides functions to make NDEF record
- create / destroy NDEF record
- set / get elements from NDEF record
Related Features
This API is related with the following features:
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions |
int | nfc_ndef_record_create (nfc_ndef_record_h *record, nfc_record_tnf_e tnf, const unsigned char *type, int type_size, const unsigned char *id, int id_size, const unsigned char *payload, unsigned int payload_size) |
| Creates a record with given parameter value.
|
int | nfc_ndef_record_create_text (nfc_ndef_record_h *record, const char *text, const char *lang_code, nfc_encode_type_e encode) |
| Creates a record with text type payload.
|
int | nfc_ndef_record_create_uri (nfc_ndef_record_h *record, const char *uri) |
| Creates a record with URI type payload.
|
int | nfc_ndef_record_create_mime (nfc_ndef_record_h *record, const char *mime_type, const unsigned char *data, unsigned int data_size) |
| Creates a record with MIME type payload.
|
int | nfc_ndef_record_destroy (nfc_ndef_record_h record) |
| Destroys the record handle.
|
int | nfc_ndef_record_set_id (nfc_ndef_record_h record, unsigned char *id, int id_size) |
| Sets record ID.
|
int | nfc_ndef_record_get_id (nfc_ndef_record_h record, unsigned char **id, int *size) |
| Gets record ID.
|
int | nfc_ndef_record_get_payload (nfc_ndef_record_h record, unsigned char **payload, unsigned int *size) |
| Gets record payload.
|
int | nfc_ndef_record_get_type (nfc_ndef_record_h record, unsigned char **type, int *size) |
| Gets record type.
|
int | nfc_ndef_record_get_tnf (nfc_ndef_record_h record, nfc_record_tnf_e *tnf) |
| Gets record TNF(Type Name Format) value.
|
int | nfc_ndef_record_get_text (nfc_ndef_record_h record, char **text) |
| Gets text from text record.
|
int | nfc_ndef_record_get_langcode (nfc_ndef_record_h record, char **lang_code) |
| Gets language code from text record.
|
int | nfc_ndef_record_get_encode_type (nfc_ndef_record_h record, nfc_encode_type_e *encode) |
| Gets encoding type from text record.
|
int | nfc_ndef_record_get_uri (nfc_ndef_record_h record, char **uri) |
| Gets URI from uri record.
|
int | nfc_ndef_record_get_mime_type (nfc_ndef_record_h record, char **mime_type) |
| Gets mime type from mime type record.
|
Typedefs |
typedef struct _ndef_record_s * | nfc_ndef_record_h |
| The handle to the NDEF record.
|
Typedef Documentation
The handle to the NDEF record.
- Since :
- 2.3
Enumeration Type Documentation
Enumerations for NFC encode types.
- Since :
- 2.3
- Enumerator:
NFC_ENCODE_UTF_8 |
UTF-8
|
NFC_ENCODE_UTF_16 |
UTF-16
|
Enumerations for record TNF (Type Name Format)
- Since :
- 2.3
It is indicate format of type field
- Enumerator:
NFC_RECORD_TNF_EMPTY |
Empty
|
NFC_RECORD_TNF_WELL_KNOWN |
RTD(Record Type Definition) type format [NFC RTD]
|
NFC_RECORD_TNF_MIME_MEDIA |
MIME Media types in RFC 2046 [RFC 2046]
|
NFC_RECORD_TNF_URI |
Absolute URI as defined in RFC 3986 [RFC 3986]
|
NFC_RECORD_TNF_EXTERNAL_RTD |
NFC Forum external type [NFC RTD]
|
NFC_RECORD_TNF_UNKNOWN |
Unknown
The payload type is unknown
|
NFC_RECORD_TNF_UNCHANGED |
It means the payload is an intermediate or final chunk of a chunked NDEF Record
|
Function Documentation
Gets record ID.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[out] | id | The record ID ( do not free ) |
[out] | size | The size of ID in bytes |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_ndef_record_set_id()
-
nfc_manager_initialize()
Gets language code from text record.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[out] | lang_code | lang code ( should be freed by caller ) |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_ndef_record_create_text()
-
nfc_manager_initialize()
Gets mime type from mime type record.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[out] | mime_type | The mime type in record payload ( should be freed by caller ) |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_ndef_record_create_mime()
-
nfc_manager_initialize()
Gets record payload.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[out] | payload | The payload ( do not free this pointer ) |
[out] | size | the size of payload in byte |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_manager_initialize()
Gets text from text record.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[out] | text | The text in record payload ( should be freed by caller ) |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_ndef_record_create_text()
-
nfc_manager_initialize()
Gets record TNF(Type Name Format) value.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[out] | tnf | The TNF(Type Name Format) value |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_manager_initialize()
Gets record type.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[out] | type | The record type ( do not free this pointer ) |
[out] | size | The size of type in byte |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_manager_initialize()
Gets URI from uri record.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[out] | uri | The uri in record payload ( should be freed by caller ) |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_ndef_record_create_uri()
-
nfc_manager_initialize()
Sets record ID.
- Since :
- 2.3
- Parameters:
-
[in] | record | The handle to record |
[in] | id | The record ID |
[in] | id_size | The size of ID in bytes |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- nfc_ndef_record_get_id()
-
nfc_manager_initialize()
Variable Documentation
RTD(Record type definition) Type - Alternative Carrier type.
- Since :
- 2.3
RTD(Record type definition) Type - Handover Carrier type.
- Since :
- 2.3
RTD(Record type definition) Type - Handover Request type.
- Since :
- 2.3
RTD(Record type definition) Type - Handover Select type.
- Since :
- 2.3
RTD(Record type definition) Type - Smart Poster type.
- Since :
- 2.3
RTD(Record type definition) Type - Text type.
- Since :
- 2.3
RTD(Record type definition) Type - URI type.
- Since :
- 2.3