Nordic Thingy:52 v2.2.0
NFC driver

Near Field Communnication (NFC) driver API. More...

Functions

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. More...
 
ret_code_t drv_nfc_disable (void)
 Function for disabling NFC. More...
 
ret_code_t drv_nfc_enable (void)
 Function for enabling NFC. More...
 
ret_code_t drv_nfc_init (void)
 Function for initializing NFC. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

Near Field Communnication (NFC) driver API.

Function Documentation

◆ 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_nameAndroid package (app) name.
[in]package_name_lengthLength of Android package name.
Return values
NRF_SUCCESSIf the record was added successfully.
NRF_ERROR_NULLThe string is NULL.
NRF_ERROR_INVALID_STATEDriver has not been initialized.
NRF_ERROR_INVALID_LENGTHThe length is 1 or 0.
Othererrors 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_SUCCESSIf NFC was disabled successfully.
NRF_ERROR_INVALID_STATEDriver has not been initialized or no records have been added.
Othererrors 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_SUCCESSIf NFC was enabled successfully.
Othererrors 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_SUCCESSIf NFC was initialized successfully.
Othererrors 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_dataPointer to the data buffer which will store the NFC tag data.
[out]p_data_lenPointer to a length variable which will store the data buffer length.
Return values
NRF_SUCCESSIf the raw data was added successfully.
NRF_ERROR_NO_MEMIf the input buffer is not large enough for the NFC tag data.
NRF_ERROR_NULLIf 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_dataPointer to the raw data.
[in]data_lenLength of the raw data.
Return values
NRF_SUCCESSIf the raw data was added successfully.
NRF_ERROR_INVALID_LENGTHIf the length of the input data is too large for the NFC data buffer.
NRF_ERROR_NULLIf a null pointer is given as an input parameter.
Othererrors 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_stringPointer to the string.
[in]str_lenLength of the string including NUL ('\0') termination.
Return values
NRF_SUCCESSIf the record was added successfully.
NRF_ERROR_NULLThe string is NULL.
NRF_ERROR_INVALID_STATEDriver has not been initialized.
NRF_ERROR_INVALID_LENGTHThe length is 1 or 0.
Othererrors 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_idURI identifier codes according to "URI Record Type Definition".
[in]p_uriPointer to the string.
[in]uri_lengthLength of the string including NUL ('\0') termination.
Return values
NRF_SUCCESSIf the record was added successfully.
NRF_ERROR_NULLThe string is NULL.
NRF_ERROR_INVALID_STATEDriver has not been initialized.
NRF_ERROR_INVALID_LENGTHThe length is 1 or 0.
Othererrors from the underlying drivers.