mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-16 18:07:13 +03:00
e3e64e5e83
* ble: refactored bt gatt characteristics setup * ble: naming fixes, small optimizations * ble: expanded bitfields; fixed pvs warnings * ble: fixed pvs warnings for real * ble: using FlipperGattCharacteristicDataPropsFixed for char[] props * ble: removed flipper_gatt_characteristic_props_const_char * ble: gatt: naming changes * ble: gatt: fixed device_info service constant attrs sizes * ble: gatt: copy descriptors to char instances; reworked hid chars to be callback-based; moved max size getter to callback with NULL data; added comments * ble: gatt: removed hid_svc_report_data_callback * ble: hid svc: better double loop idx naming * ble: hid svc: simplified hid_svc_update_info * ble: gatt: removed magic values; fixed type for HidSvcGattCharacteristicInfo * ble: gatt: moved long uuids to separate files Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
65 lines
1.6 KiB
C
65 lines
1.6 KiB
C
#include <furi_hal_bt_serial.h>
|
|
#include <services/dev_info_service.h>
|
|
#include <services/battery_service.h>
|
|
#include <services/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();
|
|
}
|
|
|
|
void furi_hal_bt_serial_set_rpc_status(FuriHalBtSerialRpcStatus status) {
|
|
SerialServiceRpcStatus st;
|
|
if(status == FuriHalBtSerialRpcStatusActive) {
|
|
st = SerialServiceRpcStatusActive;
|
|
} else {
|
|
st = SerialServiceRpcStatusNotActive;
|
|
}
|
|
serial_svc_set_rpc_status(st);
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|