|
@@ -5,18 +5,71 @@ void uhf_read_tag_success_worker_callback(UHFWorkerEvent event, void* ctx) {
|
|
|
UNUSED(ctx);
|
|
UNUSED(ctx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+void uhf_scene_read_card_success_widget_callback(GuiButtonType result, InputType type, void* ctx) {
|
|
|
|
|
+ furi_assert(ctx);
|
|
|
|
|
+ UHFApp* uhf_app = ctx;
|
|
|
|
|
+
|
|
|
|
|
+ if(type == InputTypeShort) {
|
|
|
|
|
+ view_dispatcher_send_custom_event(uhf_app->view_dispatcher, result);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void uhf_scene_read_tag_success_on_enter(void* ctx) {
|
|
void uhf_scene_read_tag_success_on_enter(void* ctx) {
|
|
|
// UNUSED(ctx);
|
|
// UNUSED(ctx);
|
|
|
UHFApp* uhf_app = ctx;
|
|
UHFApp* uhf_app = ctx;
|
|
|
|
|
|
|
|
|
|
+ const uint8_t* read_data = uhf_app->worker->data->data->data;
|
|
|
|
|
+
|
|
|
|
|
+ widget_add_string_element(
|
|
|
|
|
+ uhf_app->widget, 32, 5, AlignLeft, AlignCenter, FontPrimary, "Read Success");
|
|
|
|
|
+
|
|
|
|
|
+ widget_add_string_element(uhf_app->widget, 3, 18, AlignLeft, AlignCenter, FontPrimary, "PC :");
|
|
|
|
|
+
|
|
|
|
|
+ widget_add_string_element(
|
|
|
|
|
+ uhf_app->widget, 66, 18, AlignLeft, AlignCenter, FontPrimary, "CRC :");
|
|
|
|
|
+
|
|
|
|
|
+ widget_add_string_element(
|
|
|
|
|
+ uhf_app->widget, 3, 32, AlignLeft, AlignCenter, FontPrimary, "EPC :");
|
|
|
|
|
+
|
|
|
widget_add_string_element(
|
|
widget_add_string_element(
|
|
|
uhf_app->widget,
|
|
uhf_app->widget,
|
|
|
- 20,
|
|
|
|
|
- 20,
|
|
|
|
|
|
|
+ 26,
|
|
|
|
|
+ 19,
|
|
|
|
|
+ AlignLeft,
|
|
|
AlignCenter,
|
|
AlignCenter,
|
|
|
|
|
+ FontKeyboard,
|
|
|
|
|
+ convertToHexString(read_data + 6, 2));
|
|
|
|
|
+
|
|
|
|
|
+ widget_add_string_element(
|
|
|
|
|
+ uhf_app->widget,
|
|
|
|
|
+ 96,
|
|
|
|
|
+ 19,
|
|
|
|
|
+ AlignLeft,
|
|
|
AlignCenter,
|
|
AlignCenter,
|
|
|
- FontPrimary,
|
|
|
|
|
- convertToHexString(uhf_app->worker->data->data->data, uhf_app->worker->data->data->length));
|
|
|
|
|
|
|
+ FontKeyboard,
|
|
|
|
|
+ convertToHexString(read_data + 20, 2));
|
|
|
|
|
+
|
|
|
|
|
+ widget_add_string_multiline_element(
|
|
|
|
|
+ uhf_app->widget,
|
|
|
|
|
+ 34,
|
|
|
|
|
+ 29,
|
|
|
|
|
+ AlignLeft,
|
|
|
|
|
+ AlignTop,
|
|
|
|
|
+ FontKeyboard,
|
|
|
|
|
+ convertToHexString(read_data + 8, 12));
|
|
|
|
|
+
|
|
|
|
|
+ widget_add_button_element(
|
|
|
|
|
+ uhf_app->widget,
|
|
|
|
|
+ GuiButtonTypeRight,
|
|
|
|
|
+ "More",
|
|
|
|
|
+ uhf_scene_read_card_success_widget_callback,
|
|
|
|
|
+ uhf_app);
|
|
|
|
|
+ widget_add_button_element(
|
|
|
|
|
+ uhf_app->widget,
|
|
|
|
|
+ GuiButtonTypeLeft,
|
|
|
|
|
+ "Exit",
|
|
|
|
|
+ uhf_scene_read_card_success_widget_callback,
|
|
|
|
|
+ uhf_app);
|
|
|
|
|
|
|
|
view_dispatcher_switch_to_view(uhf_app->view_dispatcher, UHFViewWidget);
|
|
view_dispatcher_switch_to_view(uhf_app->view_dispatcher, UHFViewWidget);
|
|
|
}
|
|
}
|
|
@@ -24,24 +77,21 @@ void uhf_scene_read_tag_success_on_enter(void* ctx) {
|
|
|
bool uhf_scene_read_tag_success_on_event(void* ctx, SceneManagerEvent event) {
|
|
bool uhf_scene_read_tag_success_on_event(void* ctx, SceneManagerEvent event) {
|
|
|
UHFApp* uhf_app = ctx;
|
|
UHFApp* uhf_app = ctx;
|
|
|
bool consumed = false;
|
|
bool consumed = false;
|
|
|
- // FURI_LOG_E("33", "uhf_scene_read_tag_on_event was called! event.event: %d", event.type);
|
|
|
|
|
- // FURI_LOG_E("33", "uhf_scene_read_tag_on_event was called! event.event: %lu", event.event);
|
|
|
|
|
if(event.event == SceneManagerEventTypeBack) {
|
|
if(event.event == SceneManagerEventTypeBack) {
|
|
|
// FURI_LOG_E("36", "Back button was pressed");
|
|
// FURI_LOG_E("36", "Back button was pressed");
|
|
|
uhf_app->worker->state = UHFWorkerStateStop;
|
|
uhf_app->worker->state = UHFWorkerStateStop;
|
|
|
}
|
|
}
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
|
- // FURI_LOG_E("36", "SceneManagerEventTypeCustom");
|
|
|
|
|
- if(event.event == UHFCustomEventWorkerExit) {
|
|
|
|
|
- // FURI_LOG_E("38", "UHFCustomEventWorkerExit");
|
|
|
|
|
- // if(memcmp(uhf_app->dev->dev_data.pacs.key, uhf_factory_debit_key, PICOPASS_BLOCK_LEN) ==
|
|
|
|
|
- // 0) {
|
|
|
|
|
- // scene_manager_next_scene(uhf_app->scene_manager, PicopassSceneReadFactorySuccess);
|
|
|
|
|
- // } else {
|
|
|
|
|
- // scene_manager_next_scene(uhf_app->scene_manager, PicopassSceneReadCardSuccess);
|
|
|
|
|
- // }
|
|
|
|
|
- // scene_manager_next_scene(uhf_app->scene_manager, UHFSceneStart);
|
|
|
|
|
- consumed = true;
|
|
|
|
|
|
|
+ // if 'exit' is pressed go back to home screen
|
|
|
|
|
+ if(event.event == GuiButtonTypeLeft) {
|
|
|
|
|
+ consumed = scene_manager_search_and_switch_to_previous_scene(
|
|
|
|
|
+ uhf_app->scene_manager, UHFSceneStart);
|
|
|
|
|
+ } else if(event.event == GuiButtonTypeRight) {
|
|
|
|
|
+ // scene_manager_next_scene(picopass->scene_manager, PicopassSceneCardMenu);
|
|
|
|
|
+ // consumed = true;
|
|
|
|
|
+ } else if(event.event == GuiButtonTypeCenter) {
|
|
|
|
|
+ // consumed = scene_manager_search_and_switch_to_another_scene(
|
|
|
|
|
+ // picopass->scene_manager, PicopassSceneStart);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return consumed;
|
|
return consumed;
|