Merge remote-tracking branch 'OFW/dev' into dev
2
.vscode/example/settings.json
vendored
|
@ -14,7 +14,7 @@
|
|||
"*.scons": "python",
|
||||
"SConscript": "python",
|
||||
"SConstruct": "python",
|
||||
"*.fam": "python",
|
||||
"*.fam": "python"
|
||||
},
|
||||
"clangd.arguments": [
|
||||
// We might be able to tighten this a bit more to only include the correct toolchain.
|
||||
|
|
|
@ -124,6 +124,13 @@ typedef enum {
|
|||
LfRfidViewRead,
|
||||
} LfRfidView;
|
||||
|
||||
typedef enum {
|
||||
LfRfidMenuIndexRead,
|
||||
LfRfidMenuIndexSaved,
|
||||
LfRfidMenuIndexAddManually,
|
||||
LfRfidMenuIndexExtraActions,
|
||||
} LfRfidMenuIndex;
|
||||
|
||||
bool lfrfid_save_key(LfRfid* app);
|
||||
|
||||
bool lfrfid_load_key_from_file_select(LfRfid* app);
|
||||
|
|
|
@ -1,45 +1,50 @@
|
|||
#include "../lfrfid_i.h"
|
||||
|
||||
#define LFRFID_SCENE_DELETE_MAX_HEX_WIDTH (7UL)
|
||||
|
||||
void lfrfid_scene_delete_confirm_on_enter(void* context) {
|
||||
LfRfid* app = context;
|
||||
Widget* widget = app->widget;
|
||||
|
||||
FuriString* tmp_string;
|
||||
tmp_string = furi_string_alloc();
|
||||
FuriString* display_text = furi_string_alloc_printf(
|
||||
"\e#Delete %s?\e#\n"
|
||||
"Hex: ",
|
||||
furi_string_get_cstr(app->file_name));
|
||||
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", lfrfid_widget_callback, app);
|
||||
widget_add_button_element(widget, GuiButtonTypeRight, "Delete", lfrfid_widget_callback, app);
|
||||
const size_t data_size = protocol_dict_get_data_size(app->dict, app->protocol_id);
|
||||
uint8_t* data = malloc(data_size);
|
||||
|
||||
furi_string_printf(tmp_string, "Delete %s?", furi_string_get_cstr(app->file_name));
|
||||
widget_add_string_element(
|
||||
widget, 64, 0, AlignCenter, AlignTop, FontPrimary, furi_string_get_cstr(tmp_string));
|
||||
protocol_dict_get_data(app->dict, app->protocol_id, data, data_size);
|
||||
|
||||
furi_string_reset(tmp_string);
|
||||
size_t size = protocol_dict_get_data_size(app->dict, app->protocol_id);
|
||||
uint8_t* data = (uint8_t*)malloc(size);
|
||||
protocol_dict_get_data(app->dict, app->protocol_id, data, size);
|
||||
for(uint8_t i = 0; i < MIN(size, (size_t)8); i++) {
|
||||
if(i != 0) {
|
||||
furi_string_cat_printf(tmp_string, " ");
|
||||
for(size_t i = 0; i < data_size; i++) {
|
||||
if(i == LFRFID_SCENE_DELETE_MAX_HEX_WIDTH) {
|
||||
furi_string_cat(display_text, " ...");
|
||||
break;
|
||||
}
|
||||
|
||||
furi_string_cat_printf(tmp_string, "%02X", data[i]);
|
||||
furi_string_cat_printf(display_text, "%s%02X", i != 0 ? " " : "", data[i]);
|
||||
}
|
||||
|
||||
furi_string_push_back(display_text, '\n');
|
||||
|
||||
free(data);
|
||||
|
||||
widget_add_string_element(
|
||||
widget, 64, 19, AlignCenter, AlignTop, FontSecondary, furi_string_get_cstr(tmp_string));
|
||||
widget_add_string_element(
|
||||
widget,
|
||||
64,
|
||||
49,
|
||||
AlignCenter,
|
||||
AlignBottom,
|
||||
FontSecondary,
|
||||
protocol_dict_get_name(app->dict, app->protocol_id));
|
||||
const char* protocol = protocol_dict_get_name(app->dict, app->protocol_id);
|
||||
const char* manufacturer = protocol_dict_get_manufacturer(app->dict, app->protocol_id);
|
||||
|
||||
if(strcasecmp(protocol, manufacturer) != 0 && strcasecmp(manufacturer, "N/A") != 0) {
|
||||
furi_string_cat_printf(display_text, "%s ", manufacturer);
|
||||
}
|
||||
|
||||
furi_string_cat(display_text, protocol);
|
||||
|
||||
widget_add_text_box_element(
|
||||
widget, 0, 0, 128, 64, AlignCenter, AlignTop, furi_string_get_cstr(display_text), true);
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Cancel", lfrfid_widget_callback, app);
|
||||
widget_add_button_element(widget, GuiButtonTypeRight, "Delete", lfrfid_widget_callback, app);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget);
|
||||
furi_string_free(tmp_string);
|
||||
furi_string_free(display_text);
|
||||
}
|
||||
|
||||
bool lfrfid_scene_delete_confirm_on_event(void* context, SceneManagerEvent event) {
|
||||
|
|
|
@ -18,10 +18,9 @@ bool lfrfid_scene_delete_success_on_event(void* context, SceneManagerEvent event
|
|||
LfRfid* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if((event.type == SceneManagerEventTypeBack) ||
|
||||
((event.type == SceneManagerEventTypeCustom) && (event.event == LfRfidEventPopupClosed))) {
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, LfRfidSceneSelectKey);
|
||||
if(event.type == SceneManagerEventTypeBack || event.type == SceneManagerEventTypeCustom) {
|
||||
// Always return to SceneSelectKey from here
|
||||
scene_manager_search_and_switch_to_another_scene(app->scene_manager, LfRfidSceneSelectKey);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,27 +2,28 @@
|
|||
|
||||
void lfrfid_scene_emulate_on_enter(void* context) {
|
||||
LfRfid* app = context;
|
||||
Popup* popup = app->popup;
|
||||
Widget* widget = app->widget;
|
||||
|
||||
popup_set_header(popup, "Emulating", 89, 30, AlignCenter, AlignTop);
|
||||
if(!furi_string_empty(app->file_name)) {
|
||||
popup_set_text(popup, furi_string_get_cstr(app->file_name), 89, 43, AlignCenter, AlignTop);
|
||||
FuriString* display_text = furi_string_alloc_set("\e#Emulating\e#\n");
|
||||
|
||||
if(furi_string_empty(app->file_name)) {
|
||||
furi_string_cat(display_text, "Unsaved\n");
|
||||
furi_string_cat(display_text, protocol_dict_get_name(app->dict, app->protocol_id));
|
||||
} else {
|
||||
popup_set_text(
|
||||
popup,
|
||||
protocol_dict_get_name(app->dict, app->protocol_id),
|
||||
89,
|
||||
43,
|
||||
AlignCenter,
|
||||
AlignTop);
|
||||
furi_string_cat(display_text, app->file_name);
|
||||
}
|
||||
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61);
|
||||
|
||||
widget_add_icon_element(widget, 0, 0, &I_NFC_dolphin_emulation_51x64);
|
||||
widget_add_text_box_element(
|
||||
widget, 55, 16, 67, 48, AlignCenter, AlignTop, furi_string_get_cstr(display_text), true);
|
||||
|
||||
furi_string_free(display_text);
|
||||
|
||||
lfrfid_worker_start_thread(app->lfworker);
|
||||
lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id);
|
||||
notification_message(app->notifications, &sequence_blink_start_magenta);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget);
|
||||
}
|
||||
|
||||
bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) {
|
||||
|
@ -35,7 +36,7 @@ bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) {
|
|||
void lfrfid_scene_emulate_on_exit(void* context) {
|
||||
LfRfid* app = context;
|
||||
notification_message(app->notifications, &sequence_blink_stop);
|
||||
popup_reset(app->popup);
|
||||
widget_reset(app->widget);
|
||||
lfrfid_worker_stop(app->lfworker);
|
||||
lfrfid_worker_stop_thread(app->lfworker);
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ void lfrfid_scene_exit_confirm_on_enter(void* context) {
|
|||
widget_add_button_element(widget, GuiButtonTypeLeft, "Exit", lfrfid_widget_callback, app);
|
||||
widget_add_button_element(widget, GuiButtonTypeRight, "Stay", lfrfid_widget_callback, app);
|
||||
widget_add_string_element(
|
||||
widget, 64, 19, AlignCenter, AlignBottom, FontPrimary, "Exit to RFID Menu?");
|
||||
widget, 64, 0, AlignCenter, AlignTop, FontPrimary, "Exit to RFID Menu?");
|
||||
widget_add_string_element(
|
||||
widget, 64, 31, AlignCenter, AlignBottom, FontSecondary, "All unsaved data will be lost!");
|
||||
widget, 64, 13, AlignCenter, AlignTop, FontSecondary, "All unsaved data will be lost");
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget);
|
||||
}
|
||||
|
|
|
@ -92,6 +92,9 @@ bool lfrfid_scene_extra_actions_on_event(void* context, SceneManagerEvent event)
|
|||
consumed = true;
|
||||
}
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneExtraActions, event.event);
|
||||
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneExtraActions, 0);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
|
|
|
@ -4,37 +4,39 @@ void lfrfid_scene_raw_info_on_enter(void* context) {
|
|||
LfRfid* app = context;
|
||||
Widget* widget = app->widget;
|
||||
|
||||
// FuriString* tmp_string;
|
||||
// tmp_string = furi_string_alloc();
|
||||
|
||||
bool sd_exist = storage_sd_status(app->storage) == FSE_OK;
|
||||
if(!sd_exist) {
|
||||
widget_add_icon_element(widget, 0, 0, &I_SDQuestion_35x43);
|
||||
widget_add_string_multiline_element(
|
||||
widget,
|
||||
81,
|
||||
4,
|
||||
AlignCenter,
|
||||
AlignTop,
|
||||
FontSecondary,
|
||||
"No SD card found.\nThis function will not\nwork without\nSD card.");
|
||||
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", lfrfid_widget_callback, app);
|
||||
} else {
|
||||
if(storage_sd_status(app->storage) != FSE_OK) {
|
||||
widget_add_icon_element(widget, 83, 22, &I_WarningDolphinFlip_45x42);
|
||||
widget_add_string_element(
|
||||
widget, 64, 0, AlignCenter, AlignTop, FontPrimary, "No SD Card!");
|
||||
widget_add_string_multiline_element(
|
||||
widget,
|
||||
0,
|
||||
1,
|
||||
13,
|
||||
AlignLeft,
|
||||
AlignTop,
|
||||
FontSecondary,
|
||||
"RAW RFID data reader\n1) Put the Flipper on your card\n2) Press OK\n3) Wait until data is read");
|
||||
"Insert an SD card\n"
|
||||
"to use this function");
|
||||
|
||||
} else {
|
||||
widget_add_text_box_element(
|
||||
widget,
|
||||
0,
|
||||
0,
|
||||
128,
|
||||
64,
|
||||
AlignLeft,
|
||||
AlignTop,
|
||||
"\e#RAW RFID Data Reader\e#\n"
|
||||
"1. Hold card next to Flipper\n"
|
||||
"2. Press OK\n"
|
||||
"3. Wait until data is read",
|
||||
false);
|
||||
|
||||
widget_add_button_element(widget, GuiButtonTypeCenter, "OK", lfrfid_widget_callback, app);
|
||||
}
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget);
|
||||
//furi_string_free(tmp_string);
|
||||
}
|
||||
|
||||
bool lfrfid_scene_raw_info_on_event(void* context, SceneManagerEvent event) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "../lfrfid_i.h"
|
||||
|
||||
#define RAW_READ_TIME 5000
|
||||
#define RAW_READ_TIME_MS (5000UL)
|
||||
|
||||
typedef struct {
|
||||
FuriString* string_file_name;
|
||||
|
@ -29,24 +29,28 @@ void lfrfid_scene_raw_read_on_enter(void* context) {
|
|||
LfRfid* app = context;
|
||||
Popup* popup = app->popup;
|
||||
|
||||
LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState));
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state);
|
||||
state->string_file_name = furi_string_alloc();
|
||||
popup_set_icon(popup, 0, 0, &I_NFC_dolphin_emulation_51x64);
|
||||
popup_set_header(popup, "Reading ASK", 91, 16, AlignCenter, AlignTop);
|
||||
popup_set_text(popup, "Don't move\nfor 5 sec.", 91, 29, AlignCenter, AlignTop);
|
||||
|
||||
popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
|
||||
lfrfid_worker_start_thread(app->lfworker);
|
||||
lfrfid_make_app_folder(app);
|
||||
|
||||
LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState));
|
||||
state->string_file_name = furi_string_alloc();
|
||||
state->timer = furi_timer_alloc(timer_callback, FuriTimerTypeOnce, app);
|
||||
furi_timer_start(state->timer, RAW_READ_TIME);
|
||||
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state);
|
||||
|
||||
furi_string_printf(
|
||||
state->string_file_name,
|
||||
"%s/%s%s",
|
||||
LFRFID_SD_FOLDER,
|
||||
furi_string_get_cstr(app->raw_file_name),
|
||||
LFRFID_APP_RAW_ASK_EXTENSION);
|
||||
popup_set_header(popup, "Reading\nRAW RFID\nASK", 89, 30, AlignCenter, AlignTop);
|
||||
|
||||
lfrfid_make_app_folder(app);
|
||||
|
||||
lfrfid_worker_start_thread(app->lfworker);
|
||||
lfrfid_worker_read_raw_start(
|
||||
app->lfworker,
|
||||
furi_string_get_cstr(state->string_file_name),
|
||||
|
@ -54,6 +58,7 @@ void lfrfid_scene_raw_read_on_enter(void* context) {
|
|||
lfrfid_read_callback,
|
||||
app);
|
||||
|
||||
furi_timer_start(state->timer, RAW_READ_TIME_MS);
|
||||
notification_message(app->notifications, &sequence_blink_start_cyan);
|
||||
|
||||
state->is_psk = false;
|
||||
|
@ -70,43 +75,53 @@ bool lfrfid_scene_raw_read_on_event(void* context, SceneManagerEvent event) {
|
|||
furi_assert(state);
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == LfRfidEventReadError) {
|
||||
consumed = true;
|
||||
state->error = true;
|
||||
popup_set_header(
|
||||
popup, "Reading\nRAW RFID\nFile error", 89, 30, AlignCenter, AlignTop);
|
||||
notification_message(app->notifications, &sequence_blink_start_red);
|
||||
if(event.event == LfRfidEventReadError || event.event == LfRfidEventReadOverrun) {
|
||||
furi_timer_stop(state->timer);
|
||||
|
||||
popup_set_icon(popup, 83, 22, &I_WarningDolphinFlip_45x42);
|
||||
popup_set_header(popup, "RAW Reading error!", 64, 0, AlignCenter, AlignTop);
|
||||
popup_set_text(
|
||||
popup, "This may be\ncaused by SD\ncard issues", 0, 13, AlignLeft, AlignTop);
|
||||
|
||||
notification_message(app->notifications, &sequence_blink_start_red);
|
||||
state->error = true;
|
||||
|
||||
} else if(event.event == LfRfidEventReadDone) {
|
||||
consumed = true;
|
||||
if(!state->error) {
|
||||
if(state->is_psk) {
|
||||
notification_message(app->notifications, &sequence_success);
|
||||
scene_manager_next_scene(app->scene_manager, LfRfidSceneRawSuccess);
|
||||
|
||||
} else {
|
||||
popup_set_header(
|
||||
popup, "Reading\nRAW RFID\nPSK", 89, 30, AlignCenter, AlignTop);
|
||||
notification_message(app->notifications, &sequence_blink_start_yellow);
|
||||
lfrfid_worker_stop(app->lfworker);
|
||||
lfrfid_worker_stop_thread(app->lfworker);
|
||||
lfrfid_worker_start_thread(app->lfworker);
|
||||
|
||||
state->is_psk = true;
|
||||
|
||||
furi_string_printf(
|
||||
state->string_file_name,
|
||||
"%s/%s%s",
|
||||
LFRFID_SD_FOLDER,
|
||||
furi_string_get_cstr(app->raw_file_name),
|
||||
LFRFID_APP_RAW_PSK_EXTENSION);
|
||||
|
||||
lfrfid_worker_start_thread(app->lfworker);
|
||||
lfrfid_worker_read_raw_start(
|
||||
app->lfworker,
|
||||
furi_string_get_cstr(state->string_file_name),
|
||||
LFRFIDWorkerReadTypePSKOnly,
|
||||
lfrfid_read_callback,
|
||||
app);
|
||||
furi_timer_start(state->timer, RAW_READ_TIME);
|
||||
state->is_psk = true;
|
||||
|
||||
furi_timer_start(state->timer, RAW_READ_TIME_MS);
|
||||
|
||||
popup_set_header(popup, "Reading PSK", 91, 16, AlignCenter, AlignTop);
|
||||
notification_message(app->notifications, &sequence_blink_start_yellow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
|
@ -117,12 +132,13 @@ void lfrfid_scene_raw_read_on_exit(void* context) {
|
|||
LfRfidReadRawState* state =
|
||||
(LfRfidReadRawState*)scene_manager_get_scene_state(app->scene_manager, LfRfidSceneRawRead);
|
||||
|
||||
notification_message(app->notifications, &sequence_blink_stop);
|
||||
popup_reset(app->popup);
|
||||
lfrfid_worker_stop(app->lfworker);
|
||||
lfrfid_worker_stop_thread(app->lfworker);
|
||||
furi_timer_free(state->timer);
|
||||
|
||||
furi_timer_free(state->timer);
|
||||
furi_string_free(state->string_file_name);
|
||||
free(state);
|
||||
|
||||
popup_reset(app->popup);
|
||||
notification_message(app->notifications, &sequence_blink_stop);
|
||||
}
|
||||
|
|
|
@ -4,16 +4,20 @@ void lfrfid_scene_raw_success_on_enter(void* context) {
|
|||
LfRfid* app = context;
|
||||
Widget* widget = app->widget;
|
||||
|
||||
widget_add_button_element(widget, GuiButtonTypeCenter, "OK", lfrfid_widget_callback, app);
|
||||
|
||||
widget_add_string_multiline_element(
|
||||
widget_add_text_box_element(
|
||||
widget,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
128,
|
||||
64,
|
||||
AlignLeft,
|
||||
AlignTop,
|
||||
FontSecondary,
|
||||
"RAW RFID read success!\nNow you can analyze files\nOr send them to developers");
|
||||
"\e#RAW RFID Read Success\e#\n"
|
||||
"Now you can analyze files or\n"
|
||||
"send them to developers",
|
||||
false);
|
||||
|
||||
widget_add_button_element(widget, GuiButtonTypeCenter, "OK", lfrfid_widget_callback, app);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget);
|
||||
}
|
||||
|
@ -24,12 +28,16 @@ bool lfrfid_scene_raw_success_on_event(void* context, SceneManagerEvent event) {
|
|||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
consumed = true;
|
||||
if(event.event == GuiButtonTypeCenter) {
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
scene_manager, LfRfidSceneExtraActions);
|
||||
}
|
||||
consumed = true;
|
||||
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ bool lfrfid_scene_read_key_menu_on_event(void* context, SceneManagerEvent event)
|
|||
consumed = true;
|
||||
}
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneReadKeyMenu, event.event);
|
||||
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneReadKeyMenu, 0);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
|
|
|
@ -1,56 +1,55 @@
|
|||
#include "../lfrfid_i.h"
|
||||
|
||||
#define LFRFID_SCENE_READ_SUCCESS_MAX_HEX_WIDTH (7UL)
|
||||
|
||||
void lfrfid_scene_read_success_on_enter(void* context) {
|
||||
LfRfid* app = context;
|
||||
Widget* widget = app->widget;
|
||||
FuriString* display_text = furi_string_alloc();
|
||||
|
||||
FuriString* tmp_string;
|
||||
tmp_string = furi_string_alloc();
|
||||
const char* protocol = protocol_dict_get_name(app->dict, app->protocol_id);
|
||||
const char* manufacturer = protocol_dict_get_manufacturer(app->dict, app->protocol_id);
|
||||
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Retry", lfrfid_widget_callback, app);
|
||||
widget_add_button_element(widget, GuiButtonTypeRight, "More", lfrfid_widget_callback, app);
|
||||
|
||||
furi_string_printf(
|
||||
tmp_string,
|
||||
"%s[%s]",
|
||||
protocol_dict_get_name(app->dict, app->protocol_id),
|
||||
protocol_dict_get_manufacturer(app->dict, app->protocol_id));
|
||||
|
||||
widget_add_string_element(
|
||||
widget, 16, 3, AlignLeft, AlignTop, FontPrimary, furi_string_get_cstr(tmp_string));
|
||||
|
||||
furi_string_reset(tmp_string);
|
||||
size_t size = protocol_dict_get_data_size(app->dict, app->protocol_id);
|
||||
uint8_t* data = (uint8_t*)malloc(size);
|
||||
protocol_dict_get_data(app->dict, app->protocol_id, data, size);
|
||||
for(uint8_t i = 0; i < size; i++) {
|
||||
if(i >= 9) {
|
||||
furi_string_cat_printf(tmp_string, "..");
|
||||
break;
|
||||
} else {
|
||||
if(i != 0) {
|
||||
furi_string_cat_printf(tmp_string, ":");
|
||||
}
|
||||
furi_string_cat_printf(tmp_string, "%02X", data[i]);
|
||||
}
|
||||
if(strcasecmp(protocol, manufacturer) != 0 && strcasecmp(manufacturer, "N/A") != 0) {
|
||||
furi_string_printf(display_text, "\e#%s %s\e#", manufacturer, protocol);
|
||||
} else {
|
||||
furi_string_printf(display_text, "\e#%s\e#", protocol);
|
||||
}
|
||||
|
||||
furi_string_cat(display_text, "\nHex: ");
|
||||
|
||||
const size_t data_size = protocol_dict_get_data_size(app->dict, app->protocol_id);
|
||||
uint8_t* data = malloc(data_size);
|
||||
|
||||
protocol_dict_get_data(app->dict, app->protocol_id, data, data_size);
|
||||
|
||||
for(size_t i = 0; i < data_size; i++) {
|
||||
if(i == LFRFID_SCENE_READ_SUCCESS_MAX_HEX_WIDTH) {
|
||||
furi_string_cat(display_text, " ...");
|
||||
break;
|
||||
}
|
||||
|
||||
furi_string_cat_printf(display_text, "%s%02X", i != 0 ? " " : "", data[i]);
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
FuriString* render_data;
|
||||
render_data = furi_string_alloc();
|
||||
protocol_dict_render_brief_data(app->dict, render_data, app->protocol_id);
|
||||
furi_string_cat_printf(tmp_string, "\r\n%s", furi_string_get_cstr(render_data));
|
||||
furi_string_free(render_data);
|
||||
FuriString* rendered_data = furi_string_alloc();
|
||||
protocol_dict_render_brief_data(app->dict, rendered_data, app->protocol_id);
|
||||
furi_string_cat_printf(display_text, "\n%s", furi_string_get_cstr(rendered_data));
|
||||
furi_string_free(rendered_data);
|
||||
|
||||
widget_add_string_multiline_element(
|
||||
widget, 0, 16, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(tmp_string));
|
||||
widget_add_text_box_element(
|
||||
widget, 0, 0, 128, 52, AlignLeft, AlignTop, furi_string_get_cstr(display_text), true);
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Retry", lfrfid_widget_callback, app);
|
||||
widget_add_button_element(widget, GuiButtonTypeRight, "More", lfrfid_widget_callback, app);
|
||||
|
||||
widget_add_icon_element(app->widget, 0, 0, &I_RFIDSmallChip_14x14);
|
||||
|
||||
notification_message_block(app->notifications, &sequence_set_green_255);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget);
|
||||
furi_string_free(tmp_string);
|
||||
furi_string_free(display_text);
|
||||
}
|
||||
|
||||
bool lfrfid_scene_read_success_on_event(void* context, SceneManagerEvent event) {
|
||||
|
|
|
@ -4,12 +4,11 @@ void lfrfid_scene_retry_confirm_on_enter(void* context) {
|
|||
LfRfid* app = context;
|
||||
Widget* widget = app->widget;
|
||||
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Exit", lfrfid_widget_callback, app);
|
||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Retry", lfrfid_widget_callback, app);
|
||||
widget_add_button_element(widget, GuiButtonTypeRight, "Stay", lfrfid_widget_callback, app);
|
||||
widget_add_string_element(widget, 64, 0, AlignCenter, AlignTop, FontPrimary, "Retry Reading?");
|
||||
widget_add_string_element(
|
||||
widget, 64, 19, AlignCenter, AlignBottom, FontPrimary, "Retry Reading?");
|
||||
widget_add_string_element(
|
||||
widget, 64, 29, AlignCenter, AlignBottom, FontSecondary, "All unsaved data will be lost!");
|
||||
widget, 64, 13, AlignCenter, AlignTop, FontSecondary, "All unsaved data will be lost");
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget);
|
||||
}
|
||||
|
|
|
@ -21,16 +21,9 @@ bool lfrfid_scene_save_success_on_event(void* context, SceneManagerEvent event)
|
|||
LfRfid* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
const uint32_t prev_scenes[] = {LfRfidSceneReadKeyMenu, LfRfidSceneSelectKey};
|
||||
|
||||
if((event.type == SceneManagerEventTypeBack) ||
|
||||
((event.type == SceneManagerEventTypeCustom) && (event.event == LfRfidEventPopupClosed))) {
|
||||
bool result = scene_manager_search_and_switch_to_previous_scene_one_of(
|
||||
app->scene_manager, prev_scenes, COUNT_OF(prev_scenes));
|
||||
if(!result) {
|
||||
scene_manager_search_and_switch_to_another_scene(
|
||||
app->scene_manager, LfRfidSceneSelectKey);
|
||||
}
|
||||
if(event.type == SceneManagerEventTypeBack || event.type == SceneManagerEventTypeCustom) {
|
||||
// Always return to SceneSelectKey from here
|
||||
scene_manager_search_and_switch_to_another_scene(app->scene_manager, LfRfidSceneSelectKey);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,38 +4,42 @@ void lfrfid_scene_saved_info_on_enter(void* context) {
|
|||
LfRfid* app = context;
|
||||
Widget* widget = app->widget;
|
||||
|
||||
FuriString* tmp_string;
|
||||
tmp_string = furi_string_alloc();
|
||||
FuriString* display_text = furi_string_alloc();
|
||||
|
||||
furi_string_printf(
|
||||
tmp_string,
|
||||
"%s [%s]\r\n",
|
||||
furi_string_get_cstr(app->file_name),
|
||||
protocol_dict_get_name(app->dict, app->protocol_id));
|
||||
furi_string_printf(display_text, "Name: %s\n", furi_string_get_cstr(app->file_name));
|
||||
|
||||
size_t size = protocol_dict_get_data_size(app->dict, app->protocol_id);
|
||||
uint8_t* data = (uint8_t*)malloc(size);
|
||||
protocol_dict_get_data(app->dict, app->protocol_id, data, size);
|
||||
for(uint8_t i = 0; i < size; i++) {
|
||||
if(i != 0) {
|
||||
furi_string_cat_printf(tmp_string, ":");
|
||||
}
|
||||
const char* protocol = protocol_dict_get_name(app->dict, app->protocol_id);
|
||||
const char* manufacturer = protocol_dict_get_manufacturer(app->dict, app->protocol_id);
|
||||
|
||||
furi_string_cat_printf(tmp_string, "%02X", data[i]);
|
||||
if(strcasecmp(protocol, manufacturer) != 0 && strcasecmp(manufacturer, "N/A") != 0) {
|
||||
furi_string_cat_printf(display_text, "\e#%s %s", manufacturer, protocol);
|
||||
} else {
|
||||
furi_string_cat_printf(display_text, "\e#%s", protocol);
|
||||
}
|
||||
|
||||
furi_string_cat(display_text, "\nHex: ");
|
||||
|
||||
const size_t data_size = protocol_dict_get_data_size(app->dict, app->protocol_id);
|
||||
uint8_t* data = malloc(data_size);
|
||||
|
||||
protocol_dict_get_data(app->dict, app->protocol_id, data, data_size);
|
||||
|
||||
for(size_t i = 0; i < data_size; i++) {
|
||||
furi_string_cat_printf(display_text, "%s%02X", i != 0 ? " " : "", data[i]);
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
FuriString* render_data;
|
||||
render_data = furi_string_alloc();
|
||||
protocol_dict_render_data(app->dict, render_data, app->protocol_id);
|
||||
furi_string_cat_printf(tmp_string, "\r\n%s", furi_string_get_cstr(render_data));
|
||||
furi_string_free(render_data);
|
||||
FuriString* rendered_data;
|
||||
rendered_data = furi_string_alloc();
|
||||
protocol_dict_render_data(app->dict, rendered_data, app->protocol_id);
|
||||
furi_string_cat_printf(display_text, "\n%s", furi_string_get_cstr(rendered_data));
|
||||
furi_string_free(rendered_data);
|
||||
|
||||
widget_add_string_multiline_element(
|
||||
widget, 0, 1, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(tmp_string));
|
||||
widget_add_text_scroll_element(widget, 0, 0, 128, 64, furi_string_get_cstr(display_text));
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewWidget);
|
||||
furi_string_free(tmp_string);
|
||||
furi_string_free(display_text);
|
||||
}
|
||||
|
||||
bool lfrfid_scene_saved_info_on_event(void* context, SceneManagerEvent event) {
|
||||
|
|
|
@ -71,6 +71,9 @@ bool lfrfid_scene_saved_key_menu_on_event(void* context, SceneManagerEvent event
|
|||
consumed = true;
|
||||
}
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneSavedKeyMenu, event.event);
|
||||
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneSavedKeyMenu, 0);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
|
|
|
@ -6,7 +6,9 @@ void lfrfid_scene_select_key_on_enter(void* context) {
|
|||
if(lfrfid_load_key_from_file_select(app)) {
|
||||
scene_manager_next_scene(app->scene_manager, LfRfidSceneSavedKeyMenu);
|
||||
} else {
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
// Always select "Saved" menu item when returning from this scene
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexSaved);
|
||||
scene_manager_search_and_switch_to_previous_scene(app->scene_manager, LfRfidSceneStart);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
#include "../lfrfid_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
typedef enum {
|
||||
SubmenuIndexRead,
|
||||
SubmenuIndexSaved,
|
||||
SubmenuIndexAddManually,
|
||||
SubmenuIndexExtraActions,
|
||||
} SubmenuIndex;
|
||||
|
||||
static void lfrfid_scene_start_submenu_callback(void* context, uint32_t index) {
|
||||
LfRfid* app = context;
|
||||
|
||||
|
@ -18,15 +11,20 @@ void lfrfid_scene_start_on_enter(void* context) {
|
|||
LfRfid* app = context;
|
||||
Submenu* submenu = app->submenu;
|
||||
|
||||
submenu_add_item(submenu, "Read", SubmenuIndexRead, lfrfid_scene_start_submenu_callback, app);
|
||||
submenu_add_item(
|
||||
submenu, "Saved", SubmenuIndexSaved, lfrfid_scene_start_submenu_callback, app);
|
||||
submenu, "Read", LfRfidMenuIndexRead, lfrfid_scene_start_submenu_callback, app);
|
||||
submenu_add_item(
|
||||
submenu, "Add Manually", SubmenuIndexAddManually, lfrfid_scene_start_submenu_callback, app);
|
||||
submenu, "Saved", LfRfidMenuIndexSaved, lfrfid_scene_start_submenu_callback, app);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Add Manually",
|
||||
LfRfidMenuIndexAddManually,
|
||||
lfrfid_scene_start_submenu_callback,
|
||||
app);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Extra Actions",
|
||||
SubmenuIndexExtraActions,
|
||||
LfRfidMenuIndexExtraActions,
|
||||
lfrfid_scene_start_submenu_callback,
|
||||
app);
|
||||
|
||||
|
@ -46,26 +44,28 @@ bool lfrfid_scene_start_on_event(void* context, SceneManagerEvent event) {
|
|||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexRead) {
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, SubmenuIndexRead);
|
||||
if(event.event == LfRfidMenuIndexRead) {
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexRead);
|
||||
scene_manager_next_scene(app->scene_manager, LfRfidSceneRead);
|
||||
dolphin_deed(DolphinDeedRfidRead);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexSaved) {
|
||||
} else if(event.event == LfRfidMenuIndexSaved) {
|
||||
// Like in the other apps, explicitly save the scene state
|
||||
// in each branch in case the user cancels loading a file.
|
||||
scene_manager_set_scene_state(app->scene_manager, LfRfidSceneStart, SubmenuIndexSaved);
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexSaved);
|
||||
furi_string_set(app->file_path, LFRFID_APP_FOLDER);
|
||||
scene_manager_next_scene(app->scene_manager, LfRfidSceneSelectKey);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexAddManually) {
|
||||
} else if(event.event == LfRfidMenuIndexAddManually) {
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, LfRfidSceneStart, SubmenuIndexAddManually);
|
||||
app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexAddManually);
|
||||
scene_manager_next_scene(app->scene_manager, LfRfidSceneSaveType);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexExtraActions) {
|
||||
} else if(event.event == LfRfidMenuIndexExtraActions) {
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, LfRfidSceneStart, SubmenuIndexExtraActions);
|
||||
app->scene_manager, LfRfidSceneStart, LfRfidMenuIndexExtraActions);
|
||||
scene_manager_next_scene(app->scene_manager, LfRfidSceneExtraActions);
|
||||
consumed = true;
|
||||
}
|
||||
|
|
|
@ -21,19 +21,19 @@ void lfrfid_scene_write_on_enter(void* context) {
|
|||
LfRfid* app = context;
|
||||
Popup* popup = app->popup;
|
||||
|
||||
popup_set_header(popup, "Writing", 89, 30, AlignCenter, AlignTop);
|
||||
popup_set_icon(popup, 0, 8, &I_NFC_manual_60x50);
|
||||
popup_set_header(popup, "Writing", 94, 16, AlignCenter, AlignTop);
|
||||
|
||||
if(!furi_string_empty(app->file_name)) {
|
||||
popup_set_text(popup, furi_string_get_cstr(app->file_name), 89, 43, AlignCenter, AlignTop);
|
||||
popup_set_text(popup, furi_string_get_cstr(app->file_name), 94, 29, AlignCenter, AlignTop);
|
||||
} else {
|
||||
popup_set_text(
|
||||
popup,
|
||||
protocol_dict_get_name(app->dict, app->protocol_id),
|
||||
89,
|
||||
43,
|
||||
AlignCenter,
|
||||
AlignTop);
|
||||
snprintf(
|
||||
app->text_store,
|
||||
LFRFID_TEXT_STORE_SIZE,
|
||||
"Unsaved\n%s",
|
||||
protocol_dict_get_name(app->dict, app->protocol_id));
|
||||
popup_set_text(popup, app->text_store, 94, 29, AlignCenter, AlignTop);
|
||||
}
|
||||
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
|
||||
|
||||
|
@ -66,12 +66,14 @@ bool lfrfid_scene_write_on_event(void* context, SceneManagerEvent event) {
|
|||
(event.event == LfRfidEventWriteFobCannotBeWritten) ||
|
||||
(event.event == LfRfidEventWriteTooLongToWrite)) {
|
||||
popup_set_icon(popup, 83, 22, &I_WarningDolphinFlip_45x42);
|
||||
popup_set_header(popup, "Still trying to write...", 64, 3, AlignCenter, AlignTop);
|
||||
popup_set_header(popup, "Still Trying to Write...", 64, 0, AlignCenter, AlignTop);
|
||||
popup_set_text(
|
||||
popup,
|
||||
"Make sure this\ncard is writable\nand not\nprotected.",
|
||||
3,
|
||||
17,
|
||||
"Make sure this\n"
|
||||
"card is writable\n"
|
||||
"and not protected",
|
||||
0,
|
||||
13,
|
||||
AlignLeft,
|
||||
AlignTop);
|
||||
notification_message(app->notifications, &sequence_blink_start_yellow);
|
||||
|
|
|
@ -19,12 +19,12 @@ bool lfrfid_scene_write_success_on_event(void* context, SceneManagerEvent event)
|
|||
LfRfid* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
const uint32_t prev_scenes[] = {LfRfidSceneReadKeyMenu, LfRfidSceneSelectKey};
|
||||
|
||||
if((event.type == SceneManagerEventTypeBack) ||
|
||||
((event.type == SceneManagerEventTypeCustom) && (event.event == LfRfidEventPopupClosed))) {
|
||||
scene_manager_search_and_switch_to_previous_scene_one_of(
|
||||
app->scene_manager, prev_scenes, COUNT_OF(prev_scenes));
|
||||
if(event.type == SceneManagerEventTypeBack || event.type == SceneManagerEventTypeCustom) {
|
||||
if(!scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, LfRfidSceneReadKeyMenu)) {
|
||||
scene_manager_search_and_switch_to_another_scene(
|
||||
app->scene_manager, LfRfidSceneSelectKey);
|
||||
}
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -464,21 +464,21 @@ void parse_transport_type(BlockData* data_block, FuriString* transport) {
|
|||
bool mosgortrans_parse_transport_block(const MfClassicBlock* block, FuriString* result) {
|
||||
BlockData data_block = {};
|
||||
const uint16_t valid_departments[] = {0x106, 0x108, 0x10A, 0x10E, 0x110, 0x117};
|
||||
uint16_t transport_departament = bit_lib_get_bits_16(block->data, 0, 10);
|
||||
uint16_t transport_department = bit_lib_get_bits_16(block->data, 0, 10);
|
||||
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
|
||||
furi_string_cat_printf(result, "Transport departament: %x\n", transport_departament);
|
||||
furi_string_cat_printf(result, "Transport department: %x\n", transport_department);
|
||||
}
|
||||
bool departament_valid = false;
|
||||
bool department_valid = false;
|
||||
for(uint8_t i = 0; i < 6; i++) {
|
||||
if(transport_departament == valid_departments[i]) {
|
||||
departament_valid = true;
|
||||
if(transport_department == valid_departments[i]) {
|
||||
department_valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!departament_valid) {
|
||||
if(!department_valid) {
|
||||
return false;
|
||||
}
|
||||
FURI_LOG_D(TAG, "Transport departament: %x", transport_departament);
|
||||
FURI_LOG_D(TAG, "Transport department: %x", transport_department);
|
||||
uint16_t layout_type = bit_lib_get_bits_16(block->data, 52, 4);
|
||||
if(layout_type == 0xE) {
|
||||
layout_type = bit_lib_get_bits_16(block->data, 52, 9);
|
||||
|
|
|
@ -30,6 +30,8 @@ static void nfc_scene_info_on_enter_mf_ultralight(NfcApp* instance) {
|
|||
|
||||
furi_string_cat_printf(
|
||||
temp_str, "\e#%s\n", nfc_device_get_name(device, NfcDeviceNameTypeFull));
|
||||
furi_string_replace(temp_str, "Mifare", "MIFARE");
|
||||
|
||||
nfc_render_mf_ultralight_info(data, NfcProtocolFormatTypeFull, temp_str);
|
||||
|
||||
widget_add_text_scroll_element(
|
||||
|
|
|
@ -1,22 +1,28 @@
|
|||
#include "st25tb_render.h"
|
||||
#include <nfc/protocols/st25tb/st25tb.h>
|
||||
#include <machine/endian.h>
|
||||
|
||||
void nfc_render_st25tb_info(
|
||||
const St25tbData* data,
|
||||
NfcProtocolFormatType format_type,
|
||||
FuriString* str) {
|
||||
furi_string_cat_printf(str, "UID");
|
||||
furi_string_cat_printf(str, "UID:");
|
||||
|
||||
for(size_t i = 0; i < ST25TB_UID_SIZE; i++) {
|
||||
furi_string_cat_printf(str, " %02X", data->uid[i]);
|
||||
}
|
||||
|
||||
if(format_type == NfcProtocolFormatTypeFull) {
|
||||
furi_string_cat_printf(str, "\nSys. OTP: %08lX", data->system_otp_block);
|
||||
furi_string_cat_printf(str, "\nBlocks:");
|
||||
furi_string_cat_printf(
|
||||
str, "\nSys. OTP: %08lX", (uint32_t)__bswap32(data->system_otp_block));
|
||||
furi_string_cat_printf(str, "\n::::::::::::::::::::::[Blocks]::::::::::::::::::::::");
|
||||
for(size_t i = 0; i < st25tb_get_block_count(data->type); i += 2) {
|
||||
furi_string_cat_printf(
|
||||
str, "\n %02X %08lX %08lX", i, data->blocks[i], data->blocks[i + 1]);
|
||||
str,
|
||||
"\n %02X %08lX %08lX",
|
||||
i,
|
||||
(uint32_t)__bswap32(data->blocks[i]),
|
||||
(uint32_t)__bswap32(data->blocks[i + 1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -453,7 +453,7 @@ void nfc_append_filename_string_when_present(NfcApp* instance, FuriString* strin
|
|||
furi_assert(string);
|
||||
|
||||
if(!furi_string_empty(instance->file_name)) {
|
||||
furi_string_cat_printf(string, "Name:%s\n", furi_string_get_cstr(instance->file_name));
|
||||
furi_string_cat_printf(string, "Name: %s\n", furi_string_get_cstr(instance->file_name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,11 +86,10 @@ static bool mykey_parse(const NfcDevice* device, FuriString* parsed_data) {
|
|||
|
||||
bool is_blank = mykey_is_blank(data);
|
||||
furi_string_cat_printf(parsed_data, "Serial#: %08lX\n", (uint32_t)__bswap32(data->blocks[7]));
|
||||
furi_string_cat_printf(parsed_data, "Blank: %s\n", is_blank ? "yes" : "no");
|
||||
furi_string_cat_printf(parsed_data, "LockID: %s\n", mykey_has_lockid(data) ? "maybe" : "no");
|
||||
|
||||
furi_string_cat_printf(
|
||||
parsed_data, "Prod. date: %02X/%02X/%04X", mfg_day, mfg_month, mfg_year);
|
||||
parsed_data, "Prod. date: %02X/%02X/%04X\n", mfg_day, mfg_month, mfg_year);
|
||||
furi_string_cat_printf(parsed_data, "Blank: %s\n", is_blank ? "yes" : "no");
|
||||
furi_string_cat_printf(parsed_data, "LockID: %s", mykey_has_lockid(data) ? "maybe" : "no");
|
||||
|
||||
if(!is_blank) {
|
||||
furi_string_cat_printf(
|
||||
|
|
|
@ -804,10 +804,9 @@ void elements_text_box(
|
|||
}
|
||||
line[line_num].y = total_height_min;
|
||||
line_num++;
|
||||
if(text[i + 1]) {
|
||||
if(!full_text_processed) {
|
||||
line[line_num].text = &text[i + 1];
|
||||
}
|
||||
|
||||
line_leading_min = font_params->leading_min;
|
||||
line_height = font_params->height;
|
||||
line_descender = font_params->descender;
|
||||
|
@ -850,29 +849,32 @@ void elements_text_box(
|
|||
for(size_t i = 0; i < line_num; i++) {
|
||||
for(size_t j = 0; j < line[i].len; j++) {
|
||||
// Process format symbols
|
||||
if(line[i].text[j] == ELEMENTS_BOLD_MARKER) {
|
||||
if(bold) {
|
||||
current_font = FontSecondary;
|
||||
} else {
|
||||
current_font = FontPrimary;
|
||||
if(line[i].text[j] == '\e' && j < line[i].len - 1) {
|
||||
++j;
|
||||
if(line[i].text[j] == ELEMENTS_BOLD_MARKER) {
|
||||
if(bold) {
|
||||
current_font = FontSecondary;
|
||||
} else {
|
||||
current_font = FontPrimary;
|
||||
}
|
||||
canvas_set_font(canvas, current_font);
|
||||
bold = !bold;
|
||||
continue;
|
||||
}
|
||||
canvas_set_font(canvas, current_font);
|
||||
bold = !bold;
|
||||
continue;
|
||||
}
|
||||
if(line[i].text[j] == ELEMENTS_MONO_MARKER) {
|
||||
if(mono) {
|
||||
current_font = FontSecondary;
|
||||
} else {
|
||||
current_font = FontKeyboard;
|
||||
if(line[i].text[j] == ELEMENTS_MONO_MARKER) {
|
||||
if(mono) {
|
||||
current_font = FontSecondary;
|
||||
} else {
|
||||
current_font = FontKeyboard;
|
||||
}
|
||||
canvas_set_font(canvas, current_font);
|
||||
mono = !mono;
|
||||
continue;
|
||||
}
|
||||
if(line[i].text[j] == ELEMENTS_INVERSE_MARKER) {
|
||||
inverse = !inverse;
|
||||
continue;
|
||||
}
|
||||
canvas_set_font(canvas, current_font);
|
||||
mono = !mono;
|
||||
continue;
|
||||
}
|
||||
if(line[i].text[j] == ELEMENTS_INVERSE_MARKER) {
|
||||
inverse = !inverse;
|
||||
continue;
|
||||
}
|
||||
if(inverse) {
|
||||
canvas_draw_box(
|
||||
|
|
BIN
assets/dolphin/external/L1_Mods_128x64/frame_21.png
vendored
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_22.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 2.7 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_23.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_24.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_25.png
vendored
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_26.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_27.png
vendored
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_28.png
vendored
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_29.png
vendored
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_30.png
vendored
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_31.png
vendored
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_32.png
vendored
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 2.9 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_33.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.1 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_34.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_35.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_36.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_37.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_38.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_39.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_40.png
vendored
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_41.png
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_42.png
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_43.png
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_44.png
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_45.png
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_46.png
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_47.png
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/dolphin/external/L1_Mods_128x64/frame_48.png
vendored
Normal file
After Width: | Height: | Size: 4.2 KiB |
|
@ -3,9 +3,9 @@ Version: 1
|
|||
|
||||
Width: 128
|
||||
Height: 64
|
||||
Passive frames: 23
|
||||
Passive frames: 31
|
||||
Active frames: 18
|
||||
Frames order: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
||||
Frames order: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
||||
Active cycles: 1
|
||||
Frame rate: 2
|
||||
Duration: 3600
|
||||
|
|
|
@ -164,7 +164,8 @@ void protocol_awid_render_data(ProtocolAwid* protocol, FuriString* result) {
|
|||
uint8_t* decoded_data = protocol->data;
|
||||
uint8_t format_length = decoded_data[0];
|
||||
|
||||
furi_string_cat_printf(result, "Format: %d\r\n", format_length);
|
||||
furi_string_printf(result, "Format: %hhu\n", format_length);
|
||||
|
||||
if(format_length == 26) {
|
||||
uint8_t facility;
|
||||
bit_lib_copy_bits(&facility, 0, 8, decoded_data, 9);
|
||||
|
@ -172,13 +173,17 @@ void protocol_awid_render_data(ProtocolAwid* protocol, FuriString* result) {
|
|||
uint16_t card_id;
|
||||
bit_lib_copy_bits((uint8_t*)&card_id, 8, 8, decoded_data, 17);
|
||||
bit_lib_copy_bits((uint8_t*)&card_id, 0, 8, decoded_data, 25);
|
||||
furi_string_cat_printf(result, "Facility: %d\r\n", facility);
|
||||
furi_string_cat_printf(result, "Card: %d", card_id);
|
||||
furi_string_cat_printf(
|
||||
result,
|
||||
"FC: %hhu\n"
|
||||
"Card: %hu",
|
||||
facility,
|
||||
card_id);
|
||||
} else {
|
||||
// print 66 bits as hex
|
||||
furi_string_cat_printf(result, "Data: ");
|
||||
for(size_t i = 0; i < AWID_DECODED_DATA_SIZE; i++) {
|
||||
furi_string_cat_printf(result, "%02X", decoded_data[i]);
|
||||
furi_string_cat_printf(result, "%02hhX", decoded_data[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -187,7 +192,8 @@ void protocol_awid_render_brief_data(ProtocolAwid* protocol, FuriString* result)
|
|||
uint8_t* decoded_data = protocol->data;
|
||||
uint8_t format_length = decoded_data[0];
|
||||
|
||||
furi_string_cat_printf(result, "Format: %d\r\n", format_length);
|
||||
furi_string_printf(result, "Format: %hhu", format_length);
|
||||
|
||||
if(format_length == 26) {
|
||||
uint8_t facility;
|
||||
bit_lib_copy_bits(&facility, 0, 8, decoded_data, 9);
|
||||
|
@ -195,9 +201,14 @@ void protocol_awid_render_brief_data(ProtocolAwid* protocol, FuriString* result)
|
|||
uint16_t card_id;
|
||||
bit_lib_copy_bits((uint8_t*)&card_id, 8, 8, decoded_data, 17);
|
||||
bit_lib_copy_bits((uint8_t*)&card_id, 0, 8, decoded_data, 25);
|
||||
furi_string_cat_printf(result, "ID: %03u,%05u", facility, card_id);
|
||||
furi_string_cat_printf(
|
||||
result,
|
||||
"; FC: %hhu\n"
|
||||
"Card: %hu",
|
||||
facility,
|
||||
card_id);
|
||||
} else {
|
||||
furi_string_cat_printf(result, "Data: unknown");
|
||||
furi_string_cat(result, "\nData: Unknown");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -330,7 +330,8 @@ void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) {
|
|||
uint8_t* data = protocol->data;
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %03u, Card: %05u\n(RF/%u)",
|
||||
"FC: %03u\n"
|
||||
"Card: %05hu (RF/%hhu)",
|
||||
data[2],
|
||||
(uint16_t)((data[3] << 8) | (data[4])),
|
||||
protocol->clock_per_bit);
|
||||
|
|
|
@ -217,14 +217,10 @@ void protocol_fdx_a_render_data(ProtocolFDXA* protocol, FuriString* result) {
|
|||
|
||||
furi_string_printf(
|
||||
result,
|
||||
"ID: %02X%02X%02X%02X%02X\r\n"
|
||||
"Parity: %s",
|
||||
data[0],
|
||||
data[1],
|
||||
data[2],
|
||||
data[3],
|
||||
data[4],
|
||||
parity_sum == 0 ? "+" : "-");
|
||||
"ID: %010llX\n"
|
||||
"Parity: %c",
|
||||
bit_lib_get_bits_64(data, 0, 40),
|
||||
parity_sum == 0 ? '+' : '-');
|
||||
};
|
||||
|
||||
const ProtocolBase protocol_fdx_a = {
|
||||
|
|
|
@ -288,21 +288,33 @@ void protocol_fdx_b_render_data(ProtocolFDXB* protocol, FuriString* result) {
|
|||
uint8_t replacement_number = bit_lib_get_bits(protocol->data, 60, 3);
|
||||
bool animal_flag = bit_lib_get_bit(protocol->data, 63);
|
||||
|
||||
furi_string_printf(result, "ID: %03u-%012llu\r\n", country_code, national_code);
|
||||
furi_string_cat_printf(result, "Animal: %s, ", animal_flag ? "Yes" : "No");
|
||||
furi_string_printf(
|
||||
result,
|
||||
"ID: %03hu-%012llu\n"
|
||||
"Country Code: %hu\n"
|
||||
"Temperature: ",
|
||||
country_code,
|
||||
national_code,
|
||||
country_code);
|
||||
|
||||
float temperature;
|
||||
if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
|
||||
float temperature_c = (temperature - 32) / 1.8;
|
||||
furi_string_cat_printf(
|
||||
result, "T: %.2fF, %.2fC\r\n", (double)temperature, (double)temperature_c);
|
||||
if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
|
||||
float temperature_c = (temperature - 32.0f) / 1.8f;
|
||||
furi_string_cat_printf(result, "%.2fC", (double)temperature_c);
|
||||
} else {
|
||||
furi_string_cat_printf(result, "%.2fF", (double)temperature);
|
||||
}
|
||||
} else {
|
||||
furi_string_cat_printf(result, "T: ---\r\n");
|
||||
furi_string_cat(result, "---");
|
||||
}
|
||||
|
||||
furi_string_cat_printf(
|
||||
result,
|
||||
"Bits: %X-%X-%X-%X-%X",
|
||||
"\n"
|
||||
"Animal: %s\n"
|
||||
"Bits: %hhX-%hhX-%hhX-%hhX-%hhX",
|
||||
animal_flag ? "Yes" : "No",
|
||||
block_status,
|
||||
rudi_bit,
|
||||
reserved,
|
||||
|
@ -317,21 +329,24 @@ void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result
|
|||
// 10 bit of country code
|
||||
uint16_t country_code = protocol_fdx_b_get_country_code(protocol->data);
|
||||
|
||||
bool animal_flag = bit_lib_get_bit(protocol->data, 63);
|
||||
|
||||
furi_string_printf(result, "ID: %03u-%012llu\r\n", country_code, national_code);
|
||||
furi_string_cat_printf(result, "Animal: %s, ", animal_flag ? "Yes" : "No");
|
||||
furi_string_printf(
|
||||
result,
|
||||
"ID: %03hu-%012llu\n"
|
||||
"Country: %hu; Temp.: ",
|
||||
country_code,
|
||||
national_code,
|
||||
country_code);
|
||||
|
||||
float temperature;
|
||||
if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
|
||||
if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
|
||||
float temperature_c = (temperature - 32.0f) / 1.8f;
|
||||
furi_string_cat_printf(result, "T: %.2fC", (double)temperature_c);
|
||||
furi_string_cat_printf(result, "%.2fC", (double)temperature_c);
|
||||
} else {
|
||||
furi_string_cat_printf(result, "T: %.2fF", (double)temperature);
|
||||
furi_string_cat_printf(result, "%.2fF", (double)temperature);
|
||||
}
|
||||
} else {
|
||||
furi_string_cat_printf(result, "T: ---");
|
||||
furi_string_cat(result, "---");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -268,17 +268,44 @@ bool protocol_gallagher_write_data(ProtocolGallagher* protocol, void* data) {
|
|||
return result;
|
||||
};
|
||||
|
||||
void protocol_gallagher_render_data(ProtocolGallagher* protocol, FuriString* result) {
|
||||
UNUSED(protocol);
|
||||
uint8_t rc = bit_lib_get_bits(protocol->data, 0, 4);
|
||||
uint8_t il = bit_lib_get_bits(protocol->data, 4, 4);
|
||||
static void protocol_gallagher_render_data_internal(
|
||||
ProtocolGallagher* protocol,
|
||||
FuriString* result,
|
||||
bool brief) {
|
||||
uint8_t region = bit_lib_get_bits(protocol->data, 0, 4);
|
||||
uint8_t issue_level = bit_lib_get_bits(protocol->data, 4, 4);
|
||||
uint32_t fc = bit_lib_get_bits_32(protocol->data, 8, 24);
|
||||
uint32_t card_id = bit_lib_get_bits_32(protocol->data, 32, 32);
|
||||
|
||||
furi_string_cat_printf(result, "Region: %u, Issue Level: %u\r\n", rc, il);
|
||||
furi_string_cat_printf(result, "FC: %lu, C: %lu\r\n", fc, card_id);
|
||||
if(brief) {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %lu\n"
|
||||
"Card: %lu",
|
||||
fc,
|
||||
card_id);
|
||||
} else {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %lu\n"
|
||||
"Card: %lu\n"
|
||||
"Region: %u\n"
|
||||
"Issue Level: %u",
|
||||
fc,
|
||||
card_id,
|
||||
region,
|
||||
issue_level);
|
||||
}
|
||||
};
|
||||
|
||||
void protocol_gallagher_render_data(ProtocolGallagher* protocol, FuriString* result) {
|
||||
protocol_gallagher_render_data_internal(protocol, result, false);
|
||||
}
|
||||
|
||||
void protocol_gallagher_render_brief_data(ProtocolGallagher* protocol, FuriString* result) {
|
||||
protocol_gallagher_render_data_internal(protocol, result, true);
|
||||
}
|
||||
|
||||
const ProtocolBase protocol_gallagher = {
|
||||
.name = "Gallagher",
|
||||
.manufacturer = "Gallagher",
|
||||
|
@ -299,6 +326,6 @@ const ProtocolBase protocol_gallagher = {
|
|||
.yield = (ProtocolEncoderYield)protocol_gallagher_encoder_yield,
|
||||
},
|
||||
.render_data = (ProtocolRenderData)protocol_gallagher_render_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_gallagher_render_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_gallagher_render_brief_data,
|
||||
.write_data = (ProtocolWriteData)protocol_gallagher_write_data,
|
||||
};
|
|
@ -359,8 +359,8 @@ void protocol_h10301_render_data(ProtocolH10301* protocol, FuriString* result) {
|
|||
uint8_t* data = protocol->data;
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %u\r\n"
|
||||
"Card: %u",
|
||||
"FC: %hhu\n"
|
||||
"Card: %hu",
|
||||
data[0],
|
||||
(uint16_t)((data[1] << 8) | (data[2])));
|
||||
};
|
||||
|
|
|
@ -193,9 +193,13 @@ bool protocol_hid_ex_generic_write_data(ProtocolHIDEx* protocol, void* data) {
|
|||
};
|
||||
|
||||
void protocol_hid_ex_generic_render_data(ProtocolHIDEx* protocol, FuriString* result) {
|
||||
// TODO FL-3518: parser and render functions
|
||||
UNUSED(protocol);
|
||||
furi_string_printf(result, "Generic HID Extended\r\nData: Unknown");
|
||||
|
||||
// TODO FL-3518: parser and render functions
|
||||
furi_string_set(
|
||||
result,
|
||||
"Type: Generic HID Extended\n"
|
||||
"Data: Unknown");
|
||||
};
|
||||
|
||||
const ProtocolBase protocol_hid_ex_generic = {
|
||||
|
|
|
@ -245,7 +245,7 @@ void protocol_hid_generic_render_data(ProtocolHID* protocol, FuriString* result)
|
|||
if(protocol_size == HID_PROTOCOL_SIZE_UNKNOWN) {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"Generic HID Proximity\r\n"
|
||||
"Generic HID Proximity\n"
|
||||
"Data: %02X%02X%02X%02X%02X%X",
|
||||
protocol->data[0],
|
||||
protocol->data[1],
|
||||
|
@ -256,7 +256,7 @@ void protocol_hid_generic_render_data(ProtocolHID* protocol, FuriString* result)
|
|||
} else {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"%hhu-bit HID Proximity\r\n"
|
||||
"%hhu-bit HID Proximity\n"
|
||||
"Data: ",
|
||||
protocol_size);
|
||||
protocol_hid_generic_string_cat_protocol_bits(protocol, protocol_size, result);
|
||||
|
|
|
@ -205,26 +205,16 @@ static uint32_t get_card(const uint8_t* data) {
|
|||
return cn;
|
||||
}
|
||||
|
||||
void protocol_idteck_render_data_internal(ProtocolIdteck* protocol, FuriString* result, bool brief) {
|
||||
void protocol_idteck_render_data(ProtocolIdteck* protocol, FuriString* result) {
|
||||
const uint32_t fc = get_fc(protocol->data);
|
||||
const uint32_t card = get_card(protocol->data);
|
||||
|
||||
if(brief) {
|
||||
furi_string_printf(result, "FC: %08lX\r\nCard: %08lX", fc, card);
|
||||
} else {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %08lX\r\n"
|
||||
"Card: %08lX\r\n",
|
||||
fc,
|
||||
card);
|
||||
}
|
||||
}
|
||||
void protocol_idteck_render_data(ProtocolIdteck* protocol, FuriString* result) {
|
||||
protocol_idteck_render_data_internal(protocol, result, false);
|
||||
}
|
||||
void protocol_idteck_render_brief_data(ProtocolIdteck* protocol, FuriString* result) {
|
||||
protocol_idteck_render_data_internal(protocol, result, true);
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %08lX\n"
|
||||
"Card: %08lX",
|
||||
fc,
|
||||
card);
|
||||
}
|
||||
|
||||
bool protocol_idteck_write_data(ProtocolIdteck* protocol, void* data) {
|
||||
|
@ -264,6 +254,6 @@ const ProtocolBase protocol_idteck = {
|
|||
.yield = (ProtocolEncoderYield)protocol_idteck_encoder_yield,
|
||||
},
|
||||
.render_data = (ProtocolRenderData)protocol_idteck_render_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_idteck_render_brief_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_idteck_render_data,
|
||||
.write_data = (ProtocolWriteData)protocol_idteck_write_data,
|
||||
};
|
|
@ -289,22 +289,21 @@ void protocol_indala26_render_data_internal(
|
|||
if(brief) {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %u\r\nCard: %u, Parity:%s%s",
|
||||
"FC: %u\n"
|
||||
"Card: %u",
|
||||
fc,
|
||||
card,
|
||||
(checksum_correct ? "+" : "-"),
|
||||
(wiegand_correct ? "+" : "-"));
|
||||
card);
|
||||
} else {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %u\r\n"
|
||||
"Card: %u\r\n"
|
||||
"Checksum: %s\r\n"
|
||||
"W26 Parity: %s",
|
||||
"FC: %u\n"
|
||||
"Card: %u\n"
|
||||
"Parity: %c\n"
|
||||
"Checksum: %c",
|
||||
fc,
|
||||
card,
|
||||
(checksum_correct ? "+" : "-"),
|
||||
(wiegand_correct ? "+" : "-"));
|
||||
(wiegand_correct ? '+' : '-'),
|
||||
(checksum_correct ? '+' : '-'));
|
||||
}
|
||||
}
|
||||
void protocol_indala26_render_data(ProtocolIndala* protocol, FuriString* result) {
|
||||
|
|
|
@ -236,9 +236,9 @@ void protocol_io_prox_xsf_render_data(ProtocolIOProxXSF* protocol, FuriString* r
|
|||
uint8_t* data = protocol->data;
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %u\r\n"
|
||||
"VС: %u\r\n"
|
||||
"Card: %u",
|
||||
"FC: %hhu\n"
|
||||
"V: %hhu\n"
|
||||
"Card: %hu",
|
||||
data[0],
|
||||
data[1],
|
||||
(uint16_t)((data[2] << 8) | (data[3])));
|
||||
|
@ -248,8 +248,8 @@ void protocol_io_prox_xsf_render_brief_data(ProtocolIOProxXSF* protocol, FuriStr
|
|||
uint8_t* data = protocol->data;
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %u, VС: %u\r\n"
|
||||
"Card: %u",
|
||||
"FC: %hhu, V: %hhu\n"
|
||||
"Card: %hu",
|
||||
data[0],
|
||||
data[1],
|
||||
(uint16_t)((data[2] << 8) | (data[3])));
|
||||
|
|
|
@ -162,7 +162,7 @@ LevelDuration protocol_jablotron_encoder_yield(ProtocolJablotron* protocol) {
|
|||
|
||||
void protocol_jablotron_render_data(ProtocolJablotron* protocol, FuriString* result) {
|
||||
uint64_t id = protocol_jablotron_card_id(protocol->data);
|
||||
furi_string_printf(result, "ID: %llX\r\n", id);
|
||||
furi_string_printf(result, "Card: %llX", id);
|
||||
};
|
||||
|
||||
bool protocol_jablotron_write_data(ProtocolJablotron* protocol, void* data) {
|
||||
|
|
|
@ -212,13 +212,40 @@ LevelDuration protocol_keri_encoder_yield(ProtocolKeri* protocol) {
|
|||
return level_duration;
|
||||
};
|
||||
|
||||
void protocol_keri_render_data(ProtocolKeri* protocol, FuriString* result) {
|
||||
static void
|
||||
protocol_keri_render_data_internal(ProtocolKeri* protocol, FuriString* result, bool brief) {
|
||||
uint32_t data = bit_lib_get_bits_32(protocol->data, 0, 32);
|
||||
uint32_t internal_id = data & 0x7FFFFFFF;
|
||||
uint32_t fc = 0;
|
||||
uint32_t cn = 0;
|
||||
protocol_keri_descramble(&fc, &cn, &data);
|
||||
furi_string_printf(result, "Internal ID: %lu\r\nFC: %lu, Card: %lu\r\n", internal_id, fc, cn);
|
||||
|
||||
if(brief) {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"Internal ID: %lu\n"
|
||||
"FC: %lu; Card: %lu",
|
||||
internal_id,
|
||||
fc,
|
||||
cn);
|
||||
} else {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"Internal ID: %lu\n"
|
||||
"FC: %lu\n"
|
||||
"Card: %lu",
|
||||
internal_id,
|
||||
fc,
|
||||
cn);
|
||||
}
|
||||
}
|
||||
|
||||
void protocol_keri_render_data(ProtocolKeri* protocol, FuriString* result) {
|
||||
protocol_keri_render_data_internal(protocol, result, false);
|
||||
}
|
||||
|
||||
void protocol_keri_render_brief_data(ProtocolKeri* protocol, FuriString* result) {
|
||||
protocol_keri_render_data_internal(protocol, result, true);
|
||||
}
|
||||
|
||||
bool protocol_keri_write_data(ProtocolKeri* protocol, void* data) {
|
||||
|
@ -262,6 +289,6 @@ const ProtocolBase protocol_keri = {
|
|||
.yield = (ProtocolEncoderYield)protocol_keri_encoder_yield,
|
||||
},
|
||||
.render_data = (ProtocolRenderData)protocol_keri_render_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_keri_render_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_keri_render_brief_data,
|
||||
.write_data = (ProtocolWriteData)protocol_keri_write_data,
|
||||
};
|
|
@ -263,7 +263,10 @@ LevelDuration protocol_nexwatch_encoder_yield(ProtocolNexwatch* protocol) {
|
|||
return level_duration;
|
||||
};
|
||||
|
||||
void protocol_nexwatch_render_data(ProtocolNexwatch* protocol, FuriString* result) {
|
||||
static void protocol_nexwatch_render_data_internal(
|
||||
ProtocolNexwatch* protocol,
|
||||
FuriString* result,
|
||||
bool brief) {
|
||||
uint32_t id = 0;
|
||||
uint32_t scrambled = bit_lib_get_bits_32(protocol->data, 8, 32);
|
||||
protocol_nexwatch_descramble(&id, &scrambled);
|
||||
|
@ -272,13 +275,42 @@ void protocol_nexwatch_render_data(ProtocolNexwatch* protocol, FuriString* resul
|
|||
uint8_t mode = bit_lib_get_bits(protocol->data, 40, 4);
|
||||
uint8_t parity = bit_lib_get_bits(protocol->data, 44, 4);
|
||||
uint8_t chk = bit_lib_get_bits(protocol->data, 48, 8);
|
||||
for(m_idx = 0; m_idx < 3; m_idx++) {
|
||||
|
||||
for(m_idx = 0; m_idx < COUNT_OF(magic_items); m_idx++) {
|
||||
magic_items[m_idx].chk = protocol_nexwatch_checksum(magic_items[m_idx].magic, id, parity);
|
||||
if(magic_items[m_idx].chk == chk) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
furi_string_printf(result, "ID: %lu, M:%u\r\nType: %s\r\n", id, mode, magic_items[m_idx].desc);
|
||||
|
||||
const char* type = m_idx < COUNT_OF(magic_items) ? magic_items[m_idx].desc : "Unknown";
|
||||
|
||||
if(brief) {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"ID: %lu\n"
|
||||
"Mode: %hhu; Type: %s",
|
||||
id,
|
||||
mode,
|
||||
type);
|
||||
} else {
|
||||
furi_string_printf(
|
||||
result,
|
||||
"ID: %lu\n"
|
||||
"Mode: %hhu\n"
|
||||
"Type: %s",
|
||||
id,
|
||||
mode,
|
||||
type);
|
||||
}
|
||||
}
|
||||
|
||||
void protocol_nexwatch_render_data(ProtocolNexwatch* protocol, FuriString* result) {
|
||||
protocol_nexwatch_render_data_internal(protocol, result, false);
|
||||
}
|
||||
|
||||
void protocol_nexwatch_render_brief_data(ProtocolNexwatch* protocol, FuriString* result) {
|
||||
protocol_nexwatch_render_data_internal(protocol, result, true);
|
||||
}
|
||||
|
||||
bool protocol_nexwatch_write_data(ProtocolNexwatch* protocol, void* data) {
|
||||
|
@ -318,6 +350,6 @@ const ProtocolBase protocol_nexwatch = {
|
|||
.yield = (ProtocolEncoderYield)protocol_nexwatch_encoder_yield,
|
||||
},
|
||||
.render_data = (ProtocolRenderData)protocol_nexwatch_render_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_nexwatch_render_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_nexwatch_render_brief_data,
|
||||
.write_data = (ProtocolWriteData)protocol_nexwatch_write_data,
|
||||
};
|
||||
|
|
|
@ -202,8 +202,7 @@ bool protocol_pac_stanley_write_data(ProtocolPACStanley* protocol, void* data) {
|
|||
}
|
||||
|
||||
void protocol_pac_stanley_render_data(ProtocolPACStanley* protocol, FuriString* result) {
|
||||
uint8_t* data = protocol->data;
|
||||
furi_string_printf(result, "CIN: %02X%02X%02X%02X", data[0], data[1], data[2], data[3]);
|
||||
furi_string_printf(result, "CIN: %08lX", bit_lib_get_bits_32(protocol->data, 0, 32));
|
||||
}
|
||||
|
||||
const ProtocolBase protocol_pac_stanley = {
|
||||
|
|
|
@ -171,10 +171,20 @@ void protocol_paradox_render_data(ProtocolParadox* protocol, FuriString* result)
|
|||
uint8_t card_crc = bit_lib_get_bits_16(decoded_data, 34, 8);
|
||||
uint8_t calc_crc = protocol_paradox_calculate_checksum(fc, card_id);
|
||||
|
||||
furi_string_cat_printf(result, "Facility: %u\r\n", fc);
|
||||
furi_string_cat_printf(result, "Card: %u\r\n", card_id);
|
||||
furi_string_cat_printf(result, "CRC: %u Calc CRC: %u\r\n", card_crc, calc_crc);
|
||||
if(card_crc != calc_crc) furi_string_cat_printf(result, "CRC Mismatch, Invalid Card!\r\n");
|
||||
furi_string_printf(
|
||||
result,
|
||||
"FC: %hhu\n"
|
||||
"Card: %hu\n"
|
||||
"CRC: %hhu\n"
|
||||
"Calc CRC: %hhu",
|
||||
fc,
|
||||
card_id,
|
||||
card_crc,
|
||||
calc_crc);
|
||||
|
||||
if(card_crc != calc_crc) {
|
||||
furi_string_cat(result, "\nCRC Mismatch, Invalid Card!");
|
||||
}
|
||||
};
|
||||
|
||||
void protocol_paradox_render_brief_data(ProtocolParadox* protocol, FuriString* result) {
|
||||
|
@ -185,11 +195,10 @@ void protocol_paradox_render_brief_data(ProtocolParadox* protocol, FuriString* r
|
|||
uint8_t card_crc = bit_lib_get_bits_16(decoded_data, 34, 8);
|
||||
uint8_t calc_crc = protocol_paradox_calculate_checksum(fc, card_id);
|
||||
|
||||
furi_string_cat_printf(result, "FC: %03u, Card: %05u\r\n", fc, card_id);
|
||||
if(calc_crc == card_crc) {
|
||||
furi_string_cat_printf(result, "CRC : %03u", card_crc);
|
||||
} else {
|
||||
furi_string_cat_printf(result, "Card is Invalid!");
|
||||
furi_string_printf(result, "FC: %hhu; Card: %hu", fc, card_id);
|
||||
|
||||
if(calc_crc != card_crc) {
|
||||
furi_string_cat(result, "\nCRC Mismatch, Invalid Card!");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ void protocol_pyramid_render_data(ProtocolPyramid* protocol, FuriString* result)
|
|||
uint8_t* decoded_data = protocol->data;
|
||||
uint8_t format_length = decoded_data[0];
|
||||
|
||||
furi_string_cat_printf(result, "Format: %d\r\n", format_length);
|
||||
furi_string_printf(result, "Format: %hhu\n", format_length);
|
||||
if(format_length == 26) {
|
||||
uint8_t facility;
|
||||
bit_lib_copy_bits(&facility, 0, 8, decoded_data, 8);
|
||||
|
@ -251,9 +251,9 @@ void protocol_pyramid_render_data(ProtocolPyramid* protocol, FuriString* result)
|
|||
uint16_t card_id;
|
||||
bit_lib_copy_bits((uint8_t*)&card_id, 8, 8, decoded_data, 16);
|
||||
bit_lib_copy_bits((uint8_t*)&card_id, 0, 8, decoded_data, 24);
|
||||
furi_string_cat_printf(result, "FC: %03u, Card: %05u", facility, card_id);
|
||||
furi_string_cat_printf(result, "FC: %03hhu; Card: %05hu", facility, card_id);
|
||||
} else {
|
||||
furi_string_cat_printf(result, "Data: unknown");
|
||||
furi_string_cat_printf(result, "Data: Unknown");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -176,8 +176,7 @@ bool protocol_viking_write_data(ProtocolViking* protocol, void* data) {
|
|||
};
|
||||
|
||||
void protocol_viking_render_data(ProtocolViking* protocol, FuriString* result) {
|
||||
uint32_t id = bit_lib_get_bits_32(protocol->data, 0, 32);
|
||||
furi_string_printf(result, "ID: %08lX\r\n", id);
|
||||
furi_string_printf(result, "ID: %08lX", bit_lib_get_bits_32(protocol->data, 0, 32));
|
||||
};
|
||||
|
||||
const ProtocolBase protocol_viking = {
|
||||
|
|
|
@ -225,9 +225,17 @@ static bool mf_desfire_poller_detect(NfcGenericEvent event, void* context) {
|
|||
bool protocol_detected = false;
|
||||
|
||||
if(iso14443_4a_event->type == Iso14443_4aPollerEventTypeReady) {
|
||||
MfDesfireKeyVersion key_version = {0};
|
||||
MfDesfireError error = mf_desfire_poller_read_key_version(instance, 0, &key_version);
|
||||
protocol_detected = (error == MfDesfireErrorNone);
|
||||
do {
|
||||
MfDesfireKeyVersion key_version = 0;
|
||||
MfDesfireError error = mf_desfire_poller_read_key_version(instance, 0, &key_version);
|
||||
if(error != MfDesfireErrorNone) break;
|
||||
|
||||
MfDesfireVersion version = {};
|
||||
error = mf_desfire_poller_read_version(instance, &version);
|
||||
if(error != MfDesfireErrorNone) break;
|
||||
|
||||
protocol_detected = true;
|
||||
} while(false);
|
||||
}
|
||||
|
||||
return protocol_detected;
|
||||
|
|
|
@ -393,7 +393,9 @@ for template_file in project_template_dir.Dir(".vscode").glob("*"):
|
|||
),
|
||||
"@UFBT_APP_DIR@": PosixPathWrapper.fix_path(original_app_dir.abspath),
|
||||
"@UFBT_ROOT_DIR@": PosixPathWrapper.fix_path(Dir("#").abspath),
|
||||
"@UFBT_DEBUG_DIR@": dist_env.subst("FBT_DEBUG_DIR"),
|
||||
"@UFBT_DEBUG_DIR@": PosixPathWrapper.fix_path(
|
||||
dist_env.subst("$FBT_DEBUG_DIR")
|
||||
),
|
||||
"@UFBT_DEBUG_ELF_DIR@": PosixPathWrapper.fix_path(
|
||||
dist_env["FBT_FAP_DEBUG_ELF_ROOT"].abspath
|
||||
),
|
||||
|
|
22
scripts/ufbt/project_template/.vscode/tasks.json
vendored
|
@ -31,29 +31,23 @@
|
|||
"command": "ufbt -c"
|
||||
},
|
||||
{
|
||||
"label": "Flash FW (ST-Link)",
|
||||
"label": "Flash FW (SWD)",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt FORCE=1 flash"
|
||||
},
|
||||
{
|
||||
"label": "Flash FW (blackmagic)",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt flash_blackmagic"
|
||||
},
|
||||
{
|
||||
"label": "Flash FW (JLink)",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt FORCE=1 jflash"
|
||||
},
|
||||
{
|
||||
"label": "Flash FW (USB, with resources)",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt FORCE=1 flash_usb"
|
||||
},
|
||||
{
|
||||
"label": "Open Flipper CLI session",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt cli"
|
||||
},
|
||||
{
|
||||
"label": "Update uFBT SDK",
|
||||
"group": "build",
|
||||
|
@ -61,7 +55,7 @@
|
|||
"command": "ufbt update"
|
||||
},
|
||||
{
|
||||
"label": "Update VSCode config for current SDK",
|
||||
"label": "Update VSCode config",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "ufbt vscode_dist"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
entry,status,name,type,params
|
||||
Version,+,60.3,,
|
||||
Version,+,60.4,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
Header,+,applications/services/cli/cli_vcp.h,,
|
||||
|
@ -2450,7 +2450,7 @@ Function,+,storage_simply_remove,_Bool,"Storage*, const char*"
|
|||
Function,+,storage_simply_remove_recursive,_Bool,"Storage*, const char*"
|
||||
Function,-,stpcpy,char*,"char*, const char*"
|
||||
Function,-,stpncpy,char*,"char*, const char*, size_t"
|
||||
Function,-,strcasecmp,int,"const char*, const char*"
|
||||
Function,+,strcasecmp,int,"const char*, const char*"
|
||||
Function,-,strcasecmp_l,int,"const char*, const char*, locale_t"
|
||||
Function,+,strcasestr,char*,"const char*, const char*"
|
||||
Function,-,strcat,char*,"char*, const char*"
|
||||
|
|
|
|
@ -1,5 +1,5 @@
|
|||
entry,status,name,type,params
|
||||
Version,+,60.3,,
|
||||
Version,+,60.4,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
|
@ -3109,7 +3109,7 @@ Function,+,storage_simply_remove,_Bool,"Storage*, const char*"
|
|||
Function,+,storage_simply_remove_recursive,_Bool,"Storage*, const char*"
|
||||
Function,-,stpcpy,char*,"char*, const char*"
|
||||
Function,-,stpncpy,char*,"char*, const char*, size_t"
|
||||
Function,-,strcasecmp,int,"const char*, const char*"
|
||||
Function,+,strcasecmp,int,"const char*, const char*"
|
||||
Function,-,strcasecmp_l,int,"const char*, const char*, locale_t"
|
||||
Function,+,strcasestr,char*,"const char*, const char*"
|
||||
Function,+,strcat,char*,"char*, const char*"
|
||||
|
|
|