2017-12-18 11:55:33 +01:00
|
|
|
/**
|
|
|
|
* @file testing.h
|
|
|
|
* @brief Internal API for Bluetooth testing.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2018-09-14 19:43:44 +02:00
|
|
|
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_
|
|
|
|
#define ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_
|
2017-12-18 11:55:33 +01:00
|
|
|
|
2023-03-23 17:02:42 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2018-09-18 12:40:43 +02:00
|
|
|
#if defined(CONFIG_BT_MESH)
|
2022-05-06 10:30:42 +02:00
|
|
|
#include <zephyr/bluetooth/mesh.h>
|
2018-09-18 12:40:43 +02:00
|
|
|
#endif /* CONFIG_BT_MESH */
|
|
|
|
|
2017-12-18 11:55:33 +01:00
|
|
|
/**
|
|
|
|
* @brief Bluetooth testing
|
|
|
|
* @defgroup bt_test_cb Bluetooth testing callbacks
|
|
|
|
* @ingroup bluetooth
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @brief Bluetooth Testing callbacks structure.
|
|
|
|
*
|
|
|
|
* Callback structure to be used for Bluetooth testing purposes.
|
|
|
|
* Allows access to Bluetooth stack internals, not exposed by public API.
|
|
|
|
*/
|
|
|
|
struct bt_test_cb {
|
2018-09-18 12:40:43 +02:00
|
|
|
#if defined(CONFIG_BT_MESH)
|
2020-05-27 18:26:57 +02:00
|
|
|
void (*mesh_net_recv)(uint8_t ttl, uint8_t ctl, uint16_t src, uint16_t dst,
|
2017-12-18 11:55:33 +01:00
|
|
|
const void *payload, size_t payload_len);
|
2020-11-16 12:01:05 +01:00
|
|
|
void (*mesh_model_recv)(uint16_t src, uint16_t dst, const void *payload,
|
|
|
|
size_t payload_len);
|
2023-11-14 05:00:30 +01:00
|
|
|
void (*mesh_model_bound)(uint16_t addr, const struct bt_mesh_model *model,
|
2020-05-27 18:26:57 +02:00
|
|
|
uint16_t key_idx);
|
2023-11-14 05:00:30 +01:00
|
|
|
void (*mesh_model_unbound)(uint16_t addr, const struct bt_mesh_model *model,
|
2020-05-27 18:26:57 +02:00
|
|
|
uint16_t key_idx);
|
|
|
|
void (*mesh_prov_invalid_bearer)(uint8_t opcode);
|
2018-01-02 11:26:08 +01:00
|
|
|
void (*mesh_trans_incomp_timer_exp)(void);
|
2018-09-18 12:40:43 +02:00
|
|
|
#endif /* CONFIG_BT_MESH */
|
2017-12-18 11:55:33 +01:00
|
|
|
|
|
|
|
sys_snode_t node;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Register callbacks for Bluetooth testing purposes
|
|
|
|
*
|
|
|
|
* @param cb bt_test_cb callback structure
|
2024-06-12 13:02:13 +02:00
|
|
|
*
|
|
|
|
* @retval 0 Success.
|
|
|
|
* @retval -EEXIST if @p cb was already registered.
|
2017-12-18 11:55:33 +01:00
|
|
|
*/
|
2024-06-12 13:02:13 +02:00
|
|
|
int bt_test_cb_register(struct bt_test_cb *cb);
|
2017-12-18 11:55:33 +01:00
|
|
|
|
|
|
|
/** Unregister callbacks for Bluetooth testing purposes
|
|
|
|
*
|
|
|
|
* @param cb bt_test_cb callback structure
|
|
|
|
*/
|
|
|
|
void bt_test_cb_unregister(struct bt_test_cb *cb);
|
|
|
|
|
2017-12-29 12:52:10 +01:00
|
|
|
/** Send Friend Subscription List Add message.
|
|
|
|
*
|
|
|
|
* Used by Low Power node to send the group address for which messages are to
|
|
|
|
* be stored by Friend node.
|
|
|
|
*
|
|
|
|
* @param group Group address
|
|
|
|
*
|
|
|
|
* @return Zero on success or (negative) error code otherwise.
|
|
|
|
*/
|
2020-05-27 18:26:57 +02:00
|
|
|
int bt_test_mesh_lpn_group_add(uint16_t group);
|
2017-12-29 12:52:10 +01:00
|
|
|
|
|
|
|
/** Send Friend Subscription List Remove message.
|
|
|
|
*
|
|
|
|
* Used by Low Power node to remove the group addresses from Friend node
|
|
|
|
* subscription list. Messages sent to those addresses will not be stored
|
|
|
|
* by Friend node.
|
|
|
|
*
|
|
|
|
* @param groups Group addresses
|
|
|
|
* @param groups_count Group addresses count
|
|
|
|
*
|
|
|
|
* @return Zero on success or (negative) error code otherwise.
|
|
|
|
*/
|
2020-05-27 18:26:57 +02:00
|
|
|
int bt_test_mesh_lpn_group_remove(uint16_t *groups, size_t groups_count);
|
2017-12-29 12:52:10 +01:00
|
|
|
|
2017-12-29 13:19:45 +01:00
|
|
|
/** Clear replay protection list cache.
|
|
|
|
*
|
|
|
|
* @return Zero on success or (negative) error code otherwise.
|
|
|
|
*/
|
|
|
|
int bt_test_mesh_rpl_clear(void);
|
|
|
|
|
2017-12-18 11:55:33 +01:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-14 19:43:44 +02:00
|
|
|
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ */
|