BT Mesh Configurator Component#

Robust execution of configuration jobs over BT Mesh Stack.

BT Mesh configuration jobs can be created from one or more configuration tasks. In order to create configuration jobs and tasks the following header files shall be checked:

The created jobs can be submitted for execution to BT Mesh Configurator by calling the btmesh_conf_submit_job.

If the application provides a callback (btmesh_conf_on_job_notification_t) when it creates the configuration job then the application is notified about changed job status.
The btmesh_conf_job_t::result can be checked in the notification callback to figure out if the configuration job was successful or not. The allocation and deallocation and ownership of configuration jobs are described in btmesh_conf_submit_job.

There are some common configuration use cases when the execution of job with a single configuration task is necessary. Some utility functions are provided in order to simplify the submission of these common configuration jobs:

These utility functions create configuration jobs and tasks and submit them with btmesh_conf_submit_job function the same way as the application would do. The finished configuration job which is created by utility function is deallocated automatically.

Modules#

BT Mesh Configuration Distributor

BT Mesh Configuration Executor

BT Mesh Configuration Job

BT Mesh Configuration Task

BT Mesh Configuration Types

Enumerations#

enum
BTMESH_CONF_SIG_MODEL_ATTRIBUTES_NONE = 0
BTMESH_CONF_SIG_MODEL_SUPPORTS_SUBSCRIPTION = (1 << 0)
BTMESH_CONF_SIG_MODEL_SUPPORTS_PUBLICATION = (1 << 1)
BTMESH_CONF_SIG_MODEL_SUPPORTS_APPKEY_BINDING = (1 << 2)
}

Information about the supported configuration operations on a model.

Functions#

sl_status_t
sl_status_t
sl_status_t
btmesh_conf_submit_job(btmesh_conf_job_t *job)
sl_status_t
btmesh_conf_dcd_get(uint16_t netkey_index, uint16_t server_address, uint8_t page, btmesh_conf_on_job_notification_t on_job_notification)
sl_status_t
btmesh_conf_reset_node(uint16_t netkey_index, uint16_t server_address, btmesh_conf_on_job_notification_t on_job_notification)
void
btmesh_conf_on_event(const sl_btmesh_msg_t *evt)
void
btmesh_conf_on_job_notification(btmesh_conf_job_t *const job)
sl_status_t
btmesh_conf_get_handle_from_event(const sl_btmesh_msg_t *evt, uint32_t *handle)
sl_status_t
btmesh_conf_get_sig_model_attributes(uint16_t model_id, btmesh_conf_sig_model_attr_bitmask_t *attributes)
const char *
bool
bool

Enumeration Documentation#

btmesh_conf_sig_model_attr_bitmask_t#

btmesh_conf_sig_model_attr_bitmask_t

Information about the supported configuration operations on a model.

Enumerator
BTMESH_CONF_SIG_MODEL_ATTRIBUTES_NONE

No attribute flags.

BTMESH_CONF_SIG_MODEL_SUPPORTS_SUBSCRIPTION

Subscription supported.

BTMESH_CONF_SIG_MODEL_SUPPORTS_PUBLICATION

Publication supported.

BTMESH_CONF_SIG_MODEL_SUPPORTS_APPKEY_BINDING

Application key binding supported.


Function Documentation#

btmesh_conf_init#

sl_status_t btmesh_conf_init (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Initialize the BT Mesh Configurator component

Returns

  • Status of the initialization.

Return values

  • SL_STATUS_OK: If the initialization is successful.

  • SL_STATUS_ALLOCATION_FAILED: If the dynamic memory allocation of internal data structures is failed.

  • SL_STATUS_INVALID_CONFIGURATION: If the configured model information is not valid. (array elems are not arranged in ascending order by model ID)

The initialization is performed automatically when the BT Mesh Stack triggers the sl_btmesh_evt_prov_initialized_id event. The application code shall call this function if it deinitialized the configurator component beforehand (btmesh_conf_deinit).


btmesh_conf_deinit#

sl_status_t btmesh_conf_deinit (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Deinitialize the BT Mesh Configurator component

Returns

  • Status of the deinitialization.

Return values

  • SL_STATUS_OK: If the deinitialization is successful.

  • SL_STATUS_INVALID_STATE: If the deinitialization can't be started because it is initiated from

Deallocates the internal data structures and stops the processing of BT Mesh stack events. Deinitialization shall not be called from btmesh_conf_job_t::on_job_notification callback.


btmesh_conf_submit_job#

sl_status_t btmesh_conf_submit_job (btmesh_conf_job_t * job)
Parameters
TypeDirectionArgument NameDescription
btmesh_conf_job_t *[in]job

Configuration job which aggregates the configuration tasks

Submit a configuration job for execution

Returns

  • Status of the job submission.

Return values

  • SL_STATUS_OK: If the job is submitted successfully.

  • SL_STATUS_INVALID_STATE: If the BT Mesh configurator is not initialized.

Each configuration job aggregates configuration tasks which targets the same remote node (configuration server model).

If a configuration job is submitted to the BT Mesh Configurator then it is added to the end of a wait queue. Therefore it is not guaranteed that the execution a job is started immediately. Configuration jobs with the same server addresses are executed in the order of submission however jobs with different server addresses might be executed in parallel.

If the submit operation is successful then the BT Mesh Configurator takes over the ownership of the job and consequently the application is no longer allowed to modify the submitted job or its tasks. If the submit operation fails and btmesh_conf_job_t::auto_destroy is set and SL_BTMESH_CONF_JOB_AUTO_DESTROY_ON_SUBMIT_FAILURE_CFG_VAL is turned on then the job is deallocated automatically in the submit call and consequently the job shall not be referenced when the submit returns with failure.

If task execution path ends in the configuration job then the job ends as well and btmesh_conf_job_t::on_job_notification callback is called with the result. The btmesh_conf_job_t::result structure member contains the result of the job. If the btmesh_conf_job_t::auto_destroy is set to true then the job and its tasks are deallocated automatically after the callback returns.

Warnings

  • If the auto destroy feature is used then the job shall not be referenced after the callback is executed.

Note

  • Te BT Mesh Stack does not allow the parallel execution of two configuration requests with the same server address (primary element). The limitation is added to the BT Mesh Stack because the configuration messages don't contain any transaction identifier in accordance with BT Mesh Profile specification so the status messages could not be differentiated.


btmesh_conf_dcd_get#

sl_status_t btmesh_conf_dcd_get (uint16_t netkey_index, uint16_t server_address, uint8_t page, btmesh_conf_on_job_notification_t on_job_notification)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]netkey_index

Network key used to encrypt request on network layer

uint16_t[in]server_address

Destination node primary element address

uint8_t[in]page

Composition data page to query

btmesh_conf_on_job_notification_t[in]on_job_notification

Callback to notify the app about job status

Submit a configuration job with a DCD get task

Returns

  • Status of the DCD get request.

Return values

  • SL_STATUS_OK: If the job is submitted successfully.

  • SL_STATUS_INVALID_STATE: If the BT Mesh configurator is not initialized.

  • SL_STATUS_ALLOCATION_FAILED: If allocation of job or task is failed.

Configuration job with DCD get task is created automatically and submitted for execution. The allocation and deallocation of task and job is handled automatically in this function.

Note


btmesh_conf_reset_node#

sl_status_t btmesh_conf_reset_node (uint16_t netkey_index, uint16_t server_address, btmesh_conf_on_job_notification_t on_job_notification)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]netkey_index

Network key used to encrypt request on network layer

uint16_t[in]server_address

Destination node primary element address

btmesh_conf_on_job_notification_t[in]on_job_notification

Callback to notify the app about job status

Submit a configuration job with a reset node task

Returns

  • Status of the reset node request.

Return values

  • SL_STATUS_OK: If the job is submitted successfully.

  • SL_STATUS_INVALID_STATE: If the BT Mesh configurator is not initialized.

  • SL_STATUS_ALLOCATION_FAILED: If allocation of job or task is failed.

Configuration job with reset node task is created automatically and submitted for execution. The allocation and deallocation of task and job is handled automatically in this function.

Note


btmesh_conf_on_event#

void btmesh_conf_on_event (const sl_btmesh_msg_t * evt)
Parameters
TypeDirectionArgument NameDescription
const sl_btmesh_msg_t *[in]evt

BT Mesh Stack event

BT Mesh Configurator event handler

The BT Mesh Configurator event handler shall be called with event provided sl_btmesh_pop_event or sl_btmesh_wait_event BT Mesh Stack API functions.


btmesh_conf_step#

void btmesh_conf_step (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Process one step of BT Mesh Configurator

The step API shall be called periodically from the main loop of the application.


btmesh_conf_on_job_notification#

void btmesh_conf_on_job_notification (btmesh_conf_job_t *const job)
Parameters
TypeDirectionArgument NameDescription
btmesh_conf_job_t *const[in]job

Reference of the job with changed status

Job status notification callback for lower layers

This callback is called when the status of the job changes because its execution is ended. The result of the job is provided in the btmesh_conf_job_t::result structure member. This callback calls btmesh_conf_job_t::on_job_notification with the job to notify the application. If btmesh_conf_job_t::on_job_notification is NULL then the application is not notified.


btmesh_conf_get_handle_from_event#

sl_status_t btmesh_conf_get_handle_from_event (const sl_btmesh_msg_t * evt, uint32_t * handle)
Parameters
TypeDirectionArgument NameDescription
const sl_btmesh_msg_t *[in]evt

BT Mesh Stack event

uint32_t *[out]handle

Handle from configuration client event is stored here

Provides the handle value from Configuration Client events of BT Mesh Stack

Returns

  • Status of the handle retrieval from event.

Return values

  • SL_STATUS_OK: If config client handle is retrieved successfully.

  • SL_STATUS_NOT_FOUND: If the given event is not a config client event.

  • SL_STATUS_NULL_POINTER: If any of its parameter is a NULL pointer.


btmesh_conf_get_sig_model_attributes#

sl_status_t btmesh_conf_get_sig_model_attributes (uint16_t model_id, btmesh_conf_sig_model_attr_bitmask_t * attributes)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]model_id

Model ID for the BT Mesh SIG model

btmesh_conf_sig_model_attr_bitmask_t *[out]attributes

Attributes of the model is stored here

Provide the model attributes of the given BT Mesh SIG model ID

Returns

  • Status of the get model attributes.

Return values

  • SL_STATUS_OK: If model attributes are provided successfully.

  • SL_STATUS_NOT_FOUND: If the model ID is unknown.

  • SL_STATUS_NULL_POINTER: If NULL pointer is given as attributes.


btmesh_conf_sig_model_id_to_string#

const char * btmesh_conf_sig_model_id_to_string (uint16_t model_id)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]model_id

Model ID for the BT Mesh SIG model

Return string representation of the given BT Mesh SIG model ID

Returns

  • String representation of BT Mesh SIG model ID (model name)

Return values

  • UnknownSigModel: If the model ID is unknown.

Note

  • This function always returns a valid string which makes it easier to use this function with snprintf like functions because those expects valid (non-NULL) for s format specifier.


btmesh_conf_is_configuration_event#

bool btmesh_conf_is_configuration_event (uint32_t event_id)
Parameters
TypeDirectionArgument NameDescription
uint32_t[in]event_id

Identifier of the given BT Mesh Stack event

Check if a given BT Mesh Stack event is a configuration client event


btmesh_conf_any_severe_log_level#

bool btmesh_conf_any_severe_log_level (uint8_t start_level)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]start_level

Least severe log level checked

Check if a given log level or other more severe log levels are enabled