mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-15 00:33:05 +03:00
7170864fe4
* 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>
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
#include "furi-hal-bt-serial.h"
|
|
#include "dev_info_service.h"
|
|
#include "battery_service.h"
|
|
#include "serial_service.h"
|
|
|
|
#include <furi.h>
|
|
|
|
void furi_hal_bt_serial_start() {
|
|
// Start device info
|
|
if(!dev_info_svc_is_started()) {
|
|
dev_info_svc_start();
|
|
}
|
|
// Start battery service
|
|
if(!battery_svc_is_started()) {
|
|
battery_svc_start();
|
|
}
|
|
// Start Serial service
|
|
if(!serial_svc_is_started()) {
|
|
serial_svc_start();
|
|
}
|
|
}
|
|
|
|
void furi_hal_bt_serial_set_event_callback(uint16_t buff_size, FuriHalBtSerialCallback callback, void* context) {
|
|
serial_svc_set_callbacks(buff_size, callback, context);
|
|
}
|
|
|
|
void furi_hal_bt_serial_notify_buffer_is_empty() {
|
|
serial_svc_notify_buffer_is_empty();
|
|
}
|
|
|
|
bool furi_hal_bt_serial_tx(uint8_t* data, uint16_t size) {
|
|
if(size > FURI_HAL_BT_SERIAL_PACKET_SIZE_MAX) {
|
|
return false;
|
|
}
|
|
return serial_svc_update_tx(data, size);
|
|
}
|
|
|
|
void furi_hal_bt_serial_stop() {
|
|
// Stop all services
|
|
if(dev_info_svc_is_started()) {
|
|
dev_info_svc_stop();
|
|
}
|
|
// Start battery service
|
|
if(battery_svc_is_started()) {
|
|
battery_svc_stop();
|
|
}
|
|
// Start Serial service
|
|
if(serial_svc_is_started()) {
|
|
serial_svc_stop();
|
|
}
|
|
}
|