This module implements a vendor specific Simple OnOff Client. More...
Data Structures | |
| struct | simple_on_off_client_t |
| Simple OnOff Client state structure. More... | |
Macros | |
| #define | SIMPLE_ON_OFF_CLIENT_ACKED_TRANSACTION_TIMEOUT (SEC_TO_US(60)) |
| Acknowledged message transaction timeout. | |
| #define | SIMPLE_ON_OFF_CLIENT_MODEL_ID (0x0001) |
| Simple OnOff Client model ID. More... | |
Typedefs | |
| typedef void(* | simple_on_off_status_cb_t) (const simple_on_off_client_t *p_self, simple_on_off_status_t status, uint16_t src) |
| Simple OnOff status callback type. More... | |
| typedef void(* | simple_on_off_timeout_cb_t) (access_model_handle_t handle, void *p_self) |
| Simple OnOff timeout callback type. More... | |
Enumerations | |
| enum | simple_on_off_status_t { SIMPLE_ON_OFF_STATUS_OFF, SIMPLE_ON_OFF_STATUS_ON, SIMPLE_ON_OFF_STATUS_ERROR_NO_REPLY, SIMPLE_ON_OFF_STATUS_CANCELLED } |
| Simple OnOff status codes. More... | |
Functions | |
| uint32_t | simple_on_off_client_init (simple_on_off_client_t *p_client, uint16_t element_index) |
| Initializes the Simple OnOff client. More... | |
| uint32_t | simple_on_off_client_set (simple_on_off_client_t *p_client, bool on_off) |
| Sets the state of the Simple OnOff server. More... | |
| uint32_t | simple_on_off_client_set_unreliable (simple_on_off_client_t *p_client, bool on_off, uint8_t repeats) |
| Sets the state of the Simple OnOff Server unreliably (without acknowledgment). More... | |
| uint32_t | simple_on_off_client_get (simple_on_off_client_t *p_client) |
| Gets the state of the Simple OnOff server. More... | |
| void | simple_on_off_client_pending_msg_cancel (simple_on_off_client_t *p_client) |
| Cancel any ongoing reliable message transfer. More... | |
Detailed Description
This module implements a vendor specific Simple OnOff Client.
Macro Definition Documentation
◆ SIMPLE_ON_OFF_CLIENT_MODEL_ID
| #define SIMPLE_ON_OFF_CLIENT_MODEL_ID (0x0001) |
Simple OnOff Client model ID.
Definition at line 59 of file simple_on_off_client.h.
Typedef Documentation
◆ simple_on_off_status_cb_t
| typedef void(* simple_on_off_status_cb_t) (const simple_on_off_client_t *p_self, simple_on_off_status_t status, uint16_t src) |
Simple OnOff status callback type.
- Parameters
-
[in] p_self Pointer to the Simple OnOff client structure that received the status. [in] status The received status of the remote server. [in] src Element address of the remote server.
Definition at line 84 of file simple_on_off_client.h.
◆ simple_on_off_timeout_cb_t
| typedef void(* simple_on_off_timeout_cb_t) (access_model_handle_t handle, void *p_self) |
Simple OnOff timeout callback type.
- Parameters
-
[in] handle Model handle [in] p_self Pointer to the Simple OnOff client structure that received the status.
Definition at line 92 of file simple_on_off_client.h.
Enumeration Type Documentation
◆ simple_on_off_status_t
Simple OnOff status codes.
Definition at line 62 of file simple_on_off_client.h.
Function Documentation
◆ simple_on_off_client_init()
| uint32_t simple_on_off_client_init | ( | simple_on_off_client_t * | p_client, |
| uint16_t | element_index | ||
| ) |
Initializes the Simple OnOff client.
- Note
- This function should only be called once.
- The client handles the model allocation and adding.
- Parameters
-
[in,out] p_client Simple OnOff Client structure pointer. [in] element_index Element index to add the server model.
- Return values
-
NRF_SUCCESS Successfully added client. NRF_ERROR_NULL NULL pointer supplied to function. NRF_ERROR_NO_MEM No more memory available to allocate model. NRF_ERROR_FORBIDDEN Multiple model instances per element is not allowed. NRF_ERROR_NOT_FOUND Invalid element index.
◆ simple_on_off_client_set()
| uint32_t simple_on_off_client_set | ( | simple_on_off_client_t * | p_client, |
| bool | on_off | ||
| ) |
Sets the state of the Simple OnOff server.
- Parameters
-
[in,out] p_client Simple OnOff Client structure pointer. [in] on_off Value to set the Simple OnOff Server state to.
- Return values
-
NRF_SUCCESS Successfully sent message. NRF_ERROR_NULL NULL pointer in function arguments NRF_ERROR_NO_MEM Not enough memory available for message. NRF_ERROR_NOT_FOUND Invalid model handle or model not bound to element. NRF_ERROR_INVALID_ADDR The element index is greater than the number of local unicast addresses stored by the Device State Manager. NRF_ERROR_INVALID_STATE Message already scheduled for a reliable transfer. NRF_ERROR_INVALID_PARAM Model not bound to appkey, publish address not set or wrong opcode format.
◆ simple_on_off_client_set_unreliable()
| uint32_t simple_on_off_client_set_unreliable | ( | simple_on_off_client_t * | p_client, |
| bool | on_off, | ||
| uint8_t | repeats | ||
| ) |
Sets the state of the Simple OnOff Server unreliably (without acknowledgment).
- Parameters
-
[in,out] p_client Simple OnOff Client structure pointer. [in] on_off Value to set the Simple OnOff Server state to. [in] repeats Number of messages to send in a single burst. Increasing the number may increase probability of successful delivery.
- Return values
-
NRF_SUCCESS Successfully sent message. NRF_ERROR_NULL NULL pointer in function arguments NRF_ERROR_NO_MEM Not enough memory available for message. NRF_ERROR_NOT_FOUND Invalid model handle or model not bound to element. NRF_ERROR_INVALID_ADDR The element index is greater than the number of local unicast addresses stored by the Device State Manager. NRF_ERROR_INVALID_PARAM Model not bound to appkey, publish address not set or wrong opcode format.
◆ simple_on_off_client_get()
| uint32_t simple_on_off_client_get | ( | simple_on_off_client_t * | p_client | ) |
Gets the state of the Simple OnOff server.
- Note
- The state of the server will be given in the simple_on_off_status_cb_t callback.
- Parameters
-
[in,out] p_client Simple OnOff Client structure pointer.
- Return values
-
NRF_SUCCESS Successfully sent message. NRF_ERROR_NULL NULL pointer in function arguments NRF_ERROR_NO_MEM Not enough memory available for message. NRF_ERROR_NOT_FOUND Invalid model handle or model not bound to element. NRF_ERROR_INVALID_ADDR The element index is greater than the number of local unicast addresses stored by the Device State Manager. NRF_ERROR_INVALID_STATE Message already scheduled for a reliable transfer. NRF_ERROR_INVALID_PARAM Model not bound to appkey, publish address not set or wrong opcode format.
◆ simple_on_off_client_pending_msg_cancel()
| void simple_on_off_client_pending_msg_cancel | ( | simple_on_off_client_t * | p_client | ) |
Cancel any ongoing reliable message transfer.
- Parameters
-
[in,out] p_client Pointer to the client instance structure.