nRF5 SDK for Mesh v3.2.0  08c60f6

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.
 

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.

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_selfPointer to the Simple OnOff client structure that received the status.
[in]statusThe received status of the remote server.
[in]srcElement 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]handleModel handle
[in]p_selfPointer 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.

Enumerator
SIMPLE_ON_OFF_STATUS_OFF 

Received status OFF from the server.

SIMPLE_ON_OFF_STATUS_ON 

Received status ON from the server.

SIMPLE_ON_OFF_STATUS_ERROR_NO_REPLY 

The server did not reply to a Simple OnOff Set/Get.

SIMPLE_ON_OFF_STATUS_CANCELLED 

Simple OnOff Set/Get was cancelled.

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_clientSimple OnOff Client structure pointer.
[in]element_indexElement index to add the server model.
Return values
NRF_SUCCESSSuccessfully added client.
NRF_ERROR_NULLNULL pointer supplied to function.
NRF_ERROR_NO_MEMNo more memory available to allocate model.
NRF_ERROR_FORBIDDENMultiple model instances per element is not allowed.
NRF_ERROR_NOT_FOUNDInvalid 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_clientSimple OnOff Client structure pointer.
[in]on_offValue to set the Simple OnOff Server state to.
Return values
NRF_SUCCESSSuccessfully sent message.
NRF_ERROR_NULLNULL pointer in function arguments
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_STATEMessage already scheduled for a reliable transfer.
NRF_ERROR_INVALID_PARAMModel 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_clientSimple OnOff Client structure pointer.
[in]on_offValue to set the Simple OnOff Server state to.
[in]repeatsNumber of messages to send in a single burst. Increasing the number may increase probability of successful delivery.
Return values
NRF_SUCCESSSuccessfully sent message.
NRF_ERROR_NULLNULL pointer in function arguments
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.

◆ 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_clientSimple OnOff Client structure pointer.
Return values
NRF_SUCCESSSuccessfully sent message.
NRF_ERROR_NULLNULL pointer in function arguments
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_STATEMessage already scheduled for a reliable transfer.
NRF_ERROR_INVALID_PARAMModel 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_clientPointer to the client instance structure.