Просмотр исходного кода

Picopass: update with latest API (#165)

gornekich 1 год назад
Родитель
Сommit
6c5074796e
4 измененных файлов с 9 добавлено и 6 удалено
  1. 2 0
      .catalog/changelog.md
  2. 1 1
      application.fam
  3. 5 4
      loclass_writer.c
  4. 1 1
      scenes/picopass_scene_read_card_success.c

+ 2 - 0
.catalog/changelog.md

@@ -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

+ 1 - 1
application.fam

@@ -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"],

+ 5 - 4
loclass_writer.c

@@ -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;
@@ -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");
@@ -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 "

+ 1 - 1
scenes/picopass_scene_read_card_success.c

@@ -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);