Move some things around to match OFW

This commit is contained in:
Willy-JL
2023-08-29 00:40:35 +02:00
parent 184eb718e1
commit 2af8338f4a
5 changed files with 49 additions and 48 deletions

View File

@@ -90,7 +90,6 @@ static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) {
dialog_message_set_buttons(bt->dialog_message, "Cancel", "OK", NULL);
DialogMessageButton button = dialog_message_show(bt->dialogs, bt->dialog_message);
furi_string_free(pin_str);
return button == DialogMessageButtonCenter;
}
@@ -216,40 +215,6 @@ static void bt_rpc_send_bytes_callback(void* context, uint8_t* bytes, size_t byt
}
}
// Open BT Connection
void bt_open_rpc_connection(Bt* bt) {
if(!bt->rpc_session && bt->status == BtStatusConnected) {
// Clear BT_RPC_EVENT_DISCONNECTED because it might be set from previous session
furi_event_flag_clear(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
if(bt->profile == BtProfileSerial) {
// Open RPC session
bt->rpc_session = rpc_session_open(bt->rpc, RpcOwnerBle);
if(bt->rpc_session) {
FURI_LOG_I(TAG, "Open RPC connection");
rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback);
rpc_session_set_buffer_is_empty_callback(
bt->rpc_session, furi_hal_bt_serial_notify_buffer_is_empty);
rpc_session_set_context(bt->rpc_session, bt);
furi_hal_bt_serial_set_event_callback(
RPC_BUFFER_SIZE, bt_serial_event_callback, bt);
furi_hal_bt_serial_set_rpc_status(FuriHalBtSerialRpcStatusActive);
} else {
FURI_LOG_W(TAG, "RPC is busy, failed to open new session");
}
}
}
}
void bt_close_rpc_connection(Bt* bt) {
if(bt->profile == BtProfileSerial && bt->rpc_session) {
FURI_LOG_I(TAG, "Close RPC connection");
furi_event_flag_set(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
rpc_session_close(bt->rpc_session);
furi_hal_bt_serial_set_event_callback(0, NULL, NULL);
bt->rpc_session = NULL;
}
}
// Called from GAP thread
static bool bt_on_gap_event_callback(GapEvent event, void* context) {
furi_assert(context);
@@ -340,6 +305,39 @@ static void bt_show_warning(Bt* bt, const char* text) {
dialog_message_show(bt->dialogs, bt->dialog_message);
}
void bt_open_rpc_connection(Bt* bt) {
if(!bt->rpc_session && bt->status == BtStatusConnected) {
// Clear BT_RPC_EVENT_DISCONNECTED because it might be set from previous session
furi_event_flag_clear(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
if(bt->profile == BtProfileSerial) {
// Open RPC session
bt->rpc_session = rpc_session_open(bt->rpc, RpcOwnerBle);
if(bt->rpc_session) {
FURI_LOG_I(TAG, "Open RPC connection");
rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback);
rpc_session_set_buffer_is_empty_callback(
bt->rpc_session, furi_hal_bt_serial_notify_buffer_is_empty);
rpc_session_set_context(bt->rpc_session, bt);
furi_hal_bt_serial_set_event_callback(
RPC_BUFFER_SIZE, bt_serial_event_callback, bt);
furi_hal_bt_serial_set_rpc_status(FuriHalBtSerialRpcStatusActive);
} else {
FURI_LOG_W(TAG, "RPC is busy, failed to open new session");
}
}
}
}
void bt_close_rpc_connection(Bt* bt) {
if(bt->profile == BtProfileSerial && bt->rpc_session) {
FURI_LOG_I(TAG, "Close RPC connection");
furi_event_flag_set(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
rpc_session_close(bt->rpc_session);
furi_hal_bt_serial_set_event_callback(0, NULL, NULL);
bt->rpc_session = NULL;
}
}
static void bt_change_profile(Bt* bt, BtMessage* message) {
if(furi_hal_bt_is_ble_gatt_gap_supported()) {
bt_settings_load(&bt->bt_settings);

View File

@@ -97,16 +97,6 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
consumed = true;
} break;
case DesktopMainEventOpenLockMenu:
scene_manager_next_scene(desktop->scene_manager, DesktopSceneLockMenu);
consumed = true;
break;
case DesktopMainEventOpenDebug:
scene_manager_next_scene(desktop->scene_manager, DesktopSceneDebug);
consumed = true;
break;
case DesktopMainEventLockKeypad:
desktop_lock(desktop, false);
consumed = true;
@@ -117,6 +107,16 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
consumed = true;
break;
case DesktopMainEventOpenLockMenu:
scene_manager_next_scene(desktop->scene_manager, DesktopSceneLockMenu);
consumed = true;
break;
case DesktopMainEventOpenDebug:
scene_manager_next_scene(desktop->scene_manager, DesktopSceneDebug);
consumed = true;
break;
case DesktopMainEventOpenArchive:
#ifdef APP_ARCHIVE
desktop_switch_to_app(desktop, &FLIPPER_ARCHIVE);

View File

@@ -118,8 +118,10 @@ void updater_free(Updater* updater) {
free(updater);
}
int32_t updater_srv(const char* p) {
Updater* updater = updater_alloc(p);
int32_t updater_srv(void* p) {
const char* cfgpath = p;
Updater* updater = updater_alloc(cfgpath);
view_dispatcher_run(updater->view_dispatcher);
updater_free(updater);

View File

@@ -285,6 +285,7 @@ Function,-,LL_mDelay,void,uint32_t
Function,-,SystemCoreClockUpdate,void,
Function,-,SystemInit,void,
Function,-,_Exit,void,int
Function,+,__aeabi_uldivmod,void*,"uint64_t, uint64_t"
Function,-,__assert,void,"const char*, int, const char*"
Function,+,__assert_func,void,"const char*, int, const char*, const char*"
Function,+,__clear_cache,void,"void*, void*"
1 entry status name type params
285 Function - SystemCoreClockUpdate void
286 Function - SystemInit void
287 Function - _Exit void int
288 Function + __aeabi_uldivmod void* uint64_t, uint64_t
289 Function - __assert void const char*, int, const char*
290 Function + __assert_func void const char*, int, const char*, const char*
291 Function + __clear_cache void void*, void*

View File

@@ -9,7 +9,6 @@ env.Append(
],
SDK_HEADERS=[
File("api_lock.h"),
File("value_index.h"),
File("compress.h"),
File("manchester_decoder.h"),
File("manchester_encoder.h"),
@@ -23,6 +22,7 @@ env.Append(
File("saved_struct.h"),
File("version.h"),
File("float_tools.h"),
File("value_index.h"),
File("tar/tar_archive.h"),
File("stream/stream.h"),
File("stream/file_stream.h"),