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:
@@ -65,6 +65,8 @@ static bool
|
||||
infrared->worker, infrared_worker_tx_get_signal_steady_callback, infrared);
|
||||
infrared_worker_tx_set_signal_sent_callback(
|
||||
infrared->worker, infrared_signal_sent_callback, infrared);
|
||||
view_dispatcher_send_custom_event(
|
||||
infrared->view_dispatcher, InfraredCustomEventTypeRpcLoaded);
|
||||
}
|
||||
} else if(event == RpcAppEventButtonPress) {
|
||||
if(arg) {
|
||||
@@ -141,7 +143,6 @@ static Infrared* infrared_alloc() {
|
||||
infrared->gui = furi_record_open("gui");
|
||||
|
||||
ViewDispatcher* view_dispatcher = infrared->view_dispatcher;
|
||||
view_dispatcher_attach_to_gui(view_dispatcher, infrared->gui, ViewDispatcherTypeFullscreen);
|
||||
view_dispatcher_enable_queue(view_dispatcher);
|
||||
view_dispatcher_set_event_callback_context(view_dispatcher, infrared);
|
||||
view_dispatcher_set_custom_event_callback(view_dispatcher, infrared_custom_event_callback);
|
||||
@@ -202,6 +203,7 @@ static void infrared_free(Infrared* infrared) {
|
||||
|
||||
if(infrared->rpc_ctx) {
|
||||
rpc_system_app_set_callback(infrared->rpc_ctx, NULL, NULL);
|
||||
rpc_system_app_send_exited(infrared->rpc_ctx);
|
||||
infrared->rpc_ctx = NULL;
|
||||
}
|
||||
|
||||
@@ -434,6 +436,7 @@ int32_t infrared_app(void* p) {
|
||||
infrared->rpc_ctx = (void*)rpc_ctx;
|
||||
rpc_system_app_set_callback(
|
||||
infrared->rpc_ctx, infrared_rpc_command_callback, infrared);
|
||||
rpc_system_app_send_started(infrared->rpc_ctx);
|
||||
is_rpc_mode = true;
|
||||
} else {
|
||||
string_set_str(infrared->file_path, (const char*)p);
|
||||
@@ -447,11 +450,17 @@ int32_t infrared_app(void* p) {
|
||||
}
|
||||
|
||||
if(is_rpc_mode) {
|
||||
view_dispatcher_attach_to_gui(
|
||||
infrared->view_dispatcher, infrared->gui, ViewDispatcherTypeDesktop);
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneRpc);
|
||||
} else if(is_remote_loaded) {
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneRemote);
|
||||
} else {
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneStart);
|
||||
view_dispatcher_attach_to_gui(
|
||||
infrared->view_dispatcher, infrared->gui, ViewDispatcherTypeFullscreen);
|
||||
if(is_remote_loaded) {
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneRemote);
|
||||
} else {
|
||||
scene_manager_next_scene(infrared->scene_manager, InfraredSceneStart);
|
||||
}
|
||||
}
|
||||
|
||||
view_dispatcher_run(infrared->view_dispatcher);
|
||||
|
@@ -14,6 +14,7 @@ enum InfraredCustomEventType {
|
||||
InfraredCustomEventTypePopupClosed,
|
||||
InfraredCustomEventTypeButtonSelected,
|
||||
InfraredCustomEventTypeBackPressed,
|
||||
InfraredCustomEventTypeRpcLoaded,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
@@ -5,12 +5,14 @@ void infrared_scene_rpc_on_enter(void* context) {
|
||||
Infrared* infrared = context;
|
||||
Popup* popup = infrared->popup;
|
||||
|
||||
popup_set_text(popup, "Rpc mode", 64, 28, AlignCenter, AlignCenter);
|
||||
popup_set_header(popup, "Infrared", 82, 28, AlignCenter, AlignBottom);
|
||||
popup_set_text(popup, "RPC mode", 82, 32, AlignCenter, AlignTop);
|
||||
|
||||
popup_set_icon(popup, 2, 14, &I_Warning_30x23); // TODO: icon
|
||||
|
||||
popup_set_context(popup, context);
|
||||
popup_set_callback(popup, infrared_popup_closed_callback);
|
||||
|
||||
infrared_play_notification_message(infrared, InfraredNotificationMessageYellowOn);
|
||||
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
|
||||
|
||||
notification_message(infrared->notifications, &sequence_display_backlight_on);
|
||||
@@ -26,6 +28,12 @@ bool infrared_scene_rpc_on_event(void* context, SceneManagerEvent event) {
|
||||
view_dispatcher_stop(infrared->view_dispatcher);
|
||||
} else if(event.event == InfraredCustomEventTypePopupClosed) {
|
||||
view_dispatcher_stop(infrared->view_dispatcher);
|
||||
} else if(event.event == InfraredCustomEventTypeRpcLoaded) {
|
||||
const char* remote_name = infrared_remote_get_name(infrared->remote);
|
||||
|
||||
infrared_text_store_set(infrared, 0, "loaded\n%s", remote_name);
|
||||
popup_set_text(
|
||||
infrared->popup, infrared->text_store[0], 82, 32, AlignCenter, AlignTop);
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
|
Reference in New Issue
Block a user