nfc_scene_mf_ultralight_data.c 1000 B

1234567891011121314151617181920212223242526272829303132
  1. #include "../nfc_i.h"
  2. void nfc_scene_mf_ultralight_data_on_enter(void* context) {
  3. Nfc* nfc = context;
  4. MfUltralightData* data = &nfc->dev->dev_data.mf_ul_data;
  5. TextBox* text_box = nfc->text_box;
  6. text_box_set_font(text_box, TextBoxFontHex);
  7. for(uint16_t i = 0; i < data->data_size; i += 2) {
  8. if(!(i % 8) && i) {
  9. furi_string_push_back(nfc->text_box_store, '\n');
  10. }
  11. furi_string_cat_printf(nfc->text_box_store, "%02X%02X ", data->data[i], data->data[i + 1]);
  12. }
  13. text_box_set_text(text_box, furi_string_get_cstr(nfc->text_box_store));
  14. view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewTextBox);
  15. }
  16. bool nfc_scene_mf_ultralight_data_on_event(void* context, SceneManagerEvent event) {
  17. UNUSED(context);
  18. UNUSED(event);
  19. return false;
  20. }
  21. void nfc_scene_mf_ultralight_data_on_exit(void* context) {
  22. Nfc* nfc = context;
  23. // Clean view
  24. text_box_reset(nfc->text_box);
  25. furi_string_reset(nfc->text_box_store);
  26. }