Przeglądaj źródła

implement support for bunch of protocols in BF existing dump, fix msg

MX 3 lat temu
rodzic
commit
e5eb466c55
3 zmienionych plików z 23 dodań i 8 usunięć
  1. 6 5
      subbrute_device.c
  2. 10 3
      subbrute_protocols.c
  3. 7 0
      subbrute_protocols.h

+ 6 - 5
subbrute_device.c

@@ -291,11 +291,12 @@ uint8_t subbrute_device_load_from_file(SubBruteDevice* instance, const char* fil
 #endif
         }
 
-        instance->decoder_result =
-            subghz_receiver_search_decoder_base_by_name(instance->receiver, protocol_file);
+        instance->decoder_result = subghz_receiver_search_decoder_base_by_name(
+            instance->receiver, furi_string_get_cstr(temp_str));
 
-        if(!instance->decoder_result || strcmp(protocol_file, "RAW") == 0) {
-            FURI_LOG_E(TAG, "RAW unsupported");
+        if((!instance->decoder_result) || (strcmp(protocol_file, "RAW") == 0) ||
+           (strcmp(protocol_file, "Unknown") == 0)) {
+            FURI_LOG_E(TAG, "Protocol unsupported");
             result = SubBruteFileResultProtocolNotSupported;
             break;
         }
@@ -430,7 +431,7 @@ const char* subbrute_device_error_get_desc(SubBruteFileResult error_id) {
         result = "Missing Protocol";
         break;
     case(SubBruteFileResultProtocolNotSupported):
-        result = "RAW unsupported";
+        result = "Protocol unsupported";
         break;
     case(SubBruteFileResultDynamicProtocolNotValid):
         result = "Dynamic protocol unsupported";

+ 10 - 3
subbrute_protocols.c

@@ -205,7 +205,7 @@ const SubBruteProtocol subbrute_protocol_linear_10bit_310 = {
  * BF existing dump
  */
 const SubBruteProtocol subbrute_protocol_load_file =
-    {0, 0, 0, 3, FuriHalSubGhzPresetOok650Async, RAWFileProtocol};
+    {0, 0, 0, 3, FuriHalSubGhzPresetOok650Async, UnknownFileProtocol};
 
 static const char* subbrute_protocol_names[] = {
     [SubBruteAttackCAME12bit303] = "CAME 12bit 303MHz",
@@ -267,7 +267,14 @@ static const char* subbrute_protocol_file_types[] = {
     [ChamberlainFileProtocol] = "Cham_Code",
     [LinearFileProtocol] = "Linear",
     [PrincetonFileProtocol] = "Princeton",
-    [RAWFileProtocol] = "RAW"};
+    [RAWFileProtocol] = "RAW",
+    [BETTFileProtocol] = "BETT",
+    [ClemsaFileProtocol] = "Clemsa",
+    [DoitrandFileProtocol] = "Doitrand",
+    [GateTXFileProtocol] = "GateTX",
+    [MagellanFileProtocol] = "Magellan",
+    [IntertechnoV3FileProtocol] = "Intertechno_V3",
+    [UnknownFileProtocol] = "Unknown"};
 
 /**
  * Values to not use less memory for packet parse operations
@@ -316,7 +323,7 @@ SubBruteFileProtocol subbrute_protocol_file_protocol_name(FuriString* name) {
         }
     }
 
-    return RAWFileProtocol;
+    return UnknownFileProtocol;
 }
 
 void subbrute_protocol_default_payload(

+ 7 - 0
subbrute_protocols.h

@@ -12,6 +12,13 @@ typedef enum {
     LinearFileProtocol,
     PrincetonFileProtocol,
     RAWFileProtocol,
+    BETTFileProtocol,
+    ClemsaFileProtocol,
+    DoitrandFileProtocol,
+    GateTXFileProtocol,
+    MagellanFileProtocol,
+    IntertechnoV3FileProtocol,
+    UnknownFileProtocol,
     TotalFileProtocol,
 } SubBruteFileProtocol;