Loading...
Searching...
No Matches
bt_i.h
1#pragma once
2
3#include "bt.h"
4
5#include <furi.h>
6#include <furi_hal.h>
7#include <api_lock.h>
8
9#include <gui/gui.h>
10#include <gui/view_port.h>
11#include <gui/view.h>
12
13#include <dialogs/dialogs.h>
14#include <power/power_service/power.h>
15#include <rpc/rpc.h>
16#include <notification/notification.h>
17#include <storage/storage.h>
18
19#include <bt/bt_settings.h>
20#include <bt/bt_service/bt_keys_storage.h>
21
22#include "bt_keys_filename.h"
23
24#define BT_KEYS_STORAGE_PATH INT_PATH(BT_KEYS_STORAGE_FILE_NAME)
25
26typedef enum {
27 BtMessageTypeUpdateStatus,
28 BtMessageTypeUpdateBatteryLevel,
29 BtMessageTypeUpdatePowerState,
30 BtMessageTypePinCodeShow,
31 BtMessageTypeKeysStorageUpdated,
32 BtMessageTypeSetProfile,
33 BtMessageTypeDisconnect,
34 BtMessageTypeForgetBondedDevices,
35 BtMessageTypeGetSettings,
36 BtMessageTypeSetSettings,
37 BtMessageTypeReloadKeysSettings,
38} BtMessageType;
39
40typedef struct {
41 uint8_t* start_address;
42 uint16_t size;
44
45typedef union {
46 uint32_t pin_code;
47 uint8_t battery_level;
48 bool power_state_charging;
49 struct {
50 const FuriHalBleProfileTemplate* template;
51 FuriHalBleProfileParams params;
52 } profile;
53 FuriHalBleProfileParams profile_params;
54 BtKeyStorageUpdateData key_storage_data;
55 BtSettings* settings;
56 const BtSettings* csettings;
58
59typedef struct {
60 FuriApiLock lock;
61 BtMessageType type;
62 BtMessageData data;
63 bool* result;
64 FuriHalBleProfileBase** profile_instance;
65} BtMessage;
66
67struct Bt {
68 uint8_t* bt_keys_addr_start;
69 uint16_t bt_keys_size;
70 uint16_t max_packet_size;
71 BtSettings bt_settings;
72 BtKeysStorage* keys_storage;
73 BtStatus status;
74 bool beacon_active;
75 FuriHalBleProfileBase* current_profile;
76 FuriMessageQueue* message_queue;
77 NotificationApp* notification;
78 Gui* gui;
79 ViewPort* statusbar_view_port;
80 ViewPort* pin_code_view_port;
81 uint32_t pin_code;
82 DialogsApp* dialogs;
83 DialogMessage* dialog_message;
84 Power* power;
85 Rpc* rpc;
86 RpcSession* rpc_session;
87 FuriEventFlag* rpc_event;
88 FuriEventFlag* api_event;
89 BtStatusChangedCallback status_changed_cb;
90 void* status_changed_ctx;
91};
Furi HAL API.
GUI: main API.
APIs for working with storages, directories and files.
Definition bt_i.h:67
Definition bt_i.h:40
Definition bt_keys_storage.c:13
Definition bt_i.h:59
Definition bt_settings.h:9
Definition dialogs_module_message.c:12
Definition dialogs_i.h:10
Definition event_flag.c:14
Definition profile_interface.h:14
Definition profile_interface.h:28
Definition message_queue.c:16
Gui structure.
Definition gui_i.h:47
Definition notification_app.h:49
Definition power_i.h:20
Definition rpc.c:88
Definition rpc.c:67
Definition view_port_i.h:11
Definition bt_i.h:45
GUI: View API.
GUI: ViewPort API.