xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/host/mesh/include/mesh/health_cli.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /** @file
2  *  @brief Bluetooth Mesh Health Client Model APIs.
3  */
4 
5 /*
6  * Copyright (c) 2017 Intel Corporation
7  *
8  * SPDX-License-Identifier: Apache-2.0
9  */
10 #ifndef __BT_MESH_HEALTH_CLI_H
11 #define __BT_MESH_HEALTH_CLI_H
12 
13 /**
14  * @brief Bluetooth Mesh
15  * @defgroup bt_mesh_health_cli Bluetooth Mesh Health Client Model
16  * @ingroup bt_mesh
17  * @{
18  */
19 
20 /** Mesh Health Client Model Context */
21 struct bt_mesh_health_cli {
22 	struct bt_mesh_model *model;
23 
24 	void (*current_status)(struct bt_mesh_health_cli *cli, u16_t addr,
25 			       u8_t test_id, u16_t cid, u8_t *faults,
26 			       size_t fault_count);
27 
28 	struct k_sem          op_sync;
29 	u32_t                 op_pending;
30 	void                 *op_param;
31 };
32 
33 extern const struct bt_mesh_model_op bt_mesh_health_cli_op[];
34 
35 #define BT_MESH_MODEL_HEALTH_CLI(cli_data)                                   \
36 		BT_MESH_MODEL(BT_MESH_MODEL_ID_HEALTH_CLI,                   \
37 			      bt_mesh_health_cli_op, NULL, cli_data)
38 
39 int bt_mesh_health_cli_set(struct bt_mesh_model *model);
40 
41 int bt_mesh_health_fault_get(u16_t net_idx, u16_t addr, u16_t app_idx,
42 			     u16_t cid, u8_t *test_id, u8_t *faults,
43 			     size_t *fault_count);
44 
45 int bt_mesh_health_fault_clear(u16_t net_idx, u16_t addr, u16_t app_idx,
46 			       u16_t cid, u8_t *test_id, u8_t *faults,
47 			       size_t *fault_count);
48 
49 int bt_mesh_health_fault_test(u16_t net_idx, u16_t addr, u16_t app_idx,
50 			      u16_t cid, u8_t test_id, u8_t *faults,
51 			      size_t *fault_count);
52 
53 int bt_mesh_health_period_get(u16_t net_idx, u16_t addr, u16_t app_idx,
54 			      u8_t *divisor);
55 
56 int bt_mesh_health_period_set(u16_t net_idx, u16_t addr, u16_t app_idx,
57 			      u8_t divisor, u8_t *updated_divisor);
58 
59 int bt_mesh_health_attention_get(u16_t net_idx, u16_t addr, u16_t app_idx,
60 				 u8_t *attention);
61 
62 int bt_mesh_health_attention_set(u16_t net_idx, u16_t addr, u16_t app_idx,
63 				 u8_t attention, u8_t *updated_attention);
64 
65 s32_t bt_mesh_health_cli_timeout_get(void);
66 void bt_mesh_health_cli_timeout_set(s32_t timeout);
67 
68 /**
69  * @}
70  */
71 
72 #endif /* __BT_MESH_HEALTH_CLI_H */
73