[FL-1976] BLE HID (#852)

* ble: prototype ble hid
* ble: add HID service and characteristics
* debug tools: add ble keyboard app
* ble: change appearance
* ble: working keyboard
* bt: introduce furi-hal-bt-hid
* bt: restart hid service on each keyboard app enter
* bt: introduce switch profile
* bt: add profile to ble glue
* bt: working profile switch
* bt: introduce bt serial profile, rework API
* bt: rewotk HID profile
* bt: rework gap with profile configuration
* bt: move change profile routine to furi hal bt
* bt: change switch profile API to blocking
* bt: move battery update to furi hal bt
* bt: cleanup
* bt: add support for f6 target
* bt: update documentation
* bt: clean up code
* bt: remove NO OUTPUT setting
* bt: set numeric comparison pairing in BLE HID
* bt: support f6 target
* bt: set mac address in profile configuration
* bt: set advertise name in profile config
* bt: rework with furi thread
* bt: support f6 target
* bt: clear hci command buffer on core2 restart
* bt: correct thread kill sequence
* bt: fix freertos functions calls
* bt: add some enterprise delays fo correct memory free
* bt: code cleanup
* bt: change terminate -> stop
* bt: fix memory leakage

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-12-08 14:28:01 +03:00
committed by GitHub
parent bb96509ed1
commit 7170864fe4
46 changed files with 2288 additions and 439 deletions

View File

@@ -3,6 +3,10 @@
#include <stdint.h>
#include <stdbool.h>
#include <furi-hal-version.h>
#define GAP_MAC_ADDR_SIZE (6)
#ifdef __cplusplus
extern "C" {
#endif
@@ -13,6 +17,7 @@ typedef enum {
BleEventTypeStartAdvertising,
BleEventTypeStopAdvertising,
BleEventTypePinCodeShow,
BleEventTypePinCodeVerify,
BleEventTypeUpdateMTU,
} BleEventType;
@@ -26,16 +31,31 @@ typedef struct {
BleEventData data;
} BleEvent;
typedef void(*BleEventCallback) (BleEvent event, void* context);
typedef bool(*BleEventCallback) (BleEvent event, void* context);
typedef enum {
GapStateIdle,
GapStateStartingAdv,
GapStateAdvFast,
GapStateAdvLowPower,
GapStateConnected,
} GapState;
bool gap_init(BleEventCallback on_event_cb, void* context);
typedef enum {
GapPairingPinCodeShow,
GapPairingPinCodeVerifyYesNo,
} GapPairing;
typedef struct {
uint16_t adv_service_uuid;
uint16_t appearance_char;
bool bonding_mode;
GapPairing pairing_method;
uint8_t mac_address[GAP_MAC_ADDR_SIZE];
char adv_name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH];
} GapConfig;
bool gap_init(GapConfig* config, BleEventCallback on_event_cb, void* context);
void gap_start_advertising();
@@ -43,6 +63,8 @@ void gap_stop_advertising();
GapState gap_get_state();
void gap_thread_stop();
#ifdef __cplusplus
}
#endif