add pm3 command for single step encoding

This commit is contained in:
Xavier 2023-11-21 16:15:22 -05:00
parent 54785fe8d9
commit 742bfc1559

View File

@ -30,7 +30,6 @@ void ensure_dir_exists(Storage *storage)
FURI_LOG_I(TAG, "Directory exists: %s", WIEGAND_SAVE_FOLDER);
}
}
void wiegand_save(void *context)
{
App *app = context;
@ -54,12 +53,25 @@ void wiegand_save(void *context)
furi_string_printf(buffer, "Bits: %d\n", bit_count);
storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer));
furi_string_printf(buffer, "RAW_Data: ");
for (int i = 0; i < bit_count; i++)
{
furi_string_cat_printf(buffer, "%d", data[i] ? 1 : 0);
}
furi_string_push_back(buffer, '\n');
storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer));
furi_string_printf(buffer, "PM3_Command: hf ic encode --bin ");
for (int i = 0; i < bit_count; i++)
{
furi_string_cat_printf(buffer, "%d", data[i] ? 1 : 0);
}
furi_string_cat_printf(buffer, " --ki 0\n");
storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer));
storage_file_close(data_file);
}