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

Data Structures

struct  sensor_server_settings_t
 User provided settings and callbacks for the model instance. More...
 
struct  sensor_server_t
 
struct  sensor_setup_server_cbs_t
 Transaction callbacks for the Sensor state. More...
 
struct  sensor_setup_server_callbacks_t
 Sensor server callback list. More...
 
struct  sensor_setup_server_settings_t
 User provided settings and callbacks for the model instance. More...
 
struct  sensor_setup_server_t
 

Macros

#define SENSOR_SERVER_MODEL_ID   0x1100
 Server model ID.
 
#define SENSOR_SETUP_SERVER_MODEL_ID   0x1101
 Setup server model ID.
 

Typedefs

typedef void(* sensor_descriptor_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, sensor_descriptor_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor descriptor get message. More...
 
typedef void(* sensor_state_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, sensor_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor Get message. More...
 
typedef void(* sensor_column_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_column_get_msg_pkt_t *p_in, uint16_t in_bytes, sensor_column_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor Column Get message. More...
 
typedef void(* sensor_series_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_series_get_msg_pkt_t *p_in, uint16_t in_bytes, sensor_series_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor Series Get message. More...
 
typedef void(* sensor_cadence_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, sensor_cadence_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor Cadence Get message. More...
 
typedef void(* sensor_cadence_set_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, const sensor_cadence_set_msg_pkt_t *p_in, uint16_t in_bytes, sensor_cadence_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor Cadence Set message. More...
 
typedef void(* sensor_settings_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, sensor_settings_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor Settings Get message. More...
 
typedef void(* sensor_setting_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, uint16_t setting_property_id, sensor_setting_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor Setting Get message. More...
 
typedef void(* sensor_setting_set_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, uint16_t settings_property_id, const sensor_setting_set_msg_pkt_t *p_in, uint16_t in_bytes, sensor_setting_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)
 Callback type for Sensor Setting Set message. More...
 
typedef void(* sensor_publication_schedule_cb_t) (const sensor_setup_server_t *p_self)
 Callback type for scheduling sensor publications. More...
 

Functions

uint32_t sensor_server_status_publish (const sensor_server_t *p_server, const sensor_status_msg_pkt_t *p_data, uint16_t data_length, sensor_opcode_t status_opcode)
 Publishes unsolicited Status message. More...
 
uint32_t sensor_server_setup_status_publish (const sensor_setup_server_t *p_s_server, const sensor_status_msg_pkt_t *p_data, uint16_t data_length, sensor_opcode_t status_opcode)
 Publishes unsolicited Status message. More...
 
uint32_t sensor_setup_server_init (sensor_setup_server_t *p_server, uint16_t element_index)
 Initializes Sensor Setup server. More...
 

Detailed Description

Typedef Documentation

◆ sensor_descriptor_get_cb_t

typedef void(* sensor_descriptor_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, sensor_descriptor_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor descriptor get message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[out]pp_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes.

Definition at line 76 of file sensor_setup_server.h.

◆ sensor_state_get_cb_t

typedef void(* sensor_state_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, sensor_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor Get message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[out]pp_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes.

Definition at line 91 of file sensor_setup_server.h.

◆ sensor_column_get_cb_t

typedef void(* sensor_column_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_column_get_msg_pkt_t *p_in, uint16_t in_bytes, sensor_column_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor Column Get message.

(setting is singular, not settings)

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[in]p_inThe input message
[in]in_bytesThe number of data bytes at p_in
[out]pp_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes.

Definition at line 108 of file sensor_setup_server.h.

◆ sensor_series_get_cb_t

typedef void(* sensor_series_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const sensor_series_get_msg_pkt_t *p_in, uint16_t in_bytes, sensor_series_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor Series Get message.

(setting is singular, not settings)

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[in]p_inThe input message
[in]in_bytesThe number of data bytes at p_in
[out]pp_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes at *pp_out.

Definition at line 126 of file sensor_setup_server.h.

◆ sensor_cadence_get_cb_t

typedef void(* sensor_cadence_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, sensor_cadence_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor Cadence Get message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[out]pp_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes.

Definition at line 143 of file sensor_setup_server.h.

◆ sensor_cadence_set_cb_t

typedef void(* sensor_cadence_set_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, const sensor_cadence_set_msg_pkt_t *p_in, uint16_t in_bytes, sensor_cadence_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor Cadence Set message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[in]p_inThe input message
[in]in_bytesThe number of data bytes at p_in
[out]p_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes.

Definition at line 160 of file sensor_setup_server.h.

◆ sensor_settings_get_cb_t

typedef void(* sensor_settings_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, sensor_settings_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor Settings Get message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[out]p_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes.

Definition at line 176 of file sensor_setup_server.h.

◆ sensor_setting_get_cb_t

typedef void(* sensor_setting_get_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, uint16_t setting_property_id, sensor_setting_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor Setting Get message.

(setting is singular, not settings)

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[in]setting_property_idThe requested setting property id.
[out]p_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes.

Definition at line 192 of file sensor_setup_server.h.

◆ sensor_setting_set_cb_t

typedef void(* sensor_setting_set_cb_t) (const sensor_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, uint16_t property_id, uint16_t settings_property_id, const sensor_setting_set_msg_pkt_t *p_in, uint16_t in_bytes, sensor_setting_status_msg_pkt_t **pp_out, uint16_t *p_out_bytes)

Callback type for Sensor Setting Set message.

Parameters
[in]p_selfPointer to the model structure.
[in]p_metaAccess metadata for the received message.
[in]property_idThe requested property id (or 0 if no PID specified)
[in]settings_property_idThe requested settings property id.
[in]p_inPointer to the input message
[in]in_bytesThe number of data bytes at p_in
[out]p_outPointer to the response message.
[out]p_out_bytesThe number of response message bytes.

Definition at line 211 of file sensor_setup_server.h.

◆ sensor_publication_schedule_cb_t

typedef void(* sensor_publication_schedule_cb_t) (const sensor_setup_server_t *p_self)

Callback type for scheduling sensor publications.

Parameters
[in]p_selfPointer to the model structure.

Definition at line 225 of file sensor_setup_server.h.

Function Documentation

◆ sensor_server_status_publish()

uint32_t sensor_server_status_publish ( const sensor_server_t *  p_server,
const sensor_status_msg_pkt_t *  p_data,
uint16_t  data_length,
sensor_opcode_t  status_opcode 
)

Publishes unsolicited Status message.

This API can be used to send unsolicited messages to report updated state value as a result of local action.

Parameters
[in]p_serverStatus server context pointer.
[in]p_dataMessage buffer
[in]data_lengthLength of message buffer in bytes
[in]status_opcodeIdentifies the status type
Return values
NRF_SUCCESSThe message is published successfully.
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_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_server_setup_status_publish()

uint32_t sensor_server_setup_status_publish ( const sensor_setup_server_t *  p_s_server,
const sensor_status_msg_pkt_t *  p_data,
uint16_t  data_length,
sensor_opcode_t  status_opcode 
)

Publishes unsolicited Status message.

This API can be used to send unsolicited messages to report updated state value as a result of local action.

Parameters
[in]p_s_serverStatus server context pointer.
[in]p_dataMessage buffer
[in]data_lengthLength of message buffer in bytes
[in]status_opcodeIdentifies the status type
Return values
NRF_SUCCESSThe message is published successfully.
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_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_setup_server_init()

uint32_t sensor_setup_server_init ( sensor_setup_server_t *  p_server,
uint16_t  element_index 
)

Initializes Sensor Setup server.

Note
The server handles the model allocation and adding.
Parameters
[in]p_serverSensor server context pointer.
[in]element_indexElement index to add the model to.
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.

Documentation feedback | Developer Zone | Subscribe | Updated