RPC App: state message and GUI update (#1423)

* RPC App: state message and GUI update
* Protobuf submodule update

Co-authored-by: SG <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov
2022-07-25 17:16:45 +03:00
committed by GitHub
parent f1cb95655c
commit d80edba891
17 changed files with 237 additions and 62 deletions

View File

@@ -44,6 +44,7 @@ LfRfidApp::~LfRfidApp() {
string_clear(file_path);
if(rpc_ctx) {
rpc_system_app_set_callback(rpc_ctx, NULL, NULL);
rpc_system_app_send_exited(rpc_ctx);
}
}
@@ -91,6 +92,7 @@ void LfRfidApp::run(void* _args) {
if(sscanf(args, "RPC %lX", &rpc_ctx_ptr) == 1) {
rpc_ctx = (RpcAppSystem*)rpc_ctx_ptr;
rpc_system_app_set_callback(rpc_ctx, rpc_command_callback, this);
rpc_system_app_send_started(rpc_ctx);
scene_controller.add_scene(SceneType::Rpc, new LfRfidAppSceneRpc());
scene_controller.process(100, SceneType::Rpc);
} else {

View File

@@ -2,10 +2,24 @@
#include <core/common_defines.h>
#include <dolphin/dolphin.h>
static const NotificationSequence sequence_blink_start_magenta = {
&message_blink_start_10,
&message_blink_set_color_magenta,
&message_do_not_reset,
NULL,
};
static const NotificationSequence sequence_blink_stop = {
&message_blink_stop,
NULL,
};
void LfRfidAppSceneRpc::on_enter(LfRfidApp* app, bool /* need_restore */) {
auto popup = app->view_controller.get<PopupVM>();
popup->set_header("RPC Mode", 64, 30, AlignCenter, AlignTop);
popup->set_header("LF RFID", 89, 30, AlignCenter, AlignTop);
popup->set_text("RPC mode", 89, 43, AlignCenter, AlignTop);
popup->set_icon(0, 3, &I_RFIDDolphinSend_97x61);
app->view_controller.switch_to<PopupVM>();
@@ -23,8 +37,14 @@ bool LfRfidAppSceneRpc::on_event(LfRfidApp* app, LfRfidApp::Event* 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;
emulating = true;
app->text_store.set("emulating\n%s", app->worker.key.get_name());
popup->set_text(app->text_store.text, 89, 43, AlignCenter, AlignTop);
notification_message(app->notification, &sequence_blink_start_magenta);
}
return consumed;
}
@@ -32,6 +52,7 @@ bool LfRfidAppSceneRpc::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
void LfRfidAppSceneRpc::on_exit(LfRfidApp* app) {
if(emulating) {
app->worker.stop_emulate();
notification_message(app->notification, &sequence_blink_stop);
}
app->view_controller.get<PopupVM>()->clean();
}