[FL-1220] BLE scan MAC addresses test (#939)

* bt: refactore cli commands
* bt: add radio stack control, add scan mac addresses
* bt: refactore with new furi-hal-bt API
* bt: f6 targer sync
* bt: code cleanup, update documentation
* Bt: new command names, proper radio stack handling

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2022-01-03 01:36:42 +03:00
committed by GitHub
parent a39002ce22
commit 7522b111c2
20 changed files with 741 additions and 356 deletions

View File

@@ -14,10 +14,19 @@
#include "furi-hal-bt-serial.h"
#define FURI_HAL_BT_STACK_VERSION_MAJOR (1)
#define FURI_HAL_BT_STACK_VERSION_MINOR (13)
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
FuriHalBtStackUnknown,
FuriHalBtStackHciLayer,
FuriHalBtStackLight,
} FuriHalBtStack;
typedef enum {
FuriHalBtProfileSerial,
FuriHalBtProfileHidKeyboard,
@@ -36,26 +45,38 @@ void furi_hal_bt_lock_core2();
/** Lock core2 state transition */
void furi_hal_bt_unlock_core2();
/** Start radio stack
*
* @return true on successfull radio stack start
*/
bool furi_hal_bt_start_radio_stack();
/** Get radio stack type
*
* @return FuriHalBtStack instance
*/
FuriHalBtStack furi_hal_bt_get_radio_stack();
/** Start BLE app
*
* @param profile FuriHalBtProfile instance
* @param event_cb BleEventCallback instance
* @param event_cb GapEventCallback instance
* @param context pointer to context
*
* @return true on success
*/
bool furi_hal_bt_start_app(FuriHalBtProfile profile, BleEventCallback event_cb, void* context);
bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb, void* context);
/** Change BLE app
* Restarts 2nd core
*
* @param profile FuriHalBtProfile instance
* @param event_cb BleEventCallback instance
* @param event_cb GapEventCallback instance
* @param context pointer to context
*
* @return true on success
*/
bool furi_hal_bt_change_app(FuriHalBtProfile profile, BleEventCallback event_cb, void* context);
bool furi_hal_bt_change_app(FuriHalBtProfile profile, GapEventCallback event_cb, void* context);
/** Update battery level
*
@@ -71,12 +92,6 @@ void furi_hal_bt_start_advertising();
*/
void furi_hal_bt_stop_advertising();
/** Returns true if BLE is advertising
*
* @return true if BLE advertising
*/
bool furi_hal_bt_is_active();
/** Get BT/BLE system component state
*
* @param[in] buffer string_t buffer to write to
@@ -167,6 +182,17 @@ float furi_hal_bt_get_rssi();
*/
uint32_t furi_hal_bt_get_transmitted_packets();
/** Start MAC addresses scan
* @note Works only with HciLayer 2nd core firmware
*
* @param callback GapScanCallback instance
* @param context pointer to context
*/
bool furi_hal_bt_start_scan(GapScanCallback callback, void* context);
/** Stop MAC addresses scan */
void furi_hal_bt_stop_scan();
#ifdef __cplusplus
}
#endif