nRF5 SDK for Mesh v2.2.0
Modules | Functions
Serial API

Target-side serial interface module, providing serialized access to all major mesh APIs. More...

Modules

 Defines
 Serial interface defines.
 
 Types
 Serial interface type definitions.
 

Functions

uint32_t nrf_mesh_serial_init (nrf_mesh_serial_app_rx_cb_t app_rx_cb)
 Initialize the serial module and all its related submodules. More...
 
uint32_t nrf_mesh_serial_enable (void)
 Enable the serial connection. More...
 
nrf_mesh_serial_state_t nrf_mesh_serial_state_get (void)
 Get the current state of the serial module. More...
 
uint32_t nrf_mesh_serial_tx (uint8_t *p_data, uint32_t length)
 Transmit a serial packet with the APPLICATION_EVT opcode across the serial. More...
 

Detailed Description

Target-side serial interface module, providing serialized access to all major mesh APIs.

Function Documentation

◆ nrf_mesh_serial_init()

uint32_t nrf_mesh_serial_init ( nrf_mesh_serial_app_rx_cb_t  app_rx_cb)

Initialize the serial module and all its related submodules.

The device will initialize the given serial bearer, but NOT send the device started event, indicating that the device is ready for operation.

Parameters
[in]app_rx_cbApplication command handler function pointer, or NULL if the application commands shouldn't be handled.
Return values
NRF_SUCCESSThe serial module was successfully initialized.
NRF_ERROR_INVALID_STATEThe serial module has already been initialized.
NRF_ERROR_NULLThe p_init_params or one or more of the context lists were NULL.

◆ nrf_mesh_serial_enable()

uint32_t nrf_mesh_serial_enable ( void  )

Enable the serial connection.

Pushes a device started event across the serial line, notifying the controller that the device is ready for operation.

Return values
NRF_SUCCESSThe serial was successfully enabled.
NRF_ERROR_INVALID_STATEThe serial module has not been initialized, or has already been enabled.
NRF_ERROR_INTERNALThe call failed due to an unexpected error in one of the internal sub modules to the serial module.

◆ nrf_mesh_serial_state_get()

nrf_mesh_serial_state_t nrf_mesh_serial_state_get ( void  )

Get the current state of the serial module.

Returns
An enum in nrf_mesh_serial_state_t, indicating the current state of the serial.

◆ nrf_mesh_serial_tx()

uint32_t nrf_mesh_serial_tx ( uint8_t *  p_data,
uint32_t  length 
)

Transmit a serial packet with the APPLICATION_EVT opcode across the serial.

Parameters
[in]p_dataThe byte array to transmit across the serial.
[in]lengthLength of the p_data array. May not exceed the maximum length NRF_MESH_SERIAL_PAYLOAD_MAXLEN.
Return values
NRF_SUCCESSThe packet was successfully scheduled for transmission.
NRF_ERROR_INVALID_STATEThe serial module has not been initialized and enabled.
NRF_ERROR_NULLThe p_data pointer was NULL.
NRF_ERROR_INVALID_LENGTHThe length parameter exceeds the maximum serial packet length, or was 0.
NRF_ERROR_NO_MEMThe serial TX queue was full, and the packet couldn't be scheduled for transmission.

Documentation feedback | Developer Zone | Subscribe | Updated