3
3
4
4
void ibutton_scene_rpc_on_enter (void * context ) {
5
5
iButton * ibutton = context ;
6
- Widget * widget = ibutton -> widget ;
6
+ Popup * popup = ibutton -> popup ;
7
7
8
- widget_add_text_box_element (
9
- widget , 0 , 0 , 128 , 28 , AlignCenter , AlignCenter , "RPC mode" , false );
8
+ popup_set_header ( popup , "iButton" , 82 , 28 , AlignCenter , AlignBottom );
9
+ popup_set_text ( popup , "RPC mode" , 82 , 32 , AlignCenter , AlignTop );
10
10
11
- view_dispatcher_switch_to_view (ibutton -> view_dispatcher , iButtonViewWidget );
11
+ popup_set_icon (popup , 2 , 14 , & I_iButtonKey_49x44 );
12
+
13
+ view_dispatcher_switch_to_view (ibutton -> view_dispatcher , iButtonViewPopup );
12
14
13
15
notification_message (ibutton -> notifications , & sequence_display_backlight_on );
14
16
}
@@ -17,12 +19,31 @@ bool ibutton_scene_rpc_on_event(void* context, SceneManagerEvent event) {
17
19
UNUSED (context );
18
20
UNUSED (event );
19
21
iButton * ibutton = context ;
22
+ Popup * popup = ibutton -> popup ;
20
23
21
24
bool consumed = false;
22
25
23
26
if (event .type == SceneManagerEventTypeCustom ) {
24
27
consumed = true;
25
- if (event .event == iButtonCustomEventRpcExit ) {
28
+ if (event .event == iButtonCustomEventRpcLoad ) {
29
+ string_t key_name ;
30
+ string_init (key_name );
31
+ if (string_end_with_str_p (ibutton -> file_path , IBUTTON_APP_EXTENSION )) {
32
+ path_extract_filename (ibutton -> file_path , key_name , true);
33
+ }
34
+
35
+ if (!string_empty_p (key_name )) {
36
+ ibutton_text_store_set (ibutton , "emulating\n%s" , string_get_cstr (key_name ));
37
+ } else {
38
+ ibutton_text_store_set (ibutton , "emulating" );
39
+ }
40
+ popup_set_text (popup , ibutton -> text_store , 82 , 32 , AlignCenter , AlignTop );
41
+
42
+ ibutton_notification_message (ibutton , iButtonNotificationMessageEmulateStart );
43
+
44
+ string_clear (key_name );
45
+ } else if (event .event == iButtonCustomEventRpcExit ) {
46
+ ibutton_notification_message (ibutton , iButtonNotificationMessageBlinkStop );
26
47
view_dispatcher_stop (ibutton -> view_dispatcher );
27
48
}
28
49
}
@@ -32,5 +53,11 @@ bool ibutton_scene_rpc_on_event(void* context, SceneManagerEvent event) {
32
53
33
54
void ibutton_scene_rpc_on_exit (void * context ) {
34
55
iButton * ibutton = context ;
35
- widget_reset (ibutton -> widget );
56
+ Popup * popup = ibutton -> popup ;
57
+
58
+ popup_set_header (popup , NULL , 0 , 0 , AlignCenter , AlignBottom );
59
+ popup_set_text (popup , NULL , 0 , 0 , AlignCenter , AlignTop );
60
+ popup_set_icon (popup , 0 , 0 , NULL );
61
+
62
+ ibutton_notification_message (ibutton , iButtonNotificationMessageBlinkStop );
36
63
}
0 commit comments