2021-09-02 02:22:40 +03: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 19:28:02 +03:00
|
|
|
#include <dialogs/dialogs.h>
|
|
|
|
#include <power/power_service/power.h>
|
2021-10-12 19:41:42 +03:00
|
|
|
#include <applications/rpc/rpc.h>
|
2021-09-13 14:25:37 +03:00
|
|
|
|
2021-09-02 02:22:40 +03:00
|
|
|
#include "../bt_settings.h"
|
|
|
|
|
2021-10-21 19:27:58 +03:00
|
|
|
typedef enum {
|
|
|
|
BtStatusOff,
|
|
|
|
BtStatusAdvertising,
|
|
|
|
BtStatusConnected,
|
|
|
|
} BtStatus;
|
|
|
|
|
2021-09-02 02:22:40 +03:00
|
|
|
typedef enum {
|
|
|
|
BtMessageTypeUpdateStatusbar,
|
2021-09-10 00:11:32 +03:00
|
|
|
BtMessageTypeUpdateBatteryLevel,
|
2021-09-13 14:25:37 +03:00
|
|
|
BtMessageTypePinCodeShow,
|
2021-09-02 02:22:40 +03:00
|
|
|
} BtMessageType;
|
|
|
|
|
2021-09-10 00:11:32 +03:00
|
|
|
typedef union {
|
2021-09-13 14:25:37 +03:00
|
|
|
uint32_t pin_code;
|
2021-09-10 00:11:32 +03:00
|
|
|
uint8_t battery_level;
|
|
|
|
} BtMessageData;
|
|
|
|
|
2021-09-02 02:22:40 +03:00
|
|
|
typedef struct {
|
|
|
|
BtMessageType type;
|
2021-09-10 00:11:32 +03:00
|
|
|
BtMessageData data;
|
2021-09-02 02:22:40 +03:00
|
|
|
} BtMessage;
|
|
|
|
|
|
|
|
struct Bt {
|
|
|
|
BtSettings bt_settings;
|
2021-10-21 19:27:58 +03:00
|
|
|
BtStatus status;
|
2021-09-02 02:22:40 +03:00
|
|
|
osMessageQueueId_t message_queue;
|
|
|
|
Gui* gui;
|
|
|
|
ViewPort* statusbar_view_port;
|
2021-09-13 14:25:37 +03:00
|
|
|
DialogsApp* dialogs;
|
|
|
|
DialogMessage* dialog_message;
|
2021-09-24 19:28:02 +03:00
|
|
|
Power* power;
|
2021-10-12 19:41:42 +03:00
|
|
|
Rpc* rpc;
|
|
|
|
RpcSession* rpc_session;
|
|
|
|
osSemaphoreId_t rpc_sem;
|
2021-09-02 02:22:40 +03:00
|
|
|
};
|