Near Field Communnication (NFC) driver API.
More...
Near Field Communnication (NFC) driver API.
◆ drv_nfc_app_launch_android_record_add()
ret_code_t drv_nfc_app_launch_android_record_add |
( |
char const *const |
p_android_package_name, |
|
|
uint32_t |
package_name_length |
|
) |
| |
Function for adding an Android Application Record (AAR) to an NDEF NFC message.
- Parameters
-
[in] | p_android_package_name | Android package (app) name. |
[in] | package_name_length | Length of Android package name. |
- Return values
-
NRF_SUCCESS | If the record was added successfully. |
NRF_ERROR_NULL | The string is NULL. |
NRF_ERROR_INVALID_STATE | Driver has not been initialized. |
NRF_ERROR_INVALID_LENGTH | The length is 1 or 0. |
Other | errors from the underlying drivers. |
◆ drv_nfc_disable()
ret_code_t drv_nfc_disable |
( |
void |
| ) |
|
Function for disabling NFC.
- Note
- This function deletes all stored NDEF records.
- Return values
-
NRF_SUCCESS | If NFC was disabled successfully. |
NRF_ERROR_INVALID_STATE | Driver has not been initialized or no records have been added. |
Other | errors from the underlying drivers. |
◆ drv_nfc_enable()
ret_code_t drv_nfc_enable |
( |
void |
| ) |
|
Function for enabling NFC.
- Note
- Add the desired records before calling this function.
- Return values
-
NRF_SUCCESS | If NFC was enabled successfully. |
Other | errors from the underlying drivers. |
◆ drv_nfc_init()
ret_code_t drv_nfc_init |
( |
void |
| ) |
|
Function for initializing NFC.
- Note
- Run init first, add the desired NDEF records, and finally enable NFC.
- Return values
-
NRF_SUCCESS | If NFC was initialized successfully. |
Other | errors from the underlying drivers. |
◆ drv_nfc_raw_data_get()
ret_code_t drv_nfc_raw_data_get |
( |
uint8_t * |
p_data, |
|
|
uint8_t * |
p_data_len |
|
) |
| |
Function for reading the data stored on the NFC tag.
- Parameters
-
[in] | p_data | Pointer to the data buffer which will store the NFC tag data. |
[out] | p_data_len | Pointer to a length variable which will store the data buffer length. |
- Return values
-
NRF_SUCCESS | If the raw data was added successfully. |
NRF_ERROR_NO_MEM | If the input buffer is not large enough for the NFC tag data. |
NRF_ERROR_NULL | If a null pointer is given as an input parameter. |
◆ drv_nfc_raw_data_set()
ret_code_t drv_nfc_raw_data_set |
( |
uint8_t const *const |
p_data, |
|
|
uint8_t |
data_len |
|
) |
| |
Function for writing raw data to the NFC tag.
- Parameters
-
[in] | p_data | Pointer to the raw data. |
[in] | data_len | Length of the raw data. |
- Return values
-
NRF_SUCCESS | If the raw data was added successfully. |
NRF_ERROR_INVALID_LENGTH | If the length of the input data is too large for the NFC data buffer. |
NRF_ERROR_NULL | If a null pointer is given as an input parameter. |
Other | errors from the underlying drivers. |
◆ drv_nfc_string_record_add()
ret_code_t drv_nfc_string_record_add |
( |
char const *const |
p_string, |
|
|
uint8_t |
str_len |
|
) |
| |
Function for adding a string record to an NDEF NFC message.
- Parameters
-
[in] | p_string | Pointer to the string. |
[in] | str_len | Length of the string including NUL ('\0') termination. |
- Return values
-
NRF_SUCCESS | If the record was added successfully. |
NRF_ERROR_NULL | The string is NULL. |
NRF_ERROR_INVALID_STATE | Driver has not been initialized. |
NRF_ERROR_INVALID_LENGTH | The length is 1 or 0. |
Other | errors from the underlying drivers. |
◆ drv_nfc_uri_record_add()
ret_code_t drv_nfc_uri_record_add |
( |
nfc_uri_id_t |
uri_id, |
|
|
char const *const |
p_uri, |
|
|
uint32_t |
uri_length |
|
) |
| |
Function for adding a URI record to an NDEF NFC message.
- Parameters
-
[in] | uri_id | URI identifier codes according to "URI Record Type Definition". |
[in] | p_uri | Pointer to the string. |
[in] | uri_length | Length of the string including NUL ('\0') termination. |
- Return values
-
NRF_SUCCESS | If the record was added successfully. |
NRF_ERROR_NULL | The string is NULL. |
NRF_ERROR_INVALID_STATE | Driver has not been initialized. |
NRF_ERROR_INVALID_LENGTH | The length is 1 or 0. |
Other | errors from the underlying drivers. |