Model implementing the Health Server foundation model.
More...
Model implementing the Health Server foundation model.
◆ HEALTH_SERVER_FAULT_ARRAY_SIZE
#define HEALTH_SERVER_FAULT_ARRAY_SIZE 256 |
Size of the health server fault array.
Definition at line 58 of file health_server.h.
◆ health_server_attention_cb_t
typedef void(* health_server_attention_cb_t) (const health_server_t *p_server, bool attention_state) |
Callback function for the attention state.
The attention state is enabled when a health client sets the attention timer to a nonzero value, and disabled when the attention timer reaches zero.
- Parameters
-
[in] | p_server | Pointer to the health server instance structure. |
[in] | attention_state | true if the device should enable the attention state, false if the device should disable the attention state. |
Definition at line 71 of file health_server.h.
◆ health_server_selftest_cb_t
typedef void(* health_server_selftest_cb_t) (health_server_t *p_server, uint16_t company_id, uint8_t test_id) |
◆ health_server_fault_array_t
◆ health_server_fault_register()
void health_server_fault_register |
( |
health_server_t * |
p_server, |
|
|
uint8_t |
fault_code |
|
) |
| |
Registers a fault in the current fault array.
If the device is publishing a periodic Current Status message and there are no active faults before this function is called, the model will enable fast publishing of the Current Status message. This is done by dividing the current publishing interval with 2fast period interval and using the result as the new publishing interval.
- Note
- The fast publishing interval will never go lower than 100 ms.
- Parameters
-
[in,out] | p_server | Pointer to a server instance. |
[in] | fault_code | ID of the fault to register. |
- See also
- health_server_fault_clear()
◆ health_server_fault_clear()
void health_server_fault_clear |
( |
health_server_t * |
p_server, |
|
|
uint8_t |
fault_code |
|
) |
| |
Clears a fault from the current fault array.
If the device is currently publishing a periodic Current Status message with a fast publishing period, and there are no active faults after this function is called, the publishing interval will be reset back to the original interval.
- Parameters
-
[in,out] | p_server | Pointer to a server instance. |
[in] | fault_code | ID of the fault to clear. |
- See also
- health_server_fault_register()
◆ health_server_fault_is_set()
bool health_server_fault_is_set |
( |
health_server_t * |
p_server, |
|
|
uint8_t |
fault_code |
|
) |
| |
Checks if a fault code is set in current fault array.
- Parameters
-
[in,out] | p_server | Pointer to a server instance. |
[in] | fault_code | ID of the fault to check for. |
- Returns
- Returns
true
if the specified fault is set and false
otherwise.
◆ health_server_fault_count_get()
uint8_t health_server_fault_count_get |
( |
const health_server_t * |
p_server | ) |
|
Gets the number of currently set faults in the fault array.
- Parameters
-
[in] | p_server | Pointer to a server instance. |
- Returns
- Returns the number of currently set faults in the fault array.
◆ health_server_attention_get()
uint8_t health_server_attention_get |
( |
const health_server_t * |
p_server | ) |
|
Gets the current value of the attention timer.
- Parameters
-
[in] | p_server | Pointer to a server instance. |
- Returns
- Returns the current value of the attention timer.
◆ health_server_attention_set()
void health_server_attention_set |
( |
health_server_t * |
p_server, |
|
|
uint8_t |
attention |
|
) |
| |
Sets the attention timer value.
- Parameters
-
[in] | p_server | Pointer to a server instance. |
[in] | attention | New value for the attention timer. |
◆ health_server_init()
Initializes the health server model.
- Parameters
-
[in] | p_server | Pointer to the server instance structure. |
[in] | element_index | Element index to use when registering the health server. |
[in] | company_id | Company ID supported by this health model server. |
[in] | attention_cb | Callback function for enabling or disabling the attention state for the device. If NULL is passed as this argument, the attention state is considered to be unsupported by the model, and the attention timer is disabled. |
[in] | p_selftests | Pointer to an array of self-tests that will be supported by this device. If NULL is passed as this argument, self-tests will be unsupported by the model. In this case, the num_selftests parameter will be ignored. |
[in] | num_selftests | Number of self-tests provided by p_selftests . |
- Return values
-
NRF_SUCCESS | The model was successfully initialized. |
- See also
- access_model_add()