nRF5 SDK for Mesh v5.0.0
Data Structures | Macros | Typedefs | Enumerations | Functions

Model implementing the Health Client foundation model. More...

Data Structures

struct  health_client_evt_fault_status_t
 Fault status event. More...
 
struct  health_client_evt_period_status_t
 Period status event. More...
 
struct  health_client_evt_attention_status_t
 Attention status event. More...
 
struct  health_client_evt_t
 Attention status event. More...
 
struct  health_client_t
 Health client instance structure. More...
 

Macros

#define HEALTH_CLIENT_ACKED_TRANSACTION_TIMEOUT   (SEC_TO_US(60))
 Acknowledged message transaction timeout.
 

Typedefs

typedef void(* health_client_evt_cb_t) (const health_client_t *p_client, const health_client_evt_t *p_event)
 Event callback function type. More...
 

Enumerations

enum  health_client_evt_type_t {
  HEALTH_CLIENT_EVT_TYPE_CURRENT_STATUS_RECEIVED, HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED, HEALTH_CLIENT_EVT_TYPE_PERIOD_STATUS_RECEIVED, HEALTH_CLIENT_EVT_TYPE_ATTENTION_STATUS_RECEIVED,
  HEALTH_CLIENT_EVT_TYPE_TIMEOUT, HEALTH_CLIENT_EVT_TYPE_CANCELLED
}
 Message types for messages received by the health client. More...
 

Functions

uint32_t health_client_fault_get (health_client_t *p_client, uint16_t company_id)
 Requests the current fault status from a server. More...
 
uint32_t health_client_fault_clear (health_client_t *p_client, uint16_t company_id, bool acked)
 Clears the fault array for a specified company ID. More...
 
uint32_t health_client_fault_test (health_client_t *p_client, uint16_t company_id, uint8_t test_id, bool acked)
 Requests a server to run a self-test. More...
 
uint32_t health_client_period_get (health_client_t *p_client)
 Gets the current health period state of an element. More...
 
uint32_t health_client_period_set (health_client_t *p_client, uint8_t fast_period_divisor, bool acked)
 Sets the health period state of an element. More...
 
uint32_t health_client_attention_get (health_client_t *p_client)
 Gets the attention timer from a server. More...
 
uint32_t health_client_attention_set (health_client_t *p_client, uint8_t attention_timer, bool acked)
 Sets the attention timer on a server. More...
 
uint32_t health_client_init (health_client_t *p_client, uint16_t element_index, health_client_evt_cb_t evt_handler)
 Initializes a health client instance. More...
 
void health_client_pending_msg_cancel (health_client_t *p_client)
 Cancel any ongoing reliable message transfer. More...
 

Detailed Description

Model implementing the Health Client foundation model.

Typedef Documentation

◆ health_client_evt_cb_t

typedef void(* health_client_evt_cb_t) (const health_client_t *p_client, const health_client_evt_t *p_event)

Event callback function type.

This function is called when the health client receives a message from a health server.

Parameters
[in]p_clientPointer to the health client instance structure.
[in]p_eventPointer to a structure containing information about the received event.

Definition at line 120 of file health_client.h.

Enumeration Type Documentation

◆ health_client_evt_type_t

Message types for messages received by the health client.

Enumerator
HEALTH_CLIENT_EVT_TYPE_CURRENT_STATUS_RECEIVED 

A Health Current Status message was received.

HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED 

A Health Fault Status message was received.

HEALTH_CLIENT_EVT_TYPE_PERIOD_STATUS_RECEIVED 

A Health Period Status message was received.

HEALTH_CLIENT_EVT_TYPE_ATTENTION_STATUS_RECEIVED 

A Health Attention Status message was received.

HEALTH_CLIENT_EVT_TYPE_TIMEOUT 

A reliable transfer timed out.

HEALTH_CLIENT_EVT_TYPE_CANCELLED 

A reliable transfer has been cancelled.

Definition at line 64 of file health_client.h.

Function Documentation

◆ health_client_fault_get()

uint32_t health_client_fault_get ( health_client_t *  p_client,
uint16_t  company_id 
)

Requests the current fault status from a server.

Note
Response event: HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED
Parameters
[in,out]p_clientPointer to the client instance structure.
[in]company_idCompany ID of of the server.
Return values
NRF_SUCCESSThe message was successfully sent to the server.
NRF_ERROR_BUSYThe client is currently waiting for a reply from a server.

◆ health_client_fault_clear()

uint32_t health_client_fault_clear ( health_client_t *  p_client,
uint16_t  company_id,
bool  acked 
)

Clears the fault array for a specified company ID.

Note
Response event if acked is true: HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED
Parameters
[in,out]p_clientPointer to the client instance structure.
[in]company_idCompany ID of of the server.
[in]ackedWhether to send the message as an acknowledged message or an unacknowledged message.
Return values
NRF_SUCCESSThe message was successfully sent to the server.
NRF_ERROR_BUSYThe client is currently waiting for a reply from a server.

◆ health_client_fault_test()

uint32_t health_client_fault_test ( health_client_t *  p_client,
uint16_t  company_id,
uint8_t  test_id,
bool  acked 
)

Requests a server to run a self-test.

Note
Response event if acked is true: HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED
Parameters
[in,out]p_clientPointer to the client instance structure.
[in]company_idCompany ID of of the server.
[in]test_idID of the self-test to run.
[in]ackedWhether to send the message as an acknowledged message or an unacknowledged message.
Return values
NRF_SUCCESSThe message was successfully sent to the server.
NRF_ERROR_BUSYThe client is currently waiting for a reply from a server.

◆ health_client_period_get()

uint32_t health_client_period_get ( health_client_t *  p_client)

Gets the current health period state of an element.

Note
Response event: HEALTH_CLIENT_EVT_TYPE_PERIOD_STATUS_RECEIVED
Parameters
[in,out]p_clientPointer to the client instance structure.
Return values
NRF_SUCCESSThe message was successfully sent to the server.
NRF_ERROR_BUSYThe client is currently waiting for a reply from a server.

◆ health_client_period_set()

uint32_t health_client_period_set ( health_client_t *  p_client,
uint8_t  fast_period_divisor,
bool  acked 
)

Sets the health period state of an element.

Note
Response event if acked is true: HEALTH_CLIENT_EVT_TYPE_PERIOD_STATUS_RECEIVED
Parameters
[in,out]p_clientPointer to the client instance structure.
[in]fast_period_divisorValue of the fast period divisor.
[in]ackedWhether to send the message as an acknowledged message or an unacknowledged message.
Return values
NRF_SUCCESSThe message was successfully sent to the server.
NRF_ERROR_BUSYThe client is currently waiting for a reply from a server.

◆ health_client_attention_get()

uint32_t health_client_attention_get ( health_client_t *  p_client)

Gets the attention timer from a server.

Note
Response event: HEALTH_CLIENT_EVT_TYPE_ATTENTION_STATUS_RECEIVED
Parameters
[in,out]p_clientPointer to the client instance structure.
Return values
NRF_SUCCESSThe message was successfully sent to the server.
NRF_ERROR_BUSYThe client is currently waiting for a reply from a server.

◆ health_client_attention_set()

uint32_t health_client_attention_set ( health_client_t *  p_client,
uint8_t  attention_timer,
bool  acked 
)

Sets the attention timer on a server.

Note
Response event if acked is true: HEALTH_CLIENT_EVT_TYPE_ATTENTION_STATUS_RECEIVED
Parameters
[in,out]p_clientPointer to the client instance structure.
[in]attention_timerHow long the attention state should be active in the server in seconds.
[in]ackedWhether to send the message as an acknowledged message or an unacknowledged message.
Return values
NRF_SUCCESSThe message was successfully sent to the server.
NRF_ERROR_BUSYThe client is currently waiting for a reply from a server.

◆ health_client_init()

uint32_t health_client_init ( health_client_t *  p_client,
uint16_t  element_index,
health_client_evt_cb_t  evt_handler 
)

Initializes a health client instance.

Parameters
[in,out]p_clientPointer to the client instance structure.
[in]element_indexIndex of the element to register the model with.
[in]evt_handlerEvent handler used to process incoming messages.
Return values
NRF_SUCCESSThe health client was successfully initialized.
NRF_ERROR_NULLThe pointer passed as the evt_handler argument was NULL.
NRF_ERROR_NO_MEMThere was not enough memory available to allocate a subscription list for the model.
See also
access_model_add()

◆ health_client_pending_msg_cancel()

void health_client_pending_msg_cancel ( health_client_t *  p_client)

Cancel any ongoing reliable message transfer.

Parameters
[in,out]p_clientPointer to the client instance structure.

Documentation feedback | Developer Zone | Subscribe | Updated