xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/host/mesh/include/mesh/testing.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /**
2  * @file testing.h
3  * @brief Internal API for Bluetooth testing.
4  */
5 
6 /*
7  * Copyright (c) 2017 Intel Corporation
8  *
9  * SPDX-License-Identifier: Apache-2.0
10  */
11 
12 #ifndef __BT_TESTING_H
13 #define __BT_TESTING_H
14 
15 #include "slist.h"
16 #include "glue.h"
17 #include "access.h"
18 
19 /**
20  * @brief Bluetooth testing
21  * @defgroup bt_test_cb Bluetooth testing callbacks
22  * @ingroup bluetooth
23  * @{
24  */
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /** @brief Bluetooth Testing callbacks structure.
31  *
32  *  Callback structure to be used for Bluetooth testing purposes.
33  *  Allows access to Bluetooth stack internals, not exposed by public API.
34  */
35 struct bt_test_cb {
36 	void (*mesh_net_recv)(u8_t ttl, u8_t ctl, u16_t src, u16_t dst,
37 			      const void *payload, size_t payload_len);
38 	void (*mesh_model_bound)(u16_t addr, struct bt_mesh_model *model,
39 				 u16_t key_idx);
40 	void (*mesh_model_unbound)(u16_t addr, struct bt_mesh_model *model,
41 				   u16_t key_idx);
42 	void (*mesh_prov_invalid_bearer)(u8_t opcode);
43 	void (*mesh_trans_incomp_timer_exp)(void);
44 
45 	sys_snode_t node;
46 };
47 
48 /** Register callbacks for Bluetooth testing purposes
49  *
50  *  @param cb bt_test_cb callback structure
51  */
52 void bt_test_cb_register(struct bt_test_cb *cb);
53 
54 /** Unregister callbacks for Bluetooth testing purposes
55  *
56  *  @param cb bt_test_cb callback structure
57  */
58 void bt_test_cb_unregister(struct bt_test_cb *cb);
59 
60 u8_t mod_bind(struct bt_mesh_model *model, u16_t key_idx);
61 u8_t mod_unbind(struct bt_mesh_model *model, u16_t key_idx, bool store);
62 int cmd_mesh_init(int argc, char *argv[]);
63 
64 int bt_test_shell_init(void);
65 int bt_test_bind_app_key_to_model(struct bt_mesh_model *model, u16_t key_idx, u16_t id);
66 
67 /**
68  * @}
69  */
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* __BT_TESTING_H */
76