BT/BLE HAL API. More...
#include <furi.h>
#include <stdbool.h>
#include <gap.h>
#include <extra_beacon.h>
#include <furi_ble/profile_interface.h>
#include <ble_glue.h>
#include <ble_app.h>
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | FURI_HAL_BT_STACK_VERSION_MAJOR (1) |
#define | FURI_HAL_BT_STACK_VERSION_MINOR (12) |
#define | FURI_HAL_BT_C2_START_TIMEOUT (1000) |
Enumerations | |
enum | FuriHalBtStack { FuriHalBtStackUnknown , FuriHalBtStackLight , FuriHalBtStackFull } |
Functions | |
void | furi_hal_bt_init (void) |
Initialize. | |
void | furi_hal_bt_lock_core2 (void) |
Lock core2 state transition. | |
void | furi_hal_bt_unlock_core2 (void) |
Lock core2 state transition. | |
bool | furi_hal_bt_start_radio_stack (void) |
Start radio stack. | |
FuriHalBtStack | furi_hal_bt_get_radio_stack (void) |
Get radio stack type. | |
bool | furi_hal_bt_is_gatt_gap_supported (void) |
Check if radio stack supports BLE GAT/GAP. | |
bool | furi_hal_bt_is_testing_supported (void) |
Check if radio stack supports testing. | |
bool | furi_hal_bt_check_profile_type (FuriHalBleProfileBase *profile, const FuriHalBleProfileTemplate *profile_template) |
Check if particular instance of profile belongs to given type. | |
FURI_WARN_UNUSED FuriHalBleProfileBase * | furi_hal_bt_start_app (const FuriHalBleProfileTemplate *profile_template, FuriHalBleProfileParams params, GapEventCallback event_cb, void *context) |
Start BLE app. | |
void | furi_hal_bt_reinit (void) |
Reinitialize core2. | |
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. | |
void | furi_hal_bt_update_battery_level (uint8_t battery_level) |
Update battery level. | |
void | furi_hal_bt_update_power_state (bool charging) |
Update battery power state. | |
bool | furi_hal_bt_is_active (void) |
Checks if BLE state is active. | |
void | furi_hal_bt_start_advertising (void) |
Start advertising. | |
void | furi_hal_bt_stop_advertising (void) |
Stop advertising. | |
void | furi_hal_bt_dump_state (FuriString *buffer) |
Get BT/BLE system component state. | |
bool | furi_hal_bt_is_alive (void) |
Get BT/BLE system component state. | |
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. | |
void | furi_hal_bt_nvm_sram_sem_acquire (void) |
Get SRAM2 hardware semaphore. | |
void | furi_hal_bt_nvm_sram_sem_release (void) |
Release SRAM2 hardware semaphore. | |
bool | furi_hal_bt_clear_white_list (void) |
Clear key storage. | |
void | furi_hal_bt_set_key_storage_change_callback (BleGlueKeyStorageChangedCallback callback, void *context) |
Set key storage change callback. | |
void | furi_hal_bt_start_tone_tx (uint8_t channel, uint8_t power) |
Start ble tone tx at given channel and power. | |
void | furi_hal_bt_stop_tone_tx (void) |
Stop ble tone tx. | |
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. | |
uint16_t | furi_hal_bt_stop_packet_test (void) |
Stop sending ble packets. | |
void | furi_hal_bt_start_packet_rx (uint8_t channel, uint8_t datarate) |
Start receiving packets. | |
void | furi_hal_bt_start_rx (uint8_t channel) |
Set up the RF to listen to a given RF channel. | |
void | furi_hal_bt_stop_rx (void) |
Stop RF listenning. | |
float | furi_hal_bt_get_rssi (void) |
Get RSSI. | |
uint32_t | furi_hal_bt_get_transmitted_packets (void) |
Get number of transmitted packets. | |
bool | furi_hal_bt_ensure_c2_mode (BleGlueC2Mode mode) |
Check & switch C2 to given mode. | |
bool | furi_hal_bt_extra_beacon_set_data (const uint8_t *data, uint8_t len) |
Extra BLE beacon API. | |
uint8_t | furi_hal_bt_extra_beacon_get_data (uint8_t *data) |
Get last configured extra beacon data. | |
bool | furi_hal_bt_extra_beacon_set_config (const GapExtraBeaconConfig *config) |
Configure extra beacon. | |
bool | furi_hal_bt_extra_beacon_start (void) |
Start extra beacon. | |
bool | furi_hal_bt_extra_beacon_stop (void) |
Stop extra beacon. | |
bool | furi_hal_bt_extra_beacon_is_active (void) |
Check if extra beacon is active. | |
const GapExtraBeaconConfig * | furi_hal_bt_extra_beacon_get_config (void) |
Get last configured extra beacon config. | |
BT/BLE HAL API.
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.
profile_template | FuriHalBleProfileTemplate instance |
profile_params | Parameters to pass to the profile. Can be NULL |
event_cb | GapEventCallback instance |
context | pointer to context |
bool furi_hal_bt_check_profile_type | ( | FuriHalBleProfileBase * | profile, |
const FuriHalBleProfileTemplate * | profile_template ) |
Check if particular instance of profile belongs to given type.
profile | FuriHalBtProfile instance. If NULL, uses current profile |
profile_template | basic profile template to check against |
bool furi_hal_bt_clear_white_list | ( | void | ) |
Clear key storage.
void furi_hal_bt_dump_state | ( | FuriString * | buffer | ) |
Get BT/BLE system component state.
[in] | buffer | FuriString* buffer to write to |
bool furi_hal_bt_ensure_c2_mode | ( | BleGlueC2Mode | mode | ) |
Check & switch C2 to given mode.
[in] | mode | mode to switch into |
const GapExtraBeaconConfig * furi_hal_bt_extra_beacon_get_config | ( | void | ) |
Get last configured extra beacon config.
uint8_t furi_hal_bt_extra_beacon_get_data | ( | uint8_t * | data | ) |
Get last configured extra beacon data.
data | data buffer to write to. Must be at least EXTRA_BEACON_MAX_DATA_SIZE bytes long |
bool furi_hal_bt_extra_beacon_is_active | ( | void | ) |
Check if extra beacon is active.
bool furi_hal_bt_extra_beacon_set_config | ( | const GapExtraBeaconConfig * | config | ) |
Configure extra beacon.
[in] | config | extra beacon config: interval, power, address, etc. |
bool furi_hal_bt_extra_beacon_set_data | ( | const uint8_t * | data, |
uint8_t | len ) |
Extra BLE beacon API.
Set extra beacon data. Can be called in any state
[in] | data | data to set |
[in] | len | data length. Must be <= EXTRA_BEACON_MAX_DATA_SIZE |
bool furi_hal_bt_extra_beacon_start | ( | void | ) |
Start extra beacon.
Beacon must configured with furi_hal_bt_extra_beacon_set_config() and in stopped state before calling this function.
bool furi_hal_bt_extra_beacon_stop | ( | void | ) |
Stop extra beacon.
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.
key_buff_addr | pointer to store buffer address |
key_buff_size | pointer to store buffer size |
FuriHalBtStack furi_hal_bt_get_radio_stack | ( | void | ) |
Get radio stack type.
float furi_hal_bt_get_rssi | ( | void | ) |
Get RSSI.
uint32_t furi_hal_bt_get_transmitted_packets | ( | void | ) |
Get number of transmitted packets.
bool furi_hal_bt_is_active | ( | void | ) |
Checks if BLE state is active.
bool furi_hal_bt_is_alive | ( | void | ) |
Get BT/BLE system component state.
bool furi_hal_bt_is_gatt_gap_supported | ( | void | ) |
Check if radio stack supports BLE GAT/GAP.
bool furi_hal_bt_is_testing_supported | ( | void | ) |
Check if radio stack supports testing.
void furi_hal_bt_nvm_sram_sem_acquire | ( | void | ) |
Get SRAM2 hardware semaphore.
void furi_hal_bt_nvm_sram_sem_release | ( | void | ) |
Release SRAM2 hardware semaphore.
void furi_hal_bt_reinit | ( | void | ) |
Reinitialize core2.
Also can be used to prepare core2 for stop modes
void furi_hal_bt_set_key_storage_change_callback | ( | BleGlueKeyStorageChangedCallback | callback, |
void * | context ) |
Set key storage change callback.
callback | BleGlueKeyStorageChangedCallback instance |
context | pointer to context |
FURI_WARN_UNUSED FuriHalBleProfileBase * furi_hal_bt_start_app | ( | const FuriHalBleProfileTemplate * | profile_template, |
FuriHalBleProfileParams | params, | ||
GapEventCallback | event_cb, | ||
void * | context ) |
Start BLE app.
profile_template | FuriHalBleProfileTemplate instance |
params | Parameters to pass to the profile. Can be NULL |
event_cb | GapEventCallback instance |
context | pointer to context |
void furi_hal_bt_start_packet_rx | ( | uint8_t | channel, |
uint8_t | datarate ) |
Start receiving packets.
[in] | channel | RX channel |
[in] | datarate | Datarate |
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.
[in] | channel | The channel |
[in] | pattern | The pattern |
[in] | datarate | The datarate |
bool furi_hal_bt_start_radio_stack | ( | void | ) |
Start radio stack.
void furi_hal_bt_start_rx | ( | uint8_t | channel | ) |
Set up the RF to listen to a given RF channel.
[in] | channel | RX channel |
void furi_hal_bt_start_tone_tx | ( | uint8_t | channel, |
uint8_t | power ) |
Start ble tone tx at given channel and power.
[in] | channel | The channel |
[in] | power | The power |
uint16_t furi_hal_bt_stop_packet_test | ( | void | ) |
Stop sending ble packets.
void furi_hal_bt_update_battery_level | ( | uint8_t | battery_level | ) |
Update battery level.
battery_level | battery level |