2021-09-01 23:22:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "bt.h"
|
|
|
|
|
|
|
|
#include <furi.h>
|
|
|
|
#include <furi-hal.h>
|
|
|
|
|
|
|
|
#include <gui/gui.h>
|
|
|
|
#include <gui/view_port.h>
|
|
|
|
#include <gui/view.h>
|
|
|
|
|
2021-09-24 16:28:02 +00:00
|
|
|
#include <dialogs/dialogs.h>
|
|
|
|
#include <power/power_service/power.h>
|
2021-10-12 16:41:42 +00:00
|
|
|
#include <applications/rpc/rpc.h>
|
2021-12-15 17:39:06 +00:00
|
|
|
#include <applications/notification/notification.h>
|
2021-09-13 11:25:37 +00:00
|
|
|
|
2021-09-01 23:22:40 +00:00
|
|
|
#include "../bt_settings.h"
|
|
|
|
|
2021-12-08 11:28:01 +00:00
|
|
|
#define BT_API_UNLOCK_EVENT (1UL << 0)
|
|
|
|
|
2021-09-01 23:22:40 +00:00
|
|
|
typedef enum {
|
|
|
|
BtMessageTypeUpdateStatusbar,
|
2021-09-09 21:11:32 +00:00
|
|
|
BtMessageTypeUpdateBatteryLevel,
|
2021-09-13 11:25:37 +00:00
|
|
|
BtMessageTypePinCodeShow,
|
2021-11-04 17:26:41 +00:00
|
|
|
BtMessageTypeKeysStorageUpdated,
|
2021-12-08 11:28:01 +00:00
|
|
|
BtMessageTypeSetProfile,
|
2021-09-01 23:22:40 +00:00
|
|
|
} BtMessageType;
|
|
|
|
|
2021-09-09 21:11:32 +00:00
|
|
|
typedef union {
|
2021-09-13 11:25:37 +00:00
|
|
|
uint32_t pin_code;
|
2021-09-09 21:11:32 +00:00
|
|
|
uint8_t battery_level;
|
2021-12-08 11:28:01 +00:00
|
|
|
BtProfile profile;
|
2021-09-09 21:11:32 +00:00
|
|
|
} BtMessageData;
|
|
|
|
|
2021-09-01 23:22:40 +00:00
|
|
|
typedef struct {
|
|
|
|
BtMessageType type;
|
2021-09-09 21:11:32 +00:00
|
|
|
BtMessageData data;
|
2021-12-08 11:28:01 +00:00
|
|
|
bool* result;
|
2021-09-01 23:22:40 +00:00
|
|
|
} BtMessage;
|
|
|
|
|
|
|
|
struct Bt {
|
2021-11-04 17:26:41 +00:00
|
|
|
uint8_t* bt_keys_addr_start;
|
|
|
|
uint16_t bt_keys_size;
|
2021-11-21 14:47:54 +00:00
|
|
|
uint16_t max_packet_size;
|
2021-09-01 23:22:40 +00:00
|
|
|
BtSettings bt_settings;
|
2021-10-21 16:27:58 +00:00
|
|
|
BtStatus status;
|
2021-12-08 11:28:01 +00:00
|
|
|
BtProfile profile;
|
2021-09-01 23:22:40 +00:00
|
|
|
osMessageQueueId_t message_queue;
|
2021-12-15 17:39:06 +00:00
|
|
|
NotificationApp* notification;
|
2021-09-01 23:22:40 +00:00
|
|
|
Gui* gui;
|
|
|
|
ViewPort* statusbar_view_port;
|
2021-09-13 11:25:37 +00:00
|
|
|
DialogsApp* dialogs;
|
|
|
|
DialogMessage* dialog_message;
|
2021-09-24 16:28:02 +00:00
|
|
|
Power* power;
|
2021-10-12 16:41:42 +00:00
|
|
|
Rpc* rpc;
|
|
|
|
RpcSession* rpc_session;
|
2021-11-17 18:15:58 +00:00
|
|
|
osEventFlagsId_t rpc_event;
|
2021-12-08 11:28:01 +00:00
|
|
|
osEventFlagsId_t api_event;
|
2021-12-15 17:39:06 +00:00
|
|
|
BtStatusChangedCallback status_changed_cb;
|
|
|
|
void* status_changed_ctx;
|
2021-09-01 23:22:40 +00:00
|
|
|
};
|