nRF5 SDK for Mesh v5.0.0
Data Structures | Macros | Typedefs | Functions
Sensor client model interface

Data Structures

struct  unpacked_marshalled_sensor_data_t
 
struct  unpacked_sensor_data_t
 
struct  sensor_client_callbacks_t
 
struct  sensor_client_settings_t
 User provided settings and callbacks for the model instance. More...
 
struct  sensor_client_t
 

Macros

#define SENSOR_CLIENT_MODEL_ID   0x1102
 Client model ID.
 

Typedefs

typedef void(* sensor_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_status_msg_pkt_t *p_in, uint16_t bytes)
 Callback type for incoming sensor data. More...
 
typedef void(* sensor_descriptor_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_descriptor_t *p_in, uint16_t num_descriptors)
 Callback type for sensor descriptor state related transactions. More...
 
typedef void(* sensor_cadence_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_cadence_status_msg_pkt_t *p_in, uint16_t length)
 Callback type for cadence related transactions. More...
 
typedef void(* sensor_column_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_column_status_msg_pkt_t *p_in, uint16_t length)
 Callback type for column state related transactions. More...
 
typedef void(* sensor_series_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_series_status_msg_pkt_t *p_in, uint16_t length)
 Callback type for series state related transactions. More...
 
typedef void(* sensor_settings_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_settings_status_msg_pkt_t *p_in, uint16_t length)
 Callback type for settings state related transactions. More...
 
typedef void(* sensor_setting_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_setting_status_msg_pkt_t *p_in, uint16_t length)
 Callback type for setting state related transactions. More...
 

Functions

uint32_t sensor_client_init (sensor_client_t *p_client, uint16_t element_index)
 Initializes Sensor Client. More...
 
uint32_t sensor_client_cadence_set (sensor_client_t *p_client, const sensor_cadence_set_msg_pkt_t *p_params, uint16_t length)
 Sends a Set cadence message to the server. More...
 
uint32_t sensor_client_cadence_set_unack (sensor_client_t *p_client, const sensor_cadence_set_msg_pkt_t *p_params, uint16_t length, uint8_t repeats)
 Sends a Set Cadence Unacknowledged message to the server. More...
 
uint32_t sensor_client_setting_set (sensor_client_t *p_client, const sensor_setting_set_msg_pkt_t *p_params, uint16_t length)
 Sends a Set setting message to the server. More...
 
uint32_t sensor_client_setting_set_unack (sensor_client_t *p_client, const sensor_setting_set_msg_pkt_t *p_params, uint16_t length, uint8_t repeats)
 Sends a Set Setting Unacknowledged message to the server. More...
 
uint32_t sensor_client_get (sensor_client_t *p_client, uint16_t property_id)
 Sends a Get message to the server. More...
 
uint32_t sensor_client_descriptor_get (sensor_client_t *p_client, uint16_t property_id)
 Sends a Descriptor Get message to the server. More...
 
uint32_t sensor_client_cadence_get (sensor_client_t *p_client, uint16_t property_id)
 Sends a Cadence Get message to the server. More...
 
uint32_t sensor_client_settings_get (sensor_client_t *p_client, uint16_t property_id)
 Sends a Settings Get message to the server. More...
 
uint32_t sensor_client_setting_get (sensor_client_t *p_client, uint16_t property_id, uint16_t setting_property_id)
 Sends a Setting Get message to the server. More...
 
uint32_t sensor_client_column_get (sensor_client_t *p_client, sensor_column_get_msg_pkt_t *p_rawbuf, uint16_t length)
 Sends a Column Get message to the server. More...
 
uint32_t sensor_client_series_get (sensor_client_t *p_client, sensor_series_get_msg_pkt_t *p_raw_colbuf, uint16_t length)
 Sends a Series Get message to the server. More...
 

Detailed Description

Typedef Documentation

◆ sensor_state_status_cb_t

typedef void(* sensor_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_status_msg_pkt_t *p_in, uint16_t bytes)

Callback type for incoming sensor data.

Parameters
[in]p_selfPointer to the model structure
[in]p_metaAccess metadata for the received message
[in]p_inPointer to the input event parameters for the user application
[in]bytesThe number of bytes of data at p_in

Definition at line 83 of file sensor_client.h.

◆ sensor_descriptor_state_status_cb_t

typedef void(* sensor_descriptor_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_descriptor_t *p_in, uint16_t num_descriptors)

Callback type for sensor descriptor state related transactions.

Parameters
[in]p_selfPointer to the model structure
[in]p_metaAccess metadata for the received message
[in]p_inPointer to the input event parameters for the user application
[in]num_descriptorsThe number of descriptors described at p_in

Definition at line 96 of file sensor_client.h.

◆ sensor_cadence_state_status_cb_t

typedef void(* sensor_cadence_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_cadence_status_msg_pkt_t *p_in, uint16_t length)

Callback type for cadence related transactions.

Parameters
[in]p_selfPointer to the model structure
[in]p_metaAccess metadata for the received message
[in]p_inPointer to the input event parameters for the user application
[in]lengthLength of the message (p_in) in bytes

Definition at line 109 of file sensor_client.h.

◆ sensor_column_state_status_cb_t

typedef void(* sensor_column_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_column_status_msg_pkt_t *p_in, uint16_t length)

Callback type for column state related transactions.

Parameters
[in]p_selfPointer to the model structure
[in]p_metaAccess metadata for the received message
[in]p_inPointer to the input event parameters for the user application
[in]lengthIncoming data length

Definition at line 122 of file sensor_client.h.

◆ sensor_series_state_status_cb_t

typedef void(* sensor_series_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_series_status_msg_pkt_t *p_in, uint16_t length)

Callback type for series state related transactions.

Parameters
[in]p_selfPointer to the model structure
[in]p_metaAccess metadata for the received message
[in]p_inPointer to the input event parameters for the user application
[in]lengthIncoming data length

Definition at line 135 of file sensor_client.h.

◆ sensor_settings_state_status_cb_t

typedef void(* sensor_settings_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_settings_status_msg_pkt_t *p_in, uint16_t length)

Callback type for settings state related transactions.

Parameters
[in]p_selfPointer to the model structure
[in]p_metaAccess metadata for the received message
[in]p_inPointer to the input event parameters for the user application
[in]lengthLength of the message (p_in) in bytes

Definition at line 148 of file sensor_client.h.

◆ sensor_setting_state_status_cb_t

typedef void(* sensor_setting_state_status_cb_t) (const sensor_client_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_setting_status_msg_pkt_t *p_in, uint16_t length)

Callback type for setting state related transactions.

Parameters
[in]p_selfPointer to the model structure
[in]p_metaAccess metadata for the received message
[in]p_inPointer to the input event parameters for the user application
[in]lengthLength of the message (p_in) in bytes

Definition at line 161 of file sensor_client.h.

Function Documentation

◆ sensor_client_init()

uint32_t sensor_client_init ( sensor_client_t *  p_client,
uint16_t  element_index 
)

Initializes Sensor Client.

Note
This function should only be called once.
The client handles the model allocation and adding.
Parameters
[in]p_clientClient model context pointer.
[in]element_indexElement index to add the model
Return values
NRF_SUCCESSThe model is initialized successfully.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMACCESS_MODEL_COUNT number of models already allocated or no more subscription lists available in memory pool (see ACCESS_SUBSCRIPTION_LIST_COUNT).
NRF_ERROR_FORBIDDENMultiple model instances per element are not allowed or changes to device composition are not allowed. Adding a new model after device is provisioned is not allowed.
NRF_ERROR_NOT_FOUNDInvalid access element index.

◆ sensor_client_cadence_set()

uint32_t sensor_client_cadence_set ( sensor_client_t *  p_client,
const sensor_cadence_set_msg_pkt_t p_params,
uint16_t  length 
)

Sends a Set cadence message to the server.

Note
Expected response: Status, if the message is sent as acknowledged message.
Parameters
[in]p_clientClient model context pointer.
[in]p_paramsMessage parameters.
[in]lengthLength in bytes of data at p_params.
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

◆ sensor_client_cadence_set_unack()

uint32_t sensor_client_cadence_set_unack ( sensor_client_t *  p_client,
const sensor_cadence_set_msg_pkt_t p_params,
uint16_t  length,
uint8_t  repeats 
)

Sends a Set Cadence Unacknowledged message to the server.

Note
Expected response: Status, if the message is sent as acknowledged message.
Parameters
[in]p_clientClient model context pointer.
[in]p_paramsMessage parameters.
[in]lengthLength in bytes of data at p_params.
[in]repeatsNumber of repetitions to use while sending unacknowledged message.
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMNot enough memory available for message.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_ADDRThe element index is greater than the number of local unicast addresses stored by the Device State Manager.
NRF_ERROR_INVALID_PARAMModel not bound to appkey, publish address not set or wrong opcode format.
NRF_ERROR_FORBIDDENFailed to allocate a sequence number from network.
NRF_ERROR_INVALID_STATEThere's already a segmented packet that is being to sent to this destination. Wait for the transmission to finish before sending new segmented packets.

◆ sensor_client_setting_set()

uint32_t sensor_client_setting_set ( sensor_client_t *  p_client,
const sensor_setting_set_msg_pkt_t p_params,
uint16_t  length 
)

Sends a Set setting message to the server.

Note
Expected response: Status, if the message is sent as acknowledged message.
Parameters
[in]p_clientClient model context pointer.
[in]p_paramsMessage parameters.
[in]lengthLength in bytes of data at p_params.
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

◆ sensor_client_setting_set_unack()

uint32_t sensor_client_setting_set_unack ( sensor_client_t *  p_client,
const sensor_setting_set_msg_pkt_t p_params,
uint16_t  length,
uint8_t  repeats 
)

Sends a Set Setting Unacknowledged message to the server.

Note
Expected response: Status, if the message is sent as acknowledged message.
Parameters
[in]p_clientClient model context pointer.
[in]p_paramsMessage parameters.
[in]lengthLength in bytes of data at p_params.
[in]repeatsNumber of repetitions to use while sending unacknowledged message.
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_NO_MEMNot enough memory available for message.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_ADDRThe element index is greater than the number of local unicast addresses stored by the Device State Manager.
NRF_ERROR_INVALID_PARAMModel not bound to appkey, publish address not set or wrong opcode format.
NRF_ERROR_FORBIDDENFailed to allocate a sequence number from network.
NRF_ERROR_INVALID_STATEThere's already a segmented packet that is being to sent to this destination. Wait for the transmission to finish before sending new segmented packets.

◆ sensor_client_get()

uint32_t sensor_client_get ( sensor_client_t *  p_client,
uint16_t  property_id 
)

Sends a Get message to the server.

Note
Expected response: Status
Parameters
[in]p_clientClient model context pointer.
[in]property_idProperty ID specifying sensor status to return
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

◆ sensor_client_descriptor_get()

uint32_t sensor_client_descriptor_get ( sensor_client_t *  p_client,
uint16_t  property_id 
)

Sends a Descriptor Get message to the server.

Note
Expected response: Status
Parameters
[in]p_clientClient model context pointer.
[in]property_idProperty ID specifying descriptor to return
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

◆ sensor_client_cadence_get()

uint32_t sensor_client_cadence_get ( sensor_client_t *  p_client,
uint16_t  property_id 
)

Sends a Cadence Get message to the server.

Note
Expected response: Status
Parameters
[in]p_clientClient model context pointer.
[in]property_idProperty ID specifying cadence to return
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

◆ sensor_client_settings_get()

uint32_t sensor_client_settings_get ( sensor_client_t *  p_client,
uint16_t  property_id 
)

Sends a Settings Get message to the server.

Note
Expected response: Status
Parameters
[in]p_clientClient model context pointer.
[in]property_idProperty ID specifying settings to return
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

◆ sensor_client_setting_get()

uint32_t sensor_client_setting_get ( sensor_client_t *  p_client,
uint16_t  property_id,
uint16_t  setting_property_id 
)

Sends a Setting Get message to the server.

Note
Expected response: Status
Parameters
[in]p_clientClient model context pointer.
[in]property_idProperty ID specifying settings to return
[in]setting_property_idSetting property ID specifying setting to return
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

◆ sensor_client_column_get()

uint32_t sensor_client_column_get ( sensor_client_t *  p_client,
sensor_column_get_msg_pkt_t p_rawbuf,
uint16_t  length 
)

Sends a Column Get message to the server.

Note
Expected response: Status
Parameters
[in]p_clientClient model context pointer.
[in]p_rawbufPointer to column message data.
[in]lengthThe number of bytes of data at p_rawbuf.
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

◆ sensor_client_series_get()

uint32_t sensor_client_series_get ( sensor_client_t *  p_client,
sensor_series_get_msg_pkt_t p_raw_colbuf,
uint16_t  length 
)

Sends a Series Get message to the server.

Note
Expected response: Status
Parameters
[in]p_clientClient model context pointer.
[in]p_raw_colbufPointer to series message data.
[in]lengthThe number of bytes of data at p_raw_colbuf.
Return values
NRF_SUCCESSThe message is handed over to the mesh stack for transmission.
NRF_ERROR_NULLNULL pointer given to function.
NRF_ERROR_BUSYThe model is busy publishing another message.
NRF_ERROR_NO_MEMNo memory available to send the message at this point.
NRF_ERROR_NOT_FOUNDInvalid model handle or model not bound to element.
NRF_ERROR_INVALID_PARAMModel not bound to application key, publish address not set or wrong opcode format.
NRF_ERROR_INVALID_STATEMessage already scheduled for an acknowledged transfer.

Documentation feedback | Developer Zone | Subscribe | Updated