Flipper Zero Firmware
Loading...
Searching...
No Matches
furi_hal_bt.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <furi.h>
9#include <stdbool.h>
10#include <gap.h>
11#include <extra_beacon.h>
12#include <furi_ble/profile_interface.h>
13#include <ble_glue.h>
14#include <ble_app.h>
15#include <stdint.h>
16
17#define FURI_HAL_BT_STACK_VERSION_MAJOR (1)
18#define FURI_HAL_BT_STACK_VERSION_MINOR (12)
19#define FURI_HAL_BT_C2_START_TIMEOUT (1000)
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25typedef enum {
26 FuriHalBtStackUnknown,
27 FuriHalBtStackLight,
28 FuriHalBtStackFull,
29} FuriHalBtStack;
30
33void furi_hal_bt_init(void);
34
36void furi_hal_bt_lock_core2(void);
37
40
46
51FuriHalBtStack furi_hal_bt_get_radio_stack(void);
52
58
64
73 FuriHalBleProfileBase* profile,
74 const FuriHalBleProfileTemplate* profile_template);
75
86 const FuriHalBleProfileTemplate* profile_template,
87 FuriHalBleProfileParams params,
88 GapEventCallback event_cb,
89 void* context);
90
95void furi_hal_bt_reinit(void);
96
108 const FuriHalBleProfileTemplate* profile_template,
109 FuriHalBleProfileParams profile_params,
110 GapEventCallback event_cb,
111 void* context);
112
117void furi_hal_bt_update_battery_level(uint8_t battery_level);
118
120void furi_hal_bt_update_power_state(bool charging);
121
126bool furi_hal_bt_is_active(void);
127
131
135
141
146bool furi_hal_bt_is_alive(void);
147
153void furi_hal_bt_get_key_storage_buff(uint8_t** key_buff_addr, uint16_t* key_buff_size);
154
159
164
170
177 BleGlueKeyStorageChangedCallback callback,
178 void* context);
179
185void furi_hal_bt_start_tone_tx(uint8_t channel, uint8_t power);
186
189void furi_hal_bt_stop_tone_tx(void);
190
197void furi_hal_bt_start_packet_tx(uint8_t channel, uint8_t pattern, uint8_t datarate);
198
203uint16_t furi_hal_bt_stop_packet_test(void);
204
210void furi_hal_bt_start_packet_rx(uint8_t channel, uint8_t datarate);
211
216void furi_hal_bt_start_rx(uint8_t channel);
217
220void furi_hal_bt_stop_rx(void);
221
226float furi_hal_bt_get_rssi(void);
227
233
238bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode);
239
251bool furi_hal_bt_extra_beacon_set_data(const uint8_t* data, uint8_t len);
252
259uint8_t furi_hal_bt_extra_beacon_get_data(uint8_t* data);
260
268
276
282
288
294
295#ifdef __cplusplus
296}
297#endif
bool furi_hal_bt_extra_beacon_set_data(const uint8_t *data, uint8_t len)
Extra BLE beacon API.
Definition furi_hal_bt.c:412
void furi_hal_bt_start_packet_tx(uint8_t channel, uint8_t pattern, uint8_t datarate)
Start sending ble packets at a given frequency and datarate.
Definition furi_hal_bt.c:345
void furi_hal_bt_update_power_state(bool charging)
Update battery power state.
Definition furi_hal_bt.c:270
bool furi_hal_bt_is_active(void)
Checks if BLE state is active.
Definition furi_hal_bt.c:247
void furi_hal_bt_nvm_sram_sem_acquire(void)
Get SRAM2 hardware semaphore.
Definition furi_hal_bt.c:285
float furi_hal_bt_get_rssi(void)
Get RSSI.
Definition furi_hal_bt.c:363
bool furi_hal_bt_extra_beacon_stop(void)
Stop extra beacon.
Definition furi_hal_bt.c:432
void furi_hal_bt_start_advertising(void)
Start advertising.
Definition furi_hal_bt.c:251
void furi_hal_bt_lock_core2(void)
Lock core2 state transition.
Definition furi_hal_bt.c:59
void furi_hal_bt_stop_rx(void)
Stop RF listenning.
Definition furi_hal_bt.c:393
FURI_WARN_UNUSED FuriHalBleProfileBase * furi_hal_bt_change_app(const FuriHalBleProfileTemplate *profile_template, FuriHalBleProfileParams profile_params, GapEventCallback event_cb, void *context)
Change BLE app Restarts 2nd core.
Definition furi_hal_bt.c:236
uint8_t furi_hal_bt_extra_beacon_get_data(uint8_t *data)
Get last configured extra beacon data.
Definition furi_hal_bt.c:416
const GapExtraBeaconConfig * furi_hal_bt_extra_beacon_get_config(void)
Get last configured extra beacon config.
Definition furi_hal_bt.c:424
void furi_hal_bt_unlock_core2(void)
Lock core2 state transition.
Definition furi_hal_bt.c:64
void furi_hal_bt_reinit(void)
Reinitialize core2.
Definition furi_hal_bt.c:200
bool furi_hal_bt_is_gatt_gap_supported(void)
Check if radio stack supports BLE GAT/GAP.
Definition furi_hal_bt.c:136
bool furi_hal_bt_clear_white_list(void)
Clear key storage.
Definition furi_hal_bt.c:295
bool furi_hal_bt_is_alive(void)
Get BT/BLE system component state.
Definition furi_hal_bt.c:332
void furi_hal_bt_get_key_storage_buff(uint8_t **key_buff_addr, uint16_t *key_buff_size)
Get key storage buffer address and size.
Definition furi_hal_bt.c:274
void furi_hal_bt_start_rx(uint8_t channel)
Set up the RF to listen to a given RF channel.
Definition furi_hal_bt.c:359
void furi_hal_bt_start_packet_rx(uint8_t channel, uint8_t datarate)
Start receiving packets.
Definition furi_hal_bt.c:349
void furi_hal_bt_start_tone_tx(uint8_t channel, uint8_t power)
Start ble tone tx at given channel and power.
Definition furi_hal_bt.c:336
bool furi_hal_bt_extra_beacon_is_active(void)
Check if extra beacon is active.
Definition furi_hal_bt.c:436
void furi_hal_bt_init(void)
Initialize.
Definition furi_hal_bt.c:39
FURI_WARN_UNUSED FuriHalBleProfileBase * furi_hal_bt_start_app(const FuriHalBleProfileTemplate *profile_template, FuriHalBleProfileParams params, GapEventCallback event_cb, void *context)
Start BLE app.
Definition furi_hal_bt.c:165
void furi_hal_bt_nvm_sram_sem_release(void)
Release SRAM2 hardware semaphore.
Definition furi_hal_bt.c:291
void furi_hal_bt_stop_tone_tx(void)
Stop ble tone tx.
Definition furi_hal_bt.c:341
void furi_hal_bt_dump_state(FuriString *buffer)
Get BT/BLE system component state.
Definition furi_hal_bt.c:305
bool furi_hal_bt_is_testing_supported(void)
Check if radio stack supports testing.
Definition furi_hal_bt.c:144
bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode)
Check & switch C2 to given mode.
Definition furi_hal_bt.c:397
void furi_hal_bt_set_key_storage_change_callback(BleGlueKeyStorageChangedCallback callback, void *context)
Set key storage change callback.
Definition furi_hal_bt.c:278
bool furi_hal_bt_check_profile_type(FuriHalBleProfileBase *profile, const FuriHalBleProfileTemplate *profile_template)
Check if particular instance of profile belongs to given type.
Definition furi_hal_bt.c:155
bool furi_hal_bt_start_radio_stack(void)
Start radio stack.
Definition furi_hal_bt.c:89
uint32_t furi_hal_bt_get_transmitted_packets(void)
Get number of transmitted packets.
Definition furi_hal_bt.c:387
bool furi_hal_bt_extra_beacon_set_config(const GapExtraBeaconConfig *config)
Configure extra beacon.
Definition furi_hal_bt.c:420
void furi_hal_bt_update_battery_level(uint8_t battery_level)
Update battery level.
Definition furi_hal_bt.c:266
bool furi_hal_bt_extra_beacon_start(void)
Start extra beacon.
Definition furi_hal_bt.c:428
FuriHalBtStack furi_hal_bt_get_radio_stack(void)
Get radio stack type.
Definition furi_hal_bt.c:132
uint16_t furi_hal_bt_stop_packet_test(void)
Stop sending ble packets.
Definition furi_hal_bt.c:353
void furi_hal_bt_stop_advertising(void)
Stop advertising.
Definition furi_hal_bt.c:257
Definition profile_interface.h:14
Definition profile_interface.h:28
Definition string.c:4
Definition extra_beacon.h:65