App Utility#
The App BT Mesh Utility provides collection of stateless utility functions and macros to solve recurring tasks in the BT Mesh components and examples. This component supports logging of missing application key binding and missing model publication data configuration errors. The logging level of these errors are configurable. This component is suitable for use in both NCP and SOC applications.
Functions#
Macros#
Logs the btmesh API failures.
Maximum size of UUID64 string representation with separators (including null char)
Function Documentation#
app_btmesh_nvm_init#
sl_status_t app_btmesh_nvm_init (void )
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Initializes the NVM interface.
Calls the default initializer of NVM3.
Returns
Status code
Return values
SL_STATUS_OK: In case of success
SL_STATUS_ALREADY_INITIALIZED: In case it was initialized earlier with parameters different from default
app_btmesh_nvm_read#
sl_status_t app_btmesh_nvm_read (uint16_t key, void * buf, size_t * len)
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | key | Identifier of the data. |
void * | [out] | buf | Buffer to the data to read. |
size_t * | [inout] | len | Pointer to the length of the read data. As in input it takes the length of buffer. As an output it contains the length of the read data. |
Reads data from NVM.
Returns
Status code
Return values
SL_STATUS_OK: In case of success
SL_STATUS_INVALID_STATE: In case NVM has not been initialized
SL_STATUS_INVALID_KEY: In case key is invalid
SL_STATUS_NOT_FOUND: In case key has not been found
SL_STATUS_INVALID_PARAMETER: In case any of the input parameters is invalid
app_btmesh_nvm_write#
sl_status_t app_btmesh_nvm_write (uint16_t key, const void * buf, size_t len)
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | key | Identifier of the data. |
const void * | [in] | buf | Buffer to the data to write. |
size_t | [in] | len | Length of the data in the buffer. |
Writes data into the NVM.
Returns
Status code
Return values
SL_STATUS_OK: In case of success
SL_STATUS_INVALID_STATE: In case NVM has not been initialized
SL_STATUS_FULL: In case NVM is full
SL_STATUS_NO_MORE_RESOURCE: In case NVM doesn't have the resources to store the data
SL_STATUS_FLASH_PROGRAM_FAILED: In case writing to NVM has failed
SL_STATUS_INVALID_PARAMETER: In case any of the input parameters is invalid
app_btmesh_nvm_erase#
sl_status_t app_btmesh_nvm_erase (uint16_t key)
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | key | Identifier of the data. |
Erases data from NVM.
Returns
Status code
Return values
SL_STATUS_OK: In case of success
SL_STATUS_INVALID_STATE: In case NVM has not been initialized
SL_STATUS_INVALID_KEY: In case key is invalid
SL_STATUS_NOT_FOUND: In case key has not been found
SL_STATUS_FLASH_PROGRAM_FAILED: In case writing to NVM has failed
SL_STATUS_INVALID_PARAMETER: In case any of the input parameters is invalid
app_btmesh_nvm_erase_all#
sl_status_t app_btmesh_nvm_erase_all (void )
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Erases all NVM data.
Returns
Status code
Return values
SL_STATUS_OK: In case of success
SL_STATUS_INVALID_STATE: In case NVM has not been initialized
SL_STATUS_INVALID_PARAMETER: In case any of the input parameters is invalid
app_btmesh_uuid_64_to_string#
const char * app_btmesh_uuid_64_to_string (char * buffer, uint32_t buffer_size, const sl_bt_uuid_64_t * uuid_64, char separator, bool uppercase)
Type | Direction | Argument Name | Description |
---|---|---|---|
char * | [out] | buffer | Output buffer where the string representation is written |
uint32_t | [in] | buffer_size | Size of output buffer |
const sl_bt_uuid_64_t * | [in] | uuid_64 | Input UUID64 which shall be converted to string |
char | [in] | separator | Separator character to be used between two hex characters. If the separator is the null character then no separator is used. |
bool | [in] | uppercase | If true hex characters are upper case otherwise lower case |
Provides string representation of UUID64
It is guaranteed that this function returns a valid string even in case of invalid parameters.
Returns
Output buffer which contains the string representation of UUID64
Return values
INVALID: if an error occurs due to invalid parameters
app_btmesh_bytes_to_hex#
const char * app_btmesh_bytes_to_hex (char * buffer, uint32_t buffer_size, const uint8_t * bytes, uint32_t bytes_size, char separator, bool uppercase)
Type | Direction | Argument Name | Description |
---|---|---|---|
char * | [out] | buffer | Output buffer where the hex representation is written |
uint32_t | [in] | buffer_size | Size of output buffer |
const uint8_t * | [in] | bytes | Input byte array which shall be converted to hex |
uint32_t | [in] | bytes_size | Size of input byte array |
char | [in] | separator | Separator character to be used between two hex characters. If the separator is the null character then no separator is used. |
bool | [in] | uppercase | If true hex characters are upper case otherwise lower case |
Provides hex representation of byte array as a string
It is guaranteed that this function returns a valid string even in case of invalid parameters.
Returns
Output buffer which contains the hex representation of byte array
Return values
INVALID: if an error occurs due to invalid parameters