Exported Functions

group Mesh_Common_Exported_Functions

Functions

void device_info_cb_reg(device_info_cb_pf cb)

Register the callback to indicate the information of neighbor mesh devices.

This function sets a callback function to handle device information received from neighboring mesh devices during advertisement or provisioning.

Parameters:

cb[in] Callback function pointer.

void mesh_init(void)

Initialize the mesh stack.

Sets up the mesh stack by configuring necessary parameters and preparing the system for mesh operations.

void mesh_start(uint8_t event_mesh, uint8_t event_app, void *event_queue, void *app_queue)

Start the mesh stack.

Begins mesh operations by activating the stack and managing communications based on specified event types and queues.

Parameters:
  • event_mesh[in] Event type of the mesh inner message.

  • event_app[in] Event type sent to application by the mesh stack.

  • event_queue[in] Pointer to the event queue for asynchronous communication.

  • app_queue[in] Pointer to the application queue for sending messages.

void mesh_deinit(void)

Deinitialize the mesh stack.

Releases all resources and resets global variables associated with the mesh stack, effectively stopping mesh operations.

void mesh_reboot(mesh_reboot_reason_t reason, uint32_t delay_ms)

Reboot with delay.

Causes the device to reboot after a specified delay, allowing for any necessary cleanup operations or shutdown tasks.

Parameters:
  • reason[in] Reboot reason, see mesh_reboot_reason_t.

  • delay_ms[in] Delay before rebooting in milliseconds. If 0, reboot immediately.

bool mesh_inner_msg_send(mesh_inner_msg_t *pmsg)

Send the mesh inner message.

Attempts to send a message within the mesh networking stack using the specified parameters.

Parameters:

pmsg[in] Pointer to the inner message structure.

Return values:
  • true – Message sent successfully.

  • false – Sending failed due to network congestion or invalid parameters, retry after verifying the message format.

Returns:

Operation result.

void mesh_inner_msg_handle(uint8_t event)

Handle the mesh inner message.

Processes incoming mesh events by executing any actions associated with the specified event type.

Parameters:

event[in] Mesh event type.

void mesh_tick_timer_start(uint32_t tick_ms, tick_timeout_cb tick_cb)

Start the tick timer.

Initiates a general-purpose tick timer used by the mesh stack to execute periodic tasks or callbacks at specified intervals.

Parameters:
  • tick_ms[in] Tick interval in milliseconds.

  • tick_cb[in] Timeout callback function executed when timer expires.

void mesh_tick_timer_stop(void)

Stop the tick timer.

Halts the tick timer, ceasing all associated periodic operations until restarted.

bool mesh_tick_timer_is_running(void)

Get the tick timer state.

Checks whether the tick timer is currently running and returns its operational state.

Return values:
  • true – Timer is running.

  • false – Timer is not running.

Returns:

Tick timer state.

void mesh_model_delay_execution_init(model_delay_execution_timeout_cb delay_cb)

Initialize model delay execution.

Prepares model delay execution mechanisms to manage delayed actions and processing within mesh models.

Parameters:

delay_cb[in] Callback function for delay execution timeout.

int mesh_version_check(const char *sdk_ver, uint32_t gcid)

Check the compatibility between the SDK and library.

Verifies compatibility by comparing version information and commit IDs to prevent runtime errors.

Parameters:
  • sdk_ver[in] SDK version string.

  • gcid[in] Git commit ID.

Return values:
  • 0 – Compatible.

  • >0 – Incompatible due to the library being outdated; update the library.

  • <0 – Incompatible due to the SDK being outdated, update the SDK.

Returns:

Compatibility status.