Luu 1 год назад
Родитель
Сommit
6acdf4b0b0
8 измененных файлов с 62 добавлено и 28 удалено
  1. 42 0
      .github/workflows/main.yml
  2. 2 3
      CHANGELOG.md
  3. 0 1
      README.md
  4. 1 1
      app/README.md
  5. 1 1
      application.fam
  6. 3 3
      manifest.yml
  7. 6 9
      scenes/metroflip_scene_navigo.c
  8. 7 10
      scenes/metroflip_scene_ravkav.c

+ 42 - 0
.github/workflows/main.yml

@@ -0,0 +1,42 @@
+name: UFBT Build and Test
+
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+    branches:
+      - main
+
+jobs:
+  build:
+    name: Build and Test Application
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout Repository
+        uses: actions/checkout@v3
+
+      - name: Set up Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.x'
+
+      - name: Install UFBT
+        run: |
+          python3 -m pip install --upgrade pip
+          pip install ufbt
+
+      - name: Initialize UFBT Environment
+        run: |
+          ufbt update
+          ufbt vscode_dist
+
+      - name: Build FAP Applications
+        run: ufbt faps
+
+      - name: Upload Build Artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: build-output
+          path: build/

+ 2 - 3
CHANGELOG.md

@@ -1,7 +1,6 @@
 ## v0.1
 ## v0.1
 
 
-- Initial release by [@luu176](https://github.com/luu176)
-
+- Initial release by luu176
 ## v0.2
 ## v0.2
 
 
 - Update Rav-Kav parsing to show more data such as transaction logs
 - Update Rav-Kav parsing to show more data such as transaction logs
@@ -14,4 +13,4 @@
 - Added Troika parser (Moscow, Russia)
 - Added Troika parser (Moscow, Russia)
 - Added Myki parser (Melbourne (and surrounds), VIC, Australia)
 - Added Myki parser (Melbourne (and surrounds), VIC, Australia)
 - Added Opal parser (Sydney (and surrounds), NSW, Australia)
 - Added Opal parser (Sydney (and surrounds), NSW, Australia)
-- Added ITSO parser (United Kingdom)
+- Added ITSO parser (United Kingdom)

+ 0 - 1
README.md

@@ -33,7 +33,6 @@ This is a list of metro cards and transit systems that need support or have part
   - To Do: Add support for reading and analyzing Tianjin Railway Transit cards.
   - To Do: Add support for reading and analyzing Tianjin Railway Transit cards.
 
 
 
 
-
 ---
 ---
 
 
 ### Credits:
 ### Credits:

+ 1 - 1
app/README.md

@@ -44,4 +44,4 @@ More coming soon!
 - **Myki Parser**: gornekich
 - **Myki Parser**: gornekich
 - **Opal parser**: gornekich
 - **Opal parser**: gornekich
 - **ITSO parser**: gsp8181, hedger, gornekich
 - **ITSO parser**: gsp8181, hedger, gornekich
-- **Info Slaves**: equipter, thedingo8mybaby
+- **Info Slaves**: equipter, thedingo8mybaby

+ 1 - 1
application.fam

@@ -5,7 +5,7 @@ App(
     entry_point="metroflip",
     entry_point="metroflip",
     stack_size=2 * 1024,
     stack_size=2 * 1024,
     fap_category="NFC",
     fap_category="NFC",
-    fap_version="0.1",
+    fap_version="0.2",
     fap_icon="icon.png",
     fap_icon="icon.png",
     fap_description="An implementation of metrodroid on the flipper",
     fap_description="An implementation of metrodroid on the flipper",
     fap_author="luu176",
     fap_author="luu176",

+ 3 - 3
manifest.yml

@@ -10,11 +10,11 @@ screenshots:
   - 'screenshots/Menu-Middle.png'
   - 'screenshots/Menu-Middle.png'
   - 'screenshots/Rav-Kav.png'
   - 'screenshots/Rav-Kav.png'
   - 'screenshots/App.png'
   - 'screenshots/App.png'
-short_description: 'An implementation of metrodroid on the flipper'
+short_description: 'An implementation of Metrodroid on the Flipper Zero'
 sourcecode:
 sourcecode:
   location:
   location:
-    commit_sha: d07cf3396b0a486c9b39f136e9a6ec84fec534e8
+    commit_sha: 80b48d2a91698cfc47bc2d01059518eefc5ad4af
     origin: https://github.com/luu176/Metroflip
     origin: https://github.com/luu176/Metroflip
     subdir:
     subdir:
   type: git
   type: git
-version: 0.1
+version: 0.2

+ 6 - 9
scenes/metroflip_scene_navigo.c

@@ -95,9 +95,7 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
                     char bits[9];
                     char bits[9];
                     uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                     uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                     byte_to_binary(byte, bits);
                     byte_to_binary(byte, bits);
-                    for(int j = 0; j < 8; j++) {
-                        bit_representation[i * 8 + j] = bits[j];
-                    }
+                    strlcat(bit_representation, bits, sizeof(bit_representation));
                 }
                 }
                 bit_representation[response_length * 8] = '\0';
                 bit_representation[response_length * 8] = '\0';
                 int start = 55, end = 70;
                 int start = 55, end = 70;
@@ -176,9 +174,10 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
                     char bits[9];
                     char bits[9];
                     uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                     uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                     byte_to_binary(byte, bits);
                     byte_to_binary(byte, bits);
-                    for(int j = 0; j < 8; j++) {
-                        environment_bit_representation[i * 8 + j] = bits[j];
-                    }
+                    strlcat(
+                        environment_bit_representation,
+                        bits,
+                        sizeof(environment_bit_representation));
                 }
                 }
                 start = 45;
                 start = 45;
                 end = 58;
                 end = 58;
@@ -256,9 +255,7 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
                         char bits[9];
                         char bits[9];
                         uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                         uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                         byte_to_binary(byte, bits);
                         byte_to_binary(byte, bits);
-                        for(int j = 0; j < 8; j++) {
-                            event_bit_representation[i * 8 + j] = bits[j];
-                        }
+                        strlcat(event_bit_representation, bits, sizeof(event_bit_representation));
                     }
                     }
                     furi_string_cat_printf(parsed_data, "\nEvent 0%d:\n", i);
                     furi_string_cat_printf(parsed_data, "\nEvent 0%d:\n", i);
                     int start = 53, end = 60;
                     int start = 53, end = 60;

+ 7 - 10
scenes/metroflip_scene_ravkav.c

@@ -101,7 +101,8 @@ static NfcCommand metroflip_scene_ravkav_poller_callback(NfcGenericEvent event,
 
 
                 float result = value / 100.0f;
                 float result = value / 100.0f;
                 FURI_LOG_I(TAG, "Value: %.2f ILS", (double)result);
                 FURI_LOG_I(TAG, "Value: %.2f ILS", (double)result);
-                furi_string_printf(parsed_data, "\e#Rav-Kav:\n");
+                furi_string_printf(parsed_data, "\e#Rav-Kav:\n\n");
+                furi_string_cat_printf(parsed_data, "\e#Contract:\n");
                 if(result != 0.0f) {
                 if(result != 0.0f) {
                     furi_string_cat_printf(parsed_data, "Balance: %.2f ILS\n", (double)result);
                     furi_string_cat_printf(parsed_data, "Balance: %.2f ILS\n", (double)result);
                 } else {
                 } else {
@@ -167,9 +168,7 @@ static NfcCommand metroflip_scene_ravkav_poller_callback(NfcGenericEvent event,
                     char bits[9];
                     char bits[9];
                     uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                     uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                     byte_to_binary(byte, bits);
                     byte_to_binary(byte, bits);
-                    for(int j = 0; j < 8; j++) {
-                        bit_representation[i * 8 + j] = bits[j];
-                    }
+                    strlcat(bit_representation, bits, sizeof(bit_representation));
                 }
                 }
                 int start = 54, end = 83;
                 int start = 54, end = 83;
                 char bit_slice[end - start + 1];
                 char bit_slice[end - start + 1];
@@ -210,9 +209,9 @@ static NfcCommand metroflip_scene_ravkav_poller_callback(NfcGenericEvent event,
                         app->view_dispatcher, MetroflipCustomEventPollerFileNotFound);
                         app->view_dispatcher, MetroflipCustomEventPollerFileNotFound);
                     break;
                     break;
                 }
                 }
-
+                furi_string_cat_printf(parsed_data, "\e#Latest Events:\n");
                 // Now send the read command
                 // Now send the read command
-                for(size_t i = 1; i < 7; i++) {
+                for(size_t i = 1, j = 6; i < 7 && j > 0; i++, j--) {
                     read_file[2] = i;
                     read_file[2] = i;
                     bit_buffer_reset(tx_buffer);
                     bit_buffer_reset(tx_buffer);
                     bit_buffer_append_bytes(tx_buffer, read_file, sizeof(read_file));
                     bit_buffer_append_bytes(tx_buffer, read_file, sizeof(read_file));
@@ -247,9 +246,7 @@ static NfcCommand metroflip_scene_ravkav_poller_callback(NfcGenericEvent event,
                         char bits[9];
                         char bits[9];
                         uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                         uint8_t byte = bit_buffer_get_byte(rx_buffer, i);
                         byte_to_binary(byte, bits);
                         byte_to_binary(byte, bits);
-                        for(int j = 0; j < 8; j++) {
-                            bit_representation[i * 8 + j] = bits[j];
-                        }
+                        strlcat(bit_representation, bits, sizeof(bit_representation));
                     }
                     }
                     int start = 23, end = 52;
                     int start = 23, end = 52;
                     char bit_slice[end - start + 2];
                     char bit_slice[end - start + 2];
@@ -259,7 +256,7 @@ static NfcCommand metroflip_scene_ravkav_poller_callback(NfcGenericEvent event,
                     uint64_t result_timestamp = decimal_value + epoch + (3600 * 3);
                     uint64_t result_timestamp = decimal_value + epoch + (3600 * 3);
                     DateTime dt = {0};
                     DateTime dt = {0};
                     datetime_timestamp_to_datetime(result_timestamp, &dt);
                     datetime_timestamp_to_datetime(result_timestamp, &dt);
-                    furi_string_cat_printf(parsed_data, "\nEvent 0%d:\n", i);
+                    furi_string_cat_printf(parsed_data, "\nEvent 0%d:\n", j);
                     locale_format_datetime_cat(parsed_data, &dt, true);
                     locale_format_datetime_cat(parsed_data, &dt, true);
                     furi_string_cat_printf(parsed_data, "\n\n");
                     furi_string_cat_printf(parsed_data, "\n\n");
                 }
                 }