This module implements a vendor specific Simple OnOff Server.
More...
This module implements a vendor specific Simple OnOff Server.
◆ SIMPLE_ON_OFF_SERVER_MODEL_ID
#define SIMPLE_ON_OFF_SERVER_MODEL_ID (0x0000) |
◆ simple_on_off_get_cb_t
typedef bool(* simple_on_off_get_cb_t) (const simple_on_off_server_t *p_self) |
Get callback type.
- Parameters
-
[in] | p_self | Pointer to the Simple OnOff Server context structure. |
- Returns
true
if the state is On, false
otherwise.
Definition at line 63 of file simple_on_off_server.h.
◆ simple_on_off_set_cb_t
typedef bool(* simple_on_off_set_cb_t) (const simple_on_off_server_t *p_self, bool on) |
Set callback type.
- Parameters
-
[in] | p_self | Pointer to the Simple OnOff Server context structure. |
[in] | on_off | Desired state |
- Returns
true
if the current state is On, false
otherwise.
Definition at line 71 of file simple_on_off_server.h.
◆ simple_on_off_server_init()
uint32_t simple_on_off_server_init |
( |
simple_on_off_server_t * |
p_server, |
|
|
uint16_t |
element_index |
|
) |
| |
Initializes the Simple OnOff server.
- Note
- This function should only be called once.
-
The server handles the model allocation and adding.
- Parameters
-
[in] | p_server | Simple OnOff Server structure pointer. |
[in] | element_index | Element index to add the server model. |
- Return values
-
NRF_SUCCESS | Successfully added server. |
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_server_status_publish()
uint32_t simple_on_off_server_status_publish |
( |
simple_on_off_server_t * |
p_server, |
|
|
bool |
value |
|
) |
| |
Publishes unsolicited status message.
This API can be used to send unsolicited status messages to report updated state value as a result of local action.
- Parameters
-
[in] | p_server | Simple OnOff Server structure pointer |
[in] | value | Current on/off value to be published |
- Return values
-
NRF_SUCCESS | Successfully queued packet for transmission. |
NRF_ERROR_NULL | NULL pointer supplied to function. |
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. |
NRF_ERROR_INVALID_LENGTH | Attempted to send message larger than ACCESS_MESSAGE_LENGTH_MAX. |