Skip to content

Commit

Permalink
Picopass: update with latest API (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
gornekich authored Mar 6, 2024
1 parent adff126 commit 6c50747
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .catalog/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.13
- Rework loclass writer with datetime lib
## 1.12
- Add support for non-secure Picopass
- Change Read to use all dictionaries
Expand Down
2 changes: 1 addition & 1 deletion application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ App(
],
stack_size=4 * 1024,
fap_description="App to communicate with NFC tags using the PicoPass(iClass) format",
fap_version="1.12",
fap_version="1.13",
fap_icon="125_10px.png",
fap_category="NFC",
fap_libs=["mbedtls"],
Expand Down
9 changes: 5 additions & 4 deletions loclass_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <storage/storage.h>
#include <stream/stream.h>
#include <stream/buffered_file_stream.h>
#include <datetime/datetime.h>

struct LoclassWriter {
Stream* file_stream;
Expand Down Expand Up @@ -41,9 +42,9 @@ void loclass_writer_free(LoclassWriter* instance) {
bool loclass_writer_write_start_stop(LoclassWriter* instance, bool start) {
furi_assert(instance != NULL);

FuriHalRtcDateTime curr_dt;
DateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_datetime_to_timestamp(&curr_dt);
uint32_t curr_ts = datetime_datetime_to_timestamp(&curr_dt);

FuriString* str = furi_string_alloc_printf(
"loclass-v1-info ts %lu %s\n", curr_ts, start ? "started" : "finished");
Expand All @@ -61,9 +62,9 @@ bool loclass_writer_write_params(
const uint8_t mac[4]) {
furi_assert(instance != NULL);

FuriHalRtcDateTime curr_dt;
DateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_datetime_to_timestamp(&curr_dt);
uint32_t curr_ts = datetime_datetime_to_timestamp(&curr_dt);

FuriString* str = furi_string_alloc_printf(
"loclass-v1-mac ts %lu no %u "
Expand Down
2 changes: 1 addition & 1 deletion scenes/picopass_scene_read_card_success.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void picopass_scene_read_card_success_on_enter(void* context) {

if(no_key) {
furi_string_cat_printf(key_str, "No Key: used NR-MAC");
} else if(pacs->key) {
} else {
furi_string_cat_printf(key_str, "Key: ");
uint8_t key[PICOPASS_BLOCK_LEN];
memcpy(key, &pacs->key, PICOPASS_BLOCK_LEN);
Expand Down

0 comments on commit 6c50747

Please sign in to comment.