[FL-2705] App RPC Bug Fixes and redesign (#1491)

* Rpc: remove callback timer
* Rpc: simplify rpc event callback
* Rpc: migrate to new confirmation schema
* Rpc: migrate to new confirmation schema part2: finalize ibutton and rfid
* Rpc: migrate to new confirmation schema part3: finallize nfc and fix id in load
* Rpc: hardened sequencing check
* Rpc: migrate to new confirmation schema part4: finalize subghz
* iButton: properly handle exit
* Nfc: correct sequence for rpc exit send
* Rpc: fix review issues and nfc exit message
* Rpc: more logging and condition race fix in confirmation
* Rpc: migrate to new confirmation schema part5: finalize infrared
* Rpc: more logging
This commit is contained in:
あく
2022-08-02 21:54:12 +09:00
committed by GitHub
parent f9386b2649
commit f9745b4141
20 changed files with 378 additions and 270 deletions

View File

@@ -1,6 +1,7 @@
#include "lfrfid_app_scene_rpc.h"
#include <core/common_defines.h>
#include <dolphin/dolphin.h>
#include <rpc/rpc_app.h>
static const NotificationSequence sequence_blink_start_magenta = {
&message_blink_start_10,
@@ -36,6 +37,16 @@ bool LfRfidAppSceneRpc::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
LfRfidApp::Event view_event;
view_event.type = LfRfidApp::EventType::Back;
app->view_controller.send_event(&view_event);
rpc_system_app_confirm(app->rpc_ctx, RpcAppEventAppExit, true);
} else if(event->type == LfRfidApp::EventType::RpcSessionClose) {
// Detach RPC
rpc_system_app_set_callback(app->rpc_ctx, NULL, NULL);
app->rpc_ctx = NULL;
consumed = true;
LfRfidApp::Event view_event;
view_event.type = LfRfidApp::EventType::Back;
app->view_controller.send_event(&view_event);
} else if(event->type == LfRfidApp::EventType::EmulateStart) {
auto popup = app->view_controller.get<PopupVM>();
consumed = true;
@@ -45,7 +56,22 @@ bool LfRfidAppSceneRpc::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
popup->set_text(app->text_store.text, 89, 43, AlignCenter, AlignTop);
notification_message(app->notification, &sequence_blink_start_magenta);
} else if(event->type == LfRfidApp::EventType::RpcLoadFile) {
const char* arg = rpc_system_app_get_data(app->rpc_ctx);
bool result = false;
if(arg) {
string_set_str(app->file_path, arg);
if(app->load_key_data(app->file_path, &(app->worker.key), false)) {
LfRfidApp::Event event;
event.type = LfRfidApp::EventType::EmulateStart;
app->view_controller.send_event(&event);
app->worker.start_emulate();
result = true;
}
}
rpc_system_app_confirm(app->rpc_ctx, RpcAppEventLoadFile, result);
}
return consumed;
}