88
99#define TAG "Metroflip:Scene:Navigo"
1010
11- void metroflip_navigo_widget_callback (
12- GuiButtonType result ,
13- InputType type ,
14- void * context ) {
11+ void metroflip_navigo_widget_callback (GuiButtonType result , InputType type , void * context ) {
1512 Metroflip * app = context ;
1613 UNUSED (result );
1714
@@ -46,7 +43,6 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
4643 size_t response_length = 0 ;
4744
4845 do {
49-
5046 // Select app for contracts
5147 select_app [6 ] = 32 ;
5248 bit_buffer_reset (tx_buffer );
@@ -75,7 +71,6 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
7571 break ;
7672 }
7773
78-
7974 // read file 1
8075 read_file [2 ] = 1 ;
8176 bit_buffer_reset (tx_buffer );
@@ -103,14 +98,13 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
10398 app -> view_dispatcher , MetroflipCustomEventPollerFileNotFound );
10499 break ;
105100 }
106- char bit_representation
107- [response_length * 8 + 1 ];
108- bit_representation [0 ] = '\0' ;
101+ char bit_representation [response_length * 8 + 1 ];
102+ bit_representation [0 ] = '\0' ;
109103 for (size_t i = 0 ; i < response_length ; i ++ ) {
110- char bits [9 ];
104+ char bits [9 ];
111105 uint8_t byte = bit_buffer_get_byte (rx_buffer , i );
112106 byte_to_binary (byte , bits );
113- strcat (bit_representation , bits );
107+ strcat (bit_representation , bits );
114108 }
115109 int start = 55 , end = 70 ;
116110 float decimal_value = bit_slice_to_dec (bit_representation , start , end );
@@ -155,7 +149,6 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
155149 break ;
156150 }
157151
158-
159152 // read file 1
160153 read_file [2 ] = 1 ;
161154 bit_buffer_reset (tx_buffer );
@@ -183,18 +176,19 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
183176 app -> view_dispatcher , MetroflipCustomEventPollerFileNotFound );
184177 break ;
185178 }
186- char environment_bit_representation [response_length * 8 + 1 ];
187- environment_bit_representation [0 ] = '\0' ;
179+ char environment_bit_representation [response_length * 8 + 1 ];
180+ environment_bit_representation [0 ] = '\0' ;
188181 for (size_t i = 0 ; i < response_length ; i ++ ) {
189- char bits [9 ];
182+ char bits [9 ];
190183 uint8_t byte = bit_buffer_get_byte (rx_buffer , i );
191184 byte_to_binary (byte , bits );
192- strcat (environment_bit_representation , bits );
185+ strcat (environment_bit_representation , bits );
193186 }
194187 start = 45 ;
195188 end = 58 ;
196189 decimal_value = bit_slice_to_dec (environment_bit_representation , start , end );
197- uint64_t end_validity_timestamp = (decimal_value * 24 * 3600 ) + (float )epoch + 3600 ;
190+ uint64_t end_validity_timestamp =
191+ (decimal_value * 24 * 3600 ) + (float )epoch + 3600 ;
198192 DateTime end_dt = {0 };
199193 datetime_timestamp_to_datetime (end_validity_timestamp , & end_dt );
200194 furi_string_cat_printf (parsed_data , "\nEnd Validity:\n" );
@@ -260,29 +254,37 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
260254 app -> view_dispatcher , MetroflipCustomEventPollerFileNotFound );
261255 break ;
262256 }
263- char event_bit_representation
264- [response_length * 8 + 1 ];
265- event_bit_representation [0 ] = '\0' ;
257+ char event_bit_representation [response_length * 8 + 1 ];
258+ event_bit_representation [0 ] = '\0' ;
266259 for (size_t i = 0 ; i < response_length ; i ++ ) {
267- char bits [9 ];
260+ char bits [9 ];
268261 uint8_t byte = bit_buffer_get_byte (rx_buffer , i );
269262 byte_to_binary (byte , bits );
270- strcat (event_bit_representation , bits );
263+ strcat (event_bit_representation , bits );
271264 }
272265 furi_string_cat_printf (parsed_data , "\nEvent 0%d:\n" , i );
273266 int start = 53 , end = 60 ;
274267 int decimal_value = bit_slice_to_dec (event_bit_representation , start , end );
275268 int transport_type = decimal_value >> 4 ;
276269 int transition = decimal_value & 15 ;
277- furi_string_cat_printf (parsed_data , "%s - %s\n" , TRANSPORT_LIST [transport_type ], TRANSITION_LIST [transition ]);
270+ furi_string_cat_printf (
271+ parsed_data ,
272+ "%s - %s\n" ,
273+ TRANSPORT_LIST [transport_type ],
274+ TRANSITION_LIST [transition ]);
278275 start = 69 , end = 84 ;
279276 decimal_value = bit_slice_to_dec (event_bit_representation , start , end );
280277 int line_id = (decimal_value >> 9 ) - 1 ;
281278 int station_id = ((decimal_value >> 4 ) & 31 ) - 1 ;
282- furi_string_cat_printf (parsed_data , "Line: %s\nStation: %s\n" , METRO_LIST [line_id ].name , METRO_LIST [line_id ].stations [station_id ]);
279+ furi_string_cat_printf (
280+ parsed_data ,
281+ "Line: %s\nStation: %s\n" ,
282+ METRO_LIST [line_id ].name ,
283+ METRO_LIST [line_id ].stations [station_id ]);
283284 start = 61 , end = 68 ;
284285 decimal_value = bit_slice_to_dec (event_bit_representation , start , end );
285- furi_string_cat_printf (parsed_data , "Provider: %s\n" , SERVICE_PROVIDERS [decimal_value ]);
286+ furi_string_cat_printf (
287+ parsed_data , "Provider: %s\n" , SERVICE_PROVIDERS [decimal_value ]);
286288 start = 0 , end = 13 ;
287289 decimal_value = bit_slice_to_dec (event_bit_representation , start , end );
288290 uint64_t date_timestamp = (decimal_value * 24 * 3600 ) + epoch + 3600 ;
@@ -292,27 +294,26 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
292294 locale_format_datetime_cat (parsed_data , & dt , false);
293295 start = 14 , end = 24 ;
294296 decimal_value = bit_slice_to_dec (event_bit_representation , start , end );
295- furi_string_cat_printf (parsed_data , " %02d:%02d:%02d\n\n" , ((decimal_value * 60 ) / 3600 ), (((decimal_value * 60 ) % 3600 )/60 ), (((decimal_value * 60 ) % 3600 )%60 ));
297+ furi_string_cat_printf (
298+ parsed_data ,
299+ " %02d:%02d:%02d\n\n" ,
300+ ((decimal_value * 60 ) / 3600 ),
301+ (((decimal_value * 60 ) % 3600 ) / 60 ),
302+ (((decimal_value * 60 ) % 3600 ) % 60 ));
296303 }
297304
298305 widget_add_text_scroll_element (
299306 widget , 0 , 0 , 128 , 64 , furi_string_get_cstr (parsed_data ));
300307
301308 widget_add_button_element (
302- widget ,
303- GuiButtonTypeRight ,
304- "Exit" ,
305- metroflip_navigo_widget_callback ,
306- app );
309+ widget , GuiButtonTypeRight , "Exit" , metroflip_navigo_widget_callback , app );
307310
308311 furi_string_free (parsed_data );
309312 view_dispatcher_switch_to_view (app -> view_dispatcher , MetroflipViewWidget );
310313 metroflip_app_blink_stop (app );
311314 stage = MetroflipPollerEventTypeSuccess ;
312315 next_command = NfcCommandStop ;
313- } while (false);
314-
315-
316+ } while (false);
316317
317318 if (stage != MetroflipPollerEventTypeSuccess ) {
318319 next_command = NfcCommandStop ;
0 commit comments