mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-04 02:09:12 +00:00
936a2f64b2
* FuriHal: add more supported radio stacks * Bt: correct ble stack enum value * Bt: update cli testing commands implementation * Scripts: always emitting ob data to update manifest; added ob_custradio.data for non-light radio stacks * Scripts: added stack type whitelist & disclaimer message * ble: remove scanner * ble: remove HCI and advances ble stacks support * bt: correctly close RPC session before bt reinit * Scripts: update bundler: estimating flash layout & refusing to build dangerous packages; app frame: not adding redundant log handlers * Docs: additional details on bundling updates; fixed updater error codes * Docs: wording fixes for OTA.md Co-authored-by: hedger <hedger@nanode.su> Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: SG <who.just.the.doctor@gmail.com>
38 lines
1.2 KiB
C
Executable file
38 lines
1.2 KiB
C
Executable file
#include "bt_i.h"
|
|
|
|
bool bt_set_profile(Bt* bt, BtProfile profile) {
|
|
furi_assert(bt);
|
|
|
|
// Send message
|
|
bool result = false;
|
|
BtMessage message = {
|
|
.type = BtMessageTypeSetProfile, .data.profile = profile, .result = &result};
|
|
furi_check(osMessageQueuePut(bt->message_queue, &message, 0, osWaitForever) == osOK);
|
|
// Wait for unlock
|
|
osEventFlagsWait(bt->api_event, BT_API_UNLOCK_EVENT, osFlagsWaitAny, osWaitForever);
|
|
|
|
return result;
|
|
}
|
|
|
|
void bt_disconnect(Bt* bt) {
|
|
furi_assert(bt);
|
|
|
|
// Send message
|
|
BtMessage message = {.type = BtMessageTypeDisconnect};
|
|
furi_check(osMessageQueuePut(bt->message_queue, &message, 0, osWaitForever) == osOK);
|
|
// Wait for unlock
|
|
osEventFlagsWait(bt->api_event, BT_API_UNLOCK_EVENT, osFlagsWaitAny, osWaitForever);
|
|
}
|
|
|
|
void bt_set_status_changed_callback(Bt* bt, BtStatusChangedCallback callback, void* context) {
|
|
furi_assert(bt);
|
|
|
|
bt->status_changed_cb = callback;
|
|
bt->status_changed_ctx = context;
|
|
}
|
|
|
|
void bt_forget_bonded_devices(Bt* bt) {
|
|
furi_assert(bt);
|
|
BtMessage message = {.type = BtMessageTypeForgetBondedDevices};
|
|
furi_check(osMessageQueuePut(bt->message_queue, &message, 0, osWaitForever) == osOK);
|
|
}
|