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 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ 12 #define ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ 13 14 #if defined(CONFIG_BT_MESH) 15 #include <bluetooth/mesh.h> 16 #endif /* CONFIG_BT_MESH */ 17 18 /** 19 * @brief Bluetooth testing 20 * @defgroup bt_test_cb Bluetooth testing callbacks 21 * @ingroup bluetooth 22 * @{ 23 */ 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 /** @brief Bluetooth Testing callbacks structure. 30 * 31 * Callback structure to be used for Bluetooth testing purposes. 32 * Allows access to Bluetooth stack internals, not exposed by public API. 33 */ 34 struct bt_test_cb { 35 #if defined(CONFIG_BT_MESH) 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 #endif /* CONFIG_BT_MESH */ 45 46 sys_snode_t node; 47 }; 48 49 /** Register callbacks for Bluetooth testing purposes 50 * 51 * @param cb bt_test_cb callback structure 52 */ 53 void bt_test_cb_register(struct bt_test_cb *cb); 54 55 /** Unregister callbacks for Bluetooth testing purposes 56 * 57 * @param cb bt_test_cb callback structure 58 */ 59 void bt_test_cb_unregister(struct bt_test_cb *cb); 60 61 /** Send Friend Subscription List Add message. 62 * 63 * Used by Low Power node to send the group address for which messages are to 64 * be stored by Friend node. 65 * 66 * @param group Group address 67 * 68 * @return Zero on success or (negative) error code otherwise. 69 */ 70 int bt_test_mesh_lpn_group_add(u16_t group); 71 72 /** Send Friend Subscription List Remove message. 73 * 74 * Used by Low Power node to remove the group addresses from Friend node 75 * subscription list. Messages sent to those addresses will not be stored 76 * by Friend node. 77 * 78 * @param groups Group addresses 79 * @param groups_count Group addresses count 80 * 81 * @return Zero on success or (negative) error code otherwise. 82 */ 83 int bt_test_mesh_lpn_group_remove(u16_t *groups, size_t groups_count); 84 85 /** Clear replay protection list cache. 86 * 87 * @return Zero on success or (negative) error code otherwise. 88 */ 89 int bt_test_mesh_rpl_clear(void); 90 91 /** 92 * @} 93 */ 94 95 #ifdef __cplusplus 96 } 97 #endif 98 99 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ */ 100