mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 06:50:21 +00:00
60a9d7e6cf
* ble: profile rework, initial * apps: hid: fix for pairing cleanup * app: hid: select transport based on #define * fixing PVS warnings * ble: serial service: fixed uid naming * bt service: on-demand dialog init; ble profiles: docs; battery svc: proper update * Added shci_cmd_resp_wait/shci_cmd_resp_release impl with semaphore * app: hid: separated transport code * ble: fixed service init order for serial svc; moved hardfault check to ble_glue * cli: ps: added thread prio to output, fixed heap display * ble_glue: naming changes; separate thread for event processing; * furi: added runtime stats; cli: added cpu% to `ps` * cli: fixed thread time calculation * furi: added getter for thread priority * fixing pvs warnings * hid profile: fixed naming * more naming fixes * hal: ble init small cleanup * cleanup & draft beacon api * f18: api sync * apps: moved example_custom_font from debug to examples * BLE extra beacon demo app * naming fix * UI fixes for demo app (wip) * desktop, ble svc: added statusbar icon for beacon * minor cleanup * Minor cleanup & naming fixes * api sync * Removed stale header * hal: added FURI_BLE_EXTRA_LOG for extra logging; comments & code cleanup * naming & macro fixes * quick fixes from review * Eliminated stock svc_ctl * cli: ps: removed runtime stats * minor include fixes * (void) * naming fixes * More naming fixes * fbt: always build all libs * fbt: explicitly globbing libs; dist: logging SDK path * scripts: fixed lib path precedence * hal: bt: profiles: naming changes, support for passing params to a profile; include cleanup * ble: hid: added parameter processing for profile template * api sync * BLE HID: long name trim * Removed unused check * desktop: updated beacon status icon; ble: hid: cleaner device name management * desktop: updated status icon Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: nminaylov <nm29719@gmail.com>
86 lines
2 KiB
C
86 lines
2 KiB
C
#pragma once
|
|
|
|
#include "bt.h"
|
|
|
|
#include <furi.h>
|
|
#include <furi_hal.h>
|
|
#include <api_lock.h>
|
|
|
|
#include <gui/gui.h>
|
|
#include <gui/view_port.h>
|
|
#include <gui/view.h>
|
|
|
|
#include <dialogs/dialogs.h>
|
|
#include <power/power_service/power.h>
|
|
#include <rpc/rpc.h>
|
|
#include <notification/notification.h>
|
|
#include <storage/storage.h>
|
|
|
|
#include <bt/bt_settings.h>
|
|
#include <bt/bt_service/bt_keys_storage.h>
|
|
|
|
#include "bt_keys_filename.h"
|
|
|
|
#define BT_KEYS_STORAGE_PATH INT_PATH(BT_KEYS_STORAGE_FILE_NAME)
|
|
|
|
typedef enum {
|
|
BtMessageTypeUpdateStatus,
|
|
BtMessageTypeUpdateBatteryLevel,
|
|
BtMessageTypeUpdatePowerState,
|
|
BtMessageTypePinCodeShow,
|
|
BtMessageTypeKeysStorageUpdated,
|
|
BtMessageTypeSetProfile,
|
|
BtMessageTypeDisconnect,
|
|
BtMessageTypeForgetBondedDevices,
|
|
} BtMessageType;
|
|
|
|
typedef struct {
|
|
uint8_t* start_address;
|
|
uint16_t size;
|
|
} BtKeyStorageUpdateData;
|
|
|
|
typedef union {
|
|
uint32_t pin_code;
|
|
uint8_t battery_level;
|
|
bool power_state_charging;
|
|
struct {
|
|
const FuriHalBleProfileTemplate* template;
|
|
FuriHalBleProfileParams params;
|
|
} profile;
|
|
FuriHalBleProfileParams profile_params;
|
|
BtKeyStorageUpdateData key_storage_data;
|
|
} BtMessageData;
|
|
|
|
typedef struct {
|
|
FuriApiLock lock;
|
|
BtMessageType type;
|
|
BtMessageData data;
|
|
bool* result;
|
|
FuriHalBleProfileBase** profile_instance;
|
|
} BtMessage;
|
|
|
|
struct Bt {
|
|
uint8_t* bt_keys_addr_start;
|
|
uint16_t bt_keys_size;
|
|
uint16_t max_packet_size;
|
|
BtSettings bt_settings;
|
|
BtKeysStorage* keys_storage;
|
|
BtStatus status;
|
|
bool beacon_active;
|
|
FuriHalBleProfileBase* current_profile;
|
|
FuriMessageQueue* message_queue;
|
|
NotificationApp* notification;
|
|
Gui* gui;
|
|
ViewPort* statusbar_view_port;
|
|
ViewPort* pin_code_view_port;
|
|
uint32_t pin_code;
|
|
DialogsApp* dialogs;
|
|
DialogMessage* dialog_message;
|
|
Power* power;
|
|
Rpc* rpc;
|
|
RpcSession* rpc_session;
|
|
FuriEventFlag* rpc_event;
|
|
FuriEventFlag* api_event;
|
|
BtStatusChangedCallback status_changed_cb;
|
|
void* status_changed_ctx;
|
|
};
|