Flipper Zero Firmware
Loading...
Searching...
No Matches
extra_beacon.h
1#pragma once
2
3#include <stdbool.h>
4#include <stdint.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10/*
11 * Additinal non-connetable beacon API.
12 * Not to be used directly, but through furi_hal_bt_extra_beacon_* APIs.
13 */
14
15#define EXTRA_BEACON_MAX_DATA_SIZE (31)
16#define EXTRA_BEACON_MAC_ADDR_SIZE (6)
17
18typedef enum {
19 GapAdvChannelMap37 = 0b001,
20 GapAdvChannelMap38 = 0b010,
21 GapAdvChannelMap39 = 0b100,
22 GapAdvChannelMapAll = 0b111,
23} GapAdvChannelMap;
24
25typedef enum {
26 GapAdvPowerLevel_Neg40dBm = 0x00,
27 GapAdvPowerLevel_Neg20_85dBm = 0x01,
28 GapAdvPowerLevel_Neg19_75dBm = 0x02,
29 GapAdvPowerLevel_Neg18_85dBm = 0x03,
30 GapAdvPowerLevel_Neg17_6dBm = 0x04,
31 GapAdvPowerLevel_Neg16_5dBm = 0x05,
32 GapAdvPowerLevel_Neg15_25dBm = 0x06,
33 GapAdvPowerLevel_Neg14_1dBm = 0x07,
34 GapAdvPowerLevel_Neg13_15dBm = 0x08,
35 GapAdvPowerLevel_Neg12_05dBm = 0x09,
36 GapAdvPowerLevel_Neg10_9dBm = 0x0A,
37 GapAdvPowerLevel_Neg9_9dBm = 0x0B,
38 GapAdvPowerLevel_Neg8_85dBm = 0x0C,
39 GapAdvPowerLevel_Neg7_8dBm = 0x0D,
40 GapAdvPowerLevel_Neg6_9dBm = 0x0E,
41 GapAdvPowerLevel_Neg5_9dBm = 0x0F,
42 GapAdvPowerLevel_Neg4_95dBm = 0x10,
43 GapAdvPowerLevel_Neg4dBm = 0x11,
44 GapAdvPowerLevel_Neg3_15dBm = 0x12,
45 GapAdvPowerLevel_Neg2_45dBm = 0x13,
46 GapAdvPowerLevel_Neg1_8dBm = 0x14,
47 GapAdvPowerLevel_Neg1_3dBm = 0x15,
48 GapAdvPowerLevel_Neg0_85dBm = 0x16,
49 GapAdvPowerLevel_Neg0_5dBm = 0x17,
50 GapAdvPowerLevel_Neg0_15dBm = 0x18,
51 GapAdvPowerLevel_0dBm = 0x19,
52 GapAdvPowerLevel_1dBm = 0x1A,
53 GapAdvPowerLevel_2dBm = 0x1B,
54 GapAdvPowerLevel_3dBm = 0x1C,
55 GapAdvPowerLevel_4dBm = 0x1D,
56 GapAdvPowerLevel_5dBm = 0x1E,
57 GapAdvPowerLevel_6dBm = 0x1F,
58} GapAdvPowerLevelInd;
59
60typedef enum {
61 GapAddressTypePublic = 0,
62 GapAddressTypeRandom = 1,
63} GapAddressType;
64
65typedef struct {
66 uint16_t min_adv_interval_ms, max_adv_interval_ms;
67 GapAdvChannelMap adv_channel_map;
68 GapAdvPowerLevelInd adv_power_level;
69 GapAddressType address_type;
70 uint8_t address[EXTRA_BEACON_MAC_ADDR_SIZE];
72
73typedef enum {
74 GapExtraBeaconStateUndefined = 0,
75 GapExtraBeaconStateStopped,
76 GapExtraBeaconStateStarted,
77} GapExtraBeaconState;
78
79void gap_extra_beacon_init(void);
80
81GapExtraBeaconState gap_extra_beacon_get_state(void);
82
83bool gap_extra_beacon_start(void);
84
85bool gap_extra_beacon_stop(void);
86
87bool gap_extra_beacon_set_config(const GapExtraBeaconConfig* config);
88
89const GapExtraBeaconConfig* gap_extra_beacon_get_config(void);
90
91bool gap_extra_beacon_set_data(const uint8_t* data, uint8_t length);
92
93// Fill "data" with last configured extra beacon data and return its length
94uint8_t gap_extra_beacon_get_data(uint8_t* data);
95
96#ifdef __cplusplus
97}
98#endif
Definition extra_beacon.h:65