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_client Pointer to the health client instance structure. [in] p_event Pointer 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.
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_client Pointer to the client instance structure. [in] company_id Company ID of of the server.
- Return values
-
NRF_SUCCESS The message was successfully sent to the server. NRF_ERROR_BUSY The 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
ackedistrue:HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED
- Parameters
-
[in,out] p_client Pointer to the client instance structure. [in] company_id Company ID of of the server. [in] acked Whether to send the message as an acknowledged message or an unacknowledged message.
- Return values
-
NRF_SUCCESS The message was successfully sent to the server. NRF_ERROR_BUSY The 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
ackedistrue:HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED
- Parameters
-
[in,out] p_client Pointer to the client instance structure. [in] company_id Company ID of of the server. [in] test_id ID of the self-test to run. [in] acked Whether to send the message as an acknowledged message or an unacknowledged message.
- Return values
-
NRF_SUCCESS The message was successfully sent to the server. NRF_ERROR_BUSY The 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_client Pointer to the client instance structure.
- Return values
-
NRF_SUCCESS The message was successfully sent to the server. NRF_ERROR_BUSY The 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
ackedistrue:HEALTH_CLIENT_EVT_TYPE_PERIOD_STATUS_RECEIVED
- Parameters
-
[in,out] p_client Pointer to the client instance structure. [in] fast_period_divisor Value of the fast period divisor. [in] acked Whether to send the message as an acknowledged message or an unacknowledged message.
- Return values
-
NRF_SUCCESS The message was successfully sent to the server. NRF_ERROR_BUSY The 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_client Pointer to the client instance structure.
- Return values
-
NRF_SUCCESS The message was successfully sent to the server. NRF_ERROR_BUSY The 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
ackedistrue:HEALTH_CLIENT_EVT_TYPE_ATTENTION_STATUS_RECEIVED
- Parameters
-
[in,out] p_client Pointer to the client instance structure. [in] attention_timer How long the attention state should be active in the server in seconds. [in] acked Whether to send the message as an acknowledged message or an unacknowledged message.
- Return values
-
NRF_SUCCESS The message was successfully sent to the server. NRF_ERROR_BUSY The 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_client Pointer to the client instance structure. [in] element_index Index of the element to register the model with. [in] evt_handler Event handler used to process incoming messages.
- Return values
-
NRF_SUCCESS The health client was successfully initialized. NRF_ERROR_NULL The pointer passed as the evt_handlerargument wasNULL.NRF_ERROR_NO_MEM There 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_client Pointer to the client instance structure.