unleashed-firmware/targets/f7/furi_hal/furi_hal_bt_serial.c
hedger 917410a0a8
[FL-3629] fbt: reworked assets & resources handling (#3160)
* fbt: reworking targets & assets handling WIP
* fbt: dist fixes
* fbt: moved SD card resources to owning apps
* unit_tests: moved resources to app folder
* github: updated unit_tests paths
* github: packaging fixes
* unit_tests: fixes
* fbt: assets: internal cleanup
* fbt: reworked assets handling
* github: unit_tests: reintroducing fixes
* minor cleanup
* fbt: naming changes to reflect private nature of scons tools
* fbt: resources: fixed dist archive paths
* docs: updated paths
* docs: updated more paths
* docs: included "resources" parameter in app manifest docs; updated assets readme
* updated gitignore for assets
* github: updated action versions
* unit_tests: restored timeout; scripts: assets: logging changes
* gh: don't upload desktop animations for unit test run

Co-authored-by: あく <alleteam@gmail.com>
2023-10-31 00:17:30 +09:00

64 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();
}
}