diff --git a/CHANGELOG.md b/CHANGELOG.md index 73489b07c..020cae988 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,30 +1,8 @@ -### Note: -- This is a smaller release due to the bugfixes it contains, make sure to also read the changelog for [mntm-006](https://github.com/Next-Flip/Momentum-Firmware/releases/tag/mntm-006) - ### Added: -- Apps: - - Games: Laser Tag (by @RocketGod-git & @jamisonderek) -- NFC: Added new Saflok parser (#196 #201 by @zinongli & @xtruan & @zacharyweiss & @evilmog & @Arkwin) -- OFW: Desktop: New Procrastination dolphin animation (by @Astrrra) - -### Updated: -- Apps: - - Picopass: CVE-2024-41566, When keys are unknown emulate with a dummy MAC and ignore reader MACs (by @nvx) - - Seader: Card parsing and saving UI and logic improvements (by @bettse) - - Authenticator: Confirm token export on Flipper (by @akopachov) - - NFC Playlist: Allow delay up to 12s (by @xtruan) - - BLE Spam: Fix delay help section (by @Willy-JL) - - WAV Player: Fix unresponsiveness (by @Willy-JL) -- Sub-GHz: - - Show Weather Station icon for WS signals (by @Willy-JL) - - Update Oregon 2 and 3 weather info display to new design (by @Willy-JL) -- API: Publishing T5577 page 1 block count macro (by @zinongli) +- UL: Sub-GHz: Add new protocols: Marantec24 (static 24 bit) and GangQi (static 34 bit) (by @xMasterX) ### Fixed: -- Sub-GHz: Fix Acurite 986 temperature value conversion (by @Willy-JL) -- Desktop: - - Fix disabling keybinds (by @Willy-JL) - - Sanity check PIN length for good measure (by @Willy-JL) - - Fix PIN locked with no PIN set edge case (by @Willy-JL) -- Settings: Fix duplicates in Power Settings when opening submenus (by @Willy-JL) -- RGB Backlight: Fix config migration (by @Willy-JL) +- RFID: + - OFW: Fix detection of GProx II cards and false detection of other cards (by @Astrrra) + - OFW: Fix Guard GProxII False Positive and 36-bit Parsing (by @zinongli) +- OFW: NFC: Fix crash on Ultralight unlock (by @Astrrra) diff --git a/applications/debug/unit_tests/resources/unit_tests/subghz/gangqi_raw.sub b/applications/debug/unit_tests/resources/unit_tests/subghz/gangqi_raw.sub new file mode 100644 index 000000000..a91f55f83 --- /dev/null +++ b/applications/debug/unit_tests/resources/unit_tests/subghz/gangqi_raw.sub @@ -0,0 +1,12 @@ +Filetype: Flipper SubGhz RAW File +Version: 1 +Frequency: 433920000 +Preset: FuriHalSubGhzPresetOok270Async +Protocol: RAW +RAW_Data: 1572 -3304 199 -134 67 -132 133 -168 429 -100 1609 -66 587 -51388 727 -578 377 -1382 1081 -538 393 -1340 1111 -526 1143 -482 441 -1312 1151 -490 1169 -482 1169 -484 1145 -520 417 -1310 511 -2206 1137 -506 1167 -482 445 -1280 1149 -510 447 -1284 449 -1276 1171 -484 461 -1272 1189 -484 443 -1284 1165 -474 469 -1262 1159 -490 479 -1242 1195 -500 421 -1310 1135 -492 1175 -488 439 -1308 1141 -500 1151 -488 1167 -490 447 -1266 1171 -512 433 -1302 1133 -502 1153 -484 471 -1264 1169 -476 1151 -480 1167 -504 1131 -516 445 -1284 549 -2170 1163 -490 1177 -488 437 -1308 1139 -500 455 -1276 429 -1308 1131 -512 443 -1308 1139 -516 433 -1274 1175 -498 455 -1276 1163 -460 483 -1272 1163 -462 487 -1276 1147 -486 1169 -486 439 -1306 1137 -510 1149 -486 1171 -490 451 -1274 1173 -478 459 -1278 1147 -490 1173 -490 435 -1274 1177 -506 1149 -484 1167 -478 1173 -486 451 -1274 545 -2206 1145 -472 1167 -488 445 -1296 1163 -500 457 -1280 429 -1304 1161 -482 443 -1304 1139 -480 465 -1270 1163 -504 459 -1272 1163 -496 457 -1272 1163 -500 453 -1274 1163 -496 1143 -490 441 -1306 1143 -502 1145 -484 1165 -490 453 -1300 1139 -484 463 -1300 1143 -502 1145 -488 473 -1268 1139 -508 1145 -488 1167 -478 1171 -464 471 -1300 533 -2184 1147 -486 1163 -524 417 -1312 1117 -516 447 -1282 441 -1304 1129 -520 449 -1306 1137 -514 433 -1276 1147 -528 417 -1316 1117 -512 447 -1298 1131 -514 445 -1300 1149 -478 1179 -476 461 -1276 1145 -526 1141 -486 1163 -486 449 -1276 1139 -508 461 -1278 1147 -492 1175 -484 473 -1274 1141 -506 1145 -480 1169 -486 1145 -520 449 -1276 547 -2200 1147 -486 1145 -490 453 -1308 1149 -486 439 -1302 447 -1282 1139 -500 445 -1316 1145 -482 471 -1270 1139 -508 457 -1306 1133 -502 457 -1278 1147 -488 447 -1312 1133 -490 1171 -482 439 -1306 1137 -502 1147 -482 1167 -522 419 -1312 1137 -482 463 -1276 1175 -498 1141 -488 473 -1274 1139 -502 1147 -490 1171 -490 1141 -504 453 -1284 545 -2170 1187 -454 1185 -488 453 -1274 1137 -486 465 -1308 417 -1314 1141 -502 447 -1284 1177 -486 439 -1308 1143 -500 453 -1276 1151 -486 447 -1280 1163 -486 445 -1298 1175 -464 1177 -486 473 -1268 1141 -506 1149 -484 1173 -490 447 -1274 1173 -478 459 -1278 1183 -484 1137 -516 433 -1272 1177 -466 1175 -488 1167 -492 1143 -490 453 -1272 545 -2198 1141 -524 1147 -494 443 -1290 1149 -490 473 -1272 447 -1286 1141 -490 455 -1308 1137 -482 465 -1272 1165 -506 455 -1276 1147 -490 449 -1280 1161 -488 447 -1298 1149 -490 1173 -488 439 -1308 1139 -500 1145 -524 1141 -480 449 -1276 1171 -480 463 -1276 1177 -462 1171 -490 439 -1308 1141 -502 1145 -518 1139 -502 1161 -482 +RAW_Data: 441 -1294 535 -2190 1161 -492 1143 -478 483 -1278 1135 -482 465 -1276 481 -1286 1141 -488 457 -1308 1139 -480 463 -1276 1149 -514 447 -1284 1141 -488 469 -1268 1153 -522 449 -1276 1173 -478 1153 -490 477 -1272 1141 -504 1147 -484 1163 -478 449 -1306 1139 -512 431 -1300 1173 -478 1153 -488 443 -1304 1139 -504 1151 -486 1171 -480 1139 -488 453 -1308 511 -2234 1149 -464 1183 -484 427 -1306 1165 -488 447 -1274 445 -1298 1143 -488 451 -1306 1151 -488 439 -1306 1173 -476 459 -1278 1149 -490 449 -1316 1119 -516 445 -1286 1163 -480 1139 -508 459 -1306 1135 -504 1145 -486 1171 -488 449 -1276 1139 -508 461 -1278 1145 -490 1175 -486 437 -1308 1143 -498 1155 -486 1169 -488 1145 -520 417 -1306 511 -2204 1143 -506 1165 -480 447 -1282 1143 -506 467 -1298 431 -1306 1133 -502 455 -1298 1135 -502 423 -1312 1147 -486 449 -1280 1163 -490 445 -1302 1145 -526 417 -1312 1153 -484 1137 -516 435 -1308 1143 -498 1145 -486 1165 -488 447 -1272 1171 -514 431 -1310 1143 -498 1143 -486 439 -1304 1141 -504 1149 -484 1171 -488 1143 -504 447 -1280 547 -2208 1147 -492 1133 -514 447 -1284 1141 -522 417 -1306 447 -1280 1141 -520 431 -1304 1161 -488 451 -1304 1139 -478 461 -1278 1143 -526 419 -1308 1135 -492 449 -1316 1151 -482 1139 -514 439 -1306 1139 -506 1147 -518 1137 -488 449 -1276 1171 -476 463 -1276 1145 -492 1175 -484 437 -1304 1139 -508 1151 -486 1169 -476 1177 -484 449 -1278 547 -2204 1145 -484 1145 -488 451 -1304 1155 -480 475 -1274 445 -1298 1147 -492 441 -1302 1133 -520 447 -1274 1143 -508 459 -1276 1151 -518 447 -1278 1141 -488 449 -1308 1153 -484 1167 -486 449 -1308 1105 -542 1123 -518 1137 -508 447 -1282 1143 -514 435 -1276 1175 -498 1147 -482 437 -1308 1141 -504 1149 -484 1167 -488 1143 -522 449 -243660 97 -66 297 -538 65 -100 131 -464 97 -100 265 -132 6257 -68 359583 -65666 99 -510 957 -22306 101 -1456 1111 -482 491 -1272 1021 -764 65 -1412 1083 -558 355 -1366 1075 -622 161 -64 263 -478 1195 -464 1145 -520 425 -1306 475 -1266 1139 -536 1091 -548 407 -1304 1139 -500 1151 -482 1167 -476 445 -1314 447 -1280 549 -2200 1133 -524 1111 -518 439 -1308 1143 -496 449 -1264 441 -1314 1145 -506 449 -1276 1177 -488 439 -1308 1137 -504 455 -1276 1145 -490 449 -1276 1161 -492 449 -1312 1131 -524 1143 -484 471 -1276 1143 -506 1155 -486 1163 -478 1171 -464 445 -1318 453 -1278 1149 -478 1167 -480 463 -1302 1165 -476 1147 -490 1173 -490 451 -1270 445 -1288 547 -2172 1173 -482 1147 -492 447 -1294 1163 -506 459 -1278 457 -1278 1161 -480 447 -1302 1137 -484 463 -1272 1163 -504 455 -1276 1147 -524 453 -1278 1151 -484 445 -1294 1165 -498 1149 -486 +RAW_Data: 469 -1268 1143 -506 1149 -488 1165 -488 1181 -464 447 -1284 449 -1312 1153 -486 1137 -518 435 -1272 1175 -498 1141 -488 1169 -492 449 -1274 445 -1294 535 -2204 1147 -490 1169 -492 451 -1272 1171 -480 457 -1278 453 -1278 1169 -490 451 -1308 1139 -514 429 -1304 1135 -504 453 -1276 1149 -490 447 -1298 1149 -488 445 -1296 1165 -496 1149 -488 479 -1276 1139 -504 1149 -490 1167 -492 1143 -478 481 -1272 445 -1284 1163 -486 1175 -488 437 -1302 1141 -504 1151 -486 1167 -478 445 -1306 445 -1286 539 -2178 1171 -486 1163 -490 451 -1276 1173 -478 459 -1276 455 -1278 1165 -470 481 -1284 1149 -490 471 -1270 1141 -504 455 -1272 1167 -502 455 -1276 1149 -490 447 -1284 1155 -514 1135 -484 465 -1274 1161 -506 1147 -484 1163 -520 1145 -492 453 -1298 417 -1316 1147 -478 1165 -478 461 -1276 1147 -514 1135 -514 1127 -522 449 -1276 445 -1294 547 -2202 1153 -478 1137 -508 457 -1270 1167 -496 453 -1274 441 -1312 1141 -488 455 -1308 1137 -482 465 -1274 1177 -498 419 -1312 1151 -482 443 -1294 1165 -462 485 -1276 1175 -496 1145 -488 473 -1272 1141 -504 1145 -488 1171 -492 1145 -490 453 -1272 445 -1296 1175 -480 1161 -502 451 -1264 1163 -502 1145 -486 1165 -480 449 -1272 477 -1286 551 -2174 1163 -480 1169 -482 463 -1276 1177 -462 477 -1264 439 -1316 1139 -502 439 -1306 1161 -492 449 -1272 1173 -480 461 -1276 1145 -492 449 -1310 1131 -492 445 -1300 1175 -460 1179 -486 471 -1270 1139 -506 1157 -484 1169 -490 1147 -490 455 -1302 447 -1286 1163 -482 1139 -484 463 -1274 1175 -498 1175 -456 1173 -490 455 -1274 445 -1284 551 -2168 1189 -484 1151 -484 449 -1284 1153 -480 451 -1314 451 -1276 1171 -480 463 -1272 1179 -464 485 -1278 1149 -482 447 -1282 1161 -486 447 -1278 1197 -464 485 -1276 1145 -490 1171 -488 435 -1276 1177 -464 1179 -488 1167 -482 1139 -504 447 -1280 483 -1276 1149 -488 1175 -488 435 -1272 1173 -502 1145 -490 1171 -492 447 -1266 441 -1294 547 -2206 1149 -488 1175 -488 435 -1274 1177 -464 483 -1278 427 -1306 1165 -456 483 -1274 1173 -476 461 -1302 1141 -502 453 -1280 1145 -488 449 -1282 1161 -478 445 -1320 1145 -492 1165 -472 439 -1326 1161 -460 1175 -490 1163 -490 1143 -492 451 -1304 409 -1294 1175 -484 1153 -488 447 -1282 1191 -480 1137 -484 1189 -490 449 -1272 445 -1268 555 -2204 1131 -512 1165 -476 453 -1264 1197 -478 459 -1278 455 -1276 1167 -490 451 -1272 1169 -480 461 -1276 1175 -460 483 -1278 1149 -484 481 -1274 1149 -486 447 -1310 1163 -460 1171 -488 441 -1308 1139 -500 1147 -488 1167 -490 1143 -490 487 -1272 445 -1286 1165 -478 1173 -478 457 -1278 1151 -488 1175 -486 1161 -482 445 -1268 473 -1288 539 -2194 1139 -506 1151 -486 +RAW_Data: 471 -1270 1139 -506 453 -1262 469 -1286 1143 -504 453 -1280 1175 -488 473 -1270 1139 -504 455 -1272 1163 -464 485 -1272 1163 -494 453 -1272 1165 -462 1175 -490 479 -1272 1143 -504 1147 -490 1169 -492 1141 -490 451 -1268 479 -1282 1147 -490 1143 -520 429 -1308 1161 -482 1139 -504 1143 -488 471 -1274 467 -1264 539 -2198 1141 -474 1183 -492 443 -1298 1153 -488 477 -1270 445 -1286 1143 -506 451 -1282 1173 -488 435 -1274 1175 -464 485 -1278 1179 -462 449 -1308 1133 -490 449 -1314 1149 -484 1169 -488 433 -1276 1177 -496 1145 -488 1165 -474 1185 -488 451 -1276 449 -1286 1151 -478 1167 -504 457 -1278 1149 -486 1173 -486 1129 -524 445 -1274 445 -250178 99 -496 131 -406 65 -568 265 -132 361 -132 163 -326 163 -328 229 -164 65 -360 163 -98 99 -328 899 -100 333 -66 396157 -74330 1085 -550 419 -1336 1107 -482 477 -1302 423 -1270 1149 -12632 63 -128 63 -100 97 -98 97 -66 131 -662 335 -1344 1119 -520 1147 -478 461 -1302 1107 -568 195 -96 63 -5076 689 -484 491 -1238 1187 -476 1155 -518 1143 -488 453 -1270 447 -1282 451 -1310 1143 -476 463 -1278 523 -2210 1147 -506 1141 -508 429 -1308 1127 -520 447 -1272 445 -1286 1145 -524 419 -1306 1171 -484 439 -1306 1139 -504 425 -1310 1151 -488 451 -1282 1151 -508 449 -1296 1133 -508 1137 -506 453 -1300 1137 -504 1151 -488 441 -1308 1139 -502 1145 -490 475 -1270 1139 -506 1147 -522 1109 -522 449 -1278 443 -1316 453 -1278 1137 -482 465 -1270 571 -2160 1171 -490 1143 -524 421 -1308 1139 -516 435 -1306 417 -1314 1139 -506 451 -1276 1175 -488 435 -1272 1175 -502 453 -1276 1149 -492 449 -1308 1133 -524 415 -1296 1163 -500 1145 -488 443 -1308 1139 -502 1145 -490 475 -1272 1177 -476 1151 -486 471 -1270 1171 -478 1149 -488 1171 -492 447 -1270 441 -1288 485 -1274 1137 -514 465 -1274 545 -2166 1167 -490 1149 -488 457 -1276 1169 -480 463 -1274 451 -1282 1171 -476 481 -1280 1171 -486 469 -1266 1169 -476 457 -1276 1147 -488 447 -1278 1187 -480 445 -1280 1195 -460 1173 -486 471 -1266 1165 -480 1149 -490 479 -1272 1139 -506 1145 -494 475 -1272 1137 -506 1177 -460 1177 -482 451 -1274 477 -1254 489 -1244 1167 -486 459 -1264 567 -2190 1143 -494 1183 -492 459 -1244 1171 -484 463 -1274 451 -1274 1173 -494 457 -1272 1167 -484 459 -1274 1173 -464 481 -1270 1175 -466 485 -1270 1159 -468 483 -1270 1163 -468 1177 -488 471 -1268 1169 -478 1145 -486 481 -1268 1169 -484 1183 -454 475 -1268 1163 -484 1153 -492 1171 -486 449 -1272 477 -1252 491 -1272 1171 -454 497 -1238 581 -2164 1169 -482 1175 -456 461 -1272 1169 -484 461 -1268 467 -1292 1181 -456 461 -1272 1203 -452 461 -1272 1193 -442 487 -1276 +RAW_Data: 1149 -488 475 -1262 1175 -462 481 -1276 1173 -464 1175 -492 475 -1238 1173 -470 1179 -492 473 -1240 1175 -468 1177 -488 471 -1270 1175 -480 1151 -486 1167 -494 451 -1266 477 -1254 487 -1268 1169 -454 461 -1274 567 -2162 1203 -438 1205 -436 499 -1244 1175 -474 485 -1274 445 -1284 1163 -478 477 -1252 1183 -464 465 -1278 1197 -460 483 -1272 1169 -476 455 -1274 1175 -458 481 -1274 1149 -486 1169 -488 469 -1268 1165 -482 1185 -452 479 -1270 1169 -482 1147 -486 477 -1266 1163 -484 1151 -486 1169 -494 455 -1274 479 -1260 451 -1280 1171 -492 473 -1236 577 -2164 1171 -494 1147 -494 455 -1270 1173 -478 491 -1238 479 -1258 1175 -494 455 -1272 1169 -482 459 -1274 1175 -462 481 -1274 1159 -462 481 -1292 1161 -480 459 -1272 1175 -462 1175 -492 471 -1238 1177 -468 1181 -492 437 -1298 1139 -506 1175 -460 483 -1272 1169 -478 1149 -486 1165 -468 467 -1278 463 -1270 451 -1306 1141 -492 459 -1274 573 -2164 1179 -492 1147 -460 467 -1278 1187 -450 479 -1272 477 -1254 1185 -468 451 -1278 1205 -454 479 -1266 1165 -482 461 -1272 1179 -462 477 -1262 1161 -470 485 -1272 1159 -468 1179 -486 473 -1268 1163 -484 1185 -454 477 -1266 1163 -482 1185 -460 483 -1272 1141 -470 1181 -488 1163 -494 457 -1274 477 -1254 489 -1242 1167 -484 461 -1272 569 -2166 1169 -494 1147 -492 455 -1268 1169 -486 465 -1274 449 -1278 1171 -468 467 -1276 1191 -468 457 -1286 1171 -456 467 -1272 1207 -476 457 -1270 1161 -466 487 -1270 1161 -468 1175 -484 475 -1268 1165 -480 1151 -490 477 -1240 1207 -478 1153 -490 479 -1272 1141 -470 1177 -486 1167 -492 451 -1274 443 -1288 451 -1276 1167 -514 435 -1272 547 -2198 1169 -490 1145 -490 455 -1274 1169 -480 461 -1270 471 -1272 1177 -488 459 -1278 1169 -486 467 -1270 1141 -504 457 -1272 1163 -498 453 -1274 1161 -464 481 -1274 1179 -464 1173 -488 477 -1272 1139 -504 1145 -490 477 -1272 1141 -504 1145 -482 475 -1268 1165 -480 1191 -492 1143 -490 451 -1270 479 -1250 487 -1278 1137 -484 461 -1268 547 -2200 1165 -490 1177 -488 453 -1274 1139 -518 433 -1302 447 -1288 1139 -476 483 -1270 1173 -486 433 -1300 1141 -506 455 -1276 1177 -496 453 -1278 1147 -486 445 -1298 1161 -498 1141 -490 475 -1274 1139 -502 1145 -488 483 -1272 1141 -508 1153 -486 471 -1268 1141 -510 1151 -490 1167 -492 447 -1268 445 -1296 449 -1314 1145 -490 439 -255780 65 -2012 197 -98 531 -98 133 -168 299 -100 101 -166 197 -134 133 -598 301 -68 2607 -66 429 -98 329 -64 2195 -98 2207 -66 232093 -614 1031 -610 1045 -592 1053 -608 335 -1378 1049 -628 1023 -608 1029 -634 405 -2394 165 -688 983 -670 133 -1580 63 -128 63 -100 99 -98 99 -100 99 -728 +RAW_Data: 95 -16850 1035 -592 361 -1392 1069 -548 1105 -548 381 -1352 1113 -514 433 -1310 1113 -532 1115 -516 1163 -506 411 -1306 1143 -516 1157 -482 1139 -502 437 -1310 1163 -476 447 -1312 1143 -482 461 -1274 553 -2170 1153 -524 1143 -478 449 -1308 1143 -512 433 -1310 417 -1306 1141 -520 421 -1312 1137 -516 431 -1276 1177 -464 485 -1272 1163 -462 481 -1264 1163 -506 455 -1272 1163 -502 1145 -488 477 -1274 1137 -504 455 -1264 1175 -496 1145 -488 1165 -492 455 -1272 1169 -480 1153 -490 1175 -490 451 -1274 1175 -474 459 -1276 1145 -492 447 -1294 539 -2196 1171 -490 1147 -490 457 -1272 1173 -480 457 -1276 455 -1274 1169 -490 453 -1310 1137 -516 433 -1304 1131 -504 453 -1262 1161 -506 453 -1260 1169 -502 455 -1274 1163 -496 1145 -488 475 -1270 1169 -480 459 -1272 1165 -500 1145 -488 1169 -492 449 -1272 1173 -476 1153 -488 1167 -492 449 -1272 1169 -480 465 -1272 1163 -504 453 -1276 521 -2204 1149 -488 1171 -490 453 -1274 1171 -478 463 -1276 451 -1282 1167 -478 449 -1308 1139 -484 465 -1270 1167 -504 455 -1280 1149 -486 483 -1278 1147 -486 447 -1282 1161 -490 1171 -490 437 -1274 1173 -500 455 -1272 1161 -464 1173 -490 1173 -490 455 -1274 1169 -480 1155 -488 1169 -472 449 -1282 1175 -486 471 -1272 1141 -504 453 -1274 549 -2198 1163 -490 1143 -478 485 -1276 1137 -482 463 -1276 451 -1284 1169 -470 471 -1310 1163 -490 451 -1272 1141 -508 457 -1278 1147 -488 447 -1278 1161 -490 449 -1312 1149 -484 1173 -488 475 -1272 1139 -502 455 -1272 1163 -496 1143 -490 1165 -492 449 -1272 1171 -478 1183 -492 1143 -478 451 -1274 1171 -484 461 -1276 1177 -462 483 -1278 525 -2176 1175 -490 1165 -482 483 -1278 1135 -484 463 -1276 451 -1276 1175 -490 453 -1274 1171 -482 461 -1274 1177 -462 483 -1278 1143 -492 485 -1244 1161 -494 445 -1294 1163 -502 1147 -490 475 -1272 1139 -504 457 -1274 1163 -502 1143 -488 1171 -490 451 -1274 1171 -478 1153 -490 1169 -492 449 -1270 1173 -476 457 -1276 1177 -464 483 -1274 535 -2190 1169 -492 1139 -490 455 -1274 1171 -478 461 -1272 439 -1314 1143 -522 421 -1312 1143 -482 463 -1274 1175 -462 449 -1312 1153 -484 447 -1278 1173 -484 441 -1310 1143 -520 1143 -494 445 -1288 1151 -484 439 -1304 1139 -504 1147 -486 1173 -486 449 -1274 1175 -512 1127 -512 1135 -504 445 -1278 1141 -514 437 -1312 1145 -496 419 -1312 521 -2212 1141 -506 1151 -486 443 -1302 1141 -506 457 -1276 457 -1272 1167 -488 451 -1310 1139 -478 463 -1274 1181 -498 419 -1314 1153 -484 447 -1284 1163 -478 443 -1314 1141 -492 1163 -476 441 -1296 1165 -518 419 -1312 1149 -486 1139 -516 1131 -520 447 -1272 1141 -508 1151 -518 1139 -478 445 -1310 1143 -516 435 -1304 +RAW_Data: 1135 -502 423 -1312 523 -2206 1147 -486 1171 -488 447 -1276 1141 -508 461 -1310 419 -1310 1139 -488 453 -1310 1141 -512 431 -1276 1141 -528 419 -1314 1149 -484 445 -1298 1165 -500 421 -1310 1131 -528 1143 -484 439 -1310 1139 -504 421 -1312 1149 -486 1139 -518 1127 -520 447 -1306 1139 -514 1121 -512 1135 -500 447 -1280 1173 -484 435 -1304 1143 -504 455 -1276 537 -2228 1135 -508 1139 -474 473 -1274 1163 -478 447 -1304 445 -1282 1143 -520 449 -1278 1153 -520 445 -1274 1141 -508 459 -1278 1151 -488 449 -1284 1153 -482 451 -1304 1141 -506 1161 -484 447 -1296 1163 -500 451 -1266 1175 -460 1175 -488 1165 -492 451 -1270 1169 -480 1151 -490 1171 -490 451 -1308 1135 -480 461 -1296 1133 -508 457 -1278 521 -2208 1151 -488 1163 -492 451 -1272 1171 -480 463 -1276 455 -1276 1169 -490 451 -1302 1137 -482 465 -1270 1163 -502 453 -1274 1147 -492 481 -1274 1145 -490 447 -1314 1153 -484 1139 -484 465 -1274 1179 -496 419 -1310 1149 -486 1171 -482 1163 -488 453 -1278 1173 -478 1155 -488 1171 -488 449 -1276 1171 -476 459 -1276 1147 -492 449 -1312 523 -2204 1149 -488 1171 -478 449 -1306 1137 -512 431 -1274 453 -1314 1135 -488 453 -1310 1141 -516 433 -1308 1141 -498 451 -1262 1165 -502 455 -1272 1163 -496 451 -1274 1163 -498 1147 -488 477 -1268 1141 -508 457 -1276 1149 -488 1171 -486 1133 -524 449 -1274 1143 -504 1149 -516 1137 -504 439 -1306 1127 -490 477 -1270 1173 -476 457 -1278 523 -2206 1151 -488 1167 -490 449 -1306 1141 -482 461 -1294 439 -1272 1177 -462 469 -1302 1161 -482 445 -1268 1169 -482 463 -1306 1163 -476 457 -1272 1167 -496 453 -1276 1147 -488 1171 -490 439 -1306 1143 -500 453 -1278 1151 -490 1177 -488 1163 -492 449 -1270 1141 -508 1151 -488 1169 -492 447 -1268 1171 -480 459 -1278 1177 -466 483 -255224 163 -470 197 -726 65 -198 129 -494 363 -168 365 -100 369 -98 763 -68 265 -68 633 -98 165 -66 495 -66 199 -134 97 -300 1051 -100 297 -132 369 -134 299 diff --git a/applications/debug/unit_tests/resources/unit_tests/subghz/marantec24_raw.sub b/applications/debug/unit_tests/resources/unit_tests/subghz/marantec24_raw.sub new file mode 100644 index 000000000..4a8c34b21 --- /dev/null +++ b/applications/debug/unit_tests/resources/unit_tests/subghz/marantec24_raw.sub @@ -0,0 +1,14 @@ +Filetype: Flipper SubGhz RAW File +Version: 1 +Frequency: 868350000 +Preset: FuriHalSubGhzPresetOok650Async +Protocol: RAW +RAW_Data: 1224 -1300 1801 -3200 1615 -2374 821 -3198 1603 -2410 785 -3196 815 -3188 1605 -2398 1605 -2398 1607 -2400 1605 -2398 1605 -2396 1601 -2400 1605 -2398 809 -3184 1603 -2396 815 -3194 811 -3190 811 -3194 1603 -2398 1603 -2398 1601 -2392 811 -3194 1605 -2394 1607 -16170 131 -196 217 -493440 135 -1296 1807 -3210 1591 -2396 811 -3198 1591 -2394 807 -3218 807 -3188 1607 -2400 1605 -2394 1599 -2402 1601 -2392 1609 -2400 1605 -2392 1603 -2392 815 -3190 1609 -2402 809 -3188 813 -3192 813 -3190 1605 -2400 1603 -2396 1605 -2396 813 -3194 1601 -2402 1601 -16170 133 -200 219 -382462 101 -1314 1813 -3194 1581 -2414 801 -3214 1605 -2398 807 -3190 811 -3190 1601 -2394 1603 -2398 1607 -2398 1605 -2396 1605 -2394 1601 -2394 1609 -2396 815 -3194 1603 -2400 809 -3194 811 -3190 811 -3190 1603 -2396 1603 -2396 1607 -2398 811 -3192 1607 -2396 1601 -16176 131 -198 217 -348436 303 -1106 1817 -3194 1609 -2386 803 -3214 1597 -2392 811 -3186 815 -3192 1611 -2396 1601 -2394 1609 -2404 1605 -2396 1605 -2396 1607 -2392 1601 -2396 813 -3192 1603 -2394 813 -3190 815 -3188 811 -3194 1601 -2396 1607 -2394 1601 -2396 815 -3186 1611 -2396 1609 -16168 131 -198 217 -349492 347 -1080 1799 -3192 1617 -2388 801 -3218 1601 -2396 809 -3190 809 -3192 1605 -2394 1599 -2394 1605 -2398 1607 -2398 1599 -2398 1607 -2396 1601 -2396 811 -3192 1605 -2400 811 -3184 813 -3192 811 -3192 1607 -2398 1601 -2398 1607 -2400 811 -3190 1603 -2394 1607 -16176 131 -204 213 -447994 135 -1330 977 -1036 65 -230 181 -514880 135 -66 67 -1140 1815 -3192 1615 -2388 803 -3214 1603 -2396 813 -3190 811 -3190 1609 -2398 1601 -2392 1603 -2396 1607 -2398 1607 -2398 1607 -2398 1605 -2394 813 -3186 1611 -2404 809 -3186 811 -3192 813 -3188 1605 -2394 1607 -2400 1607 -2398 807 -3190 1605 -2398 1603 -16172 131 -200 217 -395118 99 -1304 1841 -3160 1621 -2388 805 -3186 1631 -2392 809 -3182 811 -3188 1605 -2402 1601 -2398 1601 -2402 1607 -2398 1605 -2398 1601 -2392 1605 -2404 809 -3188 1599 -2396 817 -3192 811 -3192 811 -3190 1599 -2392 1603 -2398 1607 -2404 809 -3192 1603 -2402 1605 -16164 133 -198 187 -382202 137 -1302 1803 -3192 1601 -2404 803 -3184 1633 -2392 807 -3190 811 -3188 1601 -2400 1607 -2402 1601 -2392 1601 -2396 1607 -2400 1603 -2398 1605 -2398 811 -3184 1601 -2400 813 -3188 809 -3190 811 -3192 1605 -2400 1605 -2396 1599 -2402 809 -3192 1607 -2400 1607 -16174 99 -232 181 -361858 65 -1368 1785 -3228 1567 -2426 777 -3222 1601 -2402 785 -3198 815 -3186 1609 -2402 1601 -2396 1605 -2402 1603 -2396 1605 -2398 1601 -2400 1603 -2398 813 -3194 1605 -2400 809 -3186 813 -3190 813 -3188 1607 -2396 1605 -2400 1605 -2394 809 -3182 1607 -2400 1607 -16210 65 -236 177 -379100 1819 -3192 1611 -2384 799 -3220 1601 -2396 811 -3186 809 -3188 1605 -2394 1607 -2398 +RAW_Data: 1599 -2394 1603 -2396 1609 -2402 1603 -2396 1607 -2398 809 -3196 1603 -2394 809 -3188 813 -3194 809 -3188 1605 -2394 1599 -2396 1609 -2404 811 -3184 1605 -2400 1601 -16162 133 -234 191 -393094 97 -1316 1021 -1010 67 -246 173 -677840 131 -64 59 -1178 1773 -3210 1593 -2430 773 -3222 1601 -2396 811 -3186 813 -3190 1603 -2398 1603 -2396 1607 -2398 1605 -2400 1601 -2396 1605 -2396 1601 -2396 815 -3190 1607 -2402 811 -3190 811 -3186 811 -3192 1607 -2396 1603 -2396 1601 -2400 813 -3188 1607 -2404 1607 -15160 827 -3204 1577 -2404 813 -3200 1591 -2390 807 -3220 807 -3186 1599 -2400 1605 -2398 1603 -2400 1603 -2396 1605 -2398 1605 -2398 1599 -2394 809 -3190 1611 -2394 809 -3186 815 -3192 809 -3192 1603 -2398 1601 -2396 1599 -2396 815 -3188 1609 -2400 1605 -15178 801 -3222 1575 -2392 805 -3190 1615 -2396 809 -3190 819 -3198 1601 -2402 1577 -2402 1609 -2400 1605 -2398 1605 -2396 1605 -2398 1601 -2400 809 -3184 1605 -2396 809 -3190 811 -3192 813 -3190 1601 -2404 1605 -2394 1599 -2396 811 -3190 1605 -2400 1601 -15174 831 -3166 1615 -2396 783 -3200 1611 -2398 813 -3192 811 -3188 1601 -2396 1603 -2398 1607 -2396 1605 -2396 1603 -2398 1601 -2394 1601 -2398 811 -3192 1601 -2394 813 -3192 809 -3194 807 -3190 1605 -2394 1599 -2394 1601 -2394 813 -3194 1601 -2398 1603 -15178 793 -3228 1577 -2404 809 -3186 1611 -2396 815 -3192 811 -3188 1605 -2400 1577 -2404 1603 -2396 1607 -2400 1601 -2398 1603 -2394 1605 -2396 811 -3192 1605 -2394 811 -3190 811 -3188 807 -3186 1601 -2396 1605 -2398 1601 -2398 813 -3186 1601 -2394 1605 -15178 797 -3204 1581 -2400 813 -3188 1603 -2400 813 -3192 811 -3192 1607 -2398 1605 -2398 1607 -2394 1601 -2400 1605 -2398 1601 -2396 1601 -2394 809 -3190 1605 -2400 811 -3186 813 -3192 811 -3184 1601 -2396 1605 -2396 1605 -2400 809 -3184 1599 -2400 1605 -15146 827 -3188 1613 -2402 785 -3200 1605 -2396 815 -3192 811 -3190 1605 -2396 1605 -2396 1607 -2398 1601 -2398 1601 -2392 1599 -2398 1603 -2398 811 -3186 1605 -2396 811 -3190 811 -3192 809 -3190 1597 -2394 1599 -2398 1605 -2398 813 -3186 1599 -2396 1605 -15176 793 -3226 1577 -2398 817 -3198 1605 -2370 817 -3192 813 -3192 1609 -2396 1601 -2396 1605 -2396 1603 -2394 1605 -2394 1607 -2398 1607 -2394 809 -3188 1605 -2400 811 -3194 809 -3188 811 -3192 1605 -2400 1603 -2388 1605 -2394 811 -3186 1605 -2396 1605 -15180 797 -3202 1605 -2398 781 -3196 1605 -2396 815 -3184 817 -3196 1603 -2398 1605 -2398 1605 -2400 1603 -2394 1601 -2396 1607 -2398 1605 -2396 811 -3188 1605 -2396 809 -3186 807 -3194 811 -3194 1603 -2396 1597 -2396 1605 -2396 811 -3192 1603 -2396 1601 -15146 831 -3190 1603 -2404 777 -3224 1605 -2398 785 -3196 813 -3192 1607 -2396 1601 -2398 1607 -2394 1605 -2398 1603 -2394 1601 -2400 1599 -2396 807 -3192 1603 -2396 809 -3186 +RAW_Data: 813 -3190 809 -3190 1603 -2400 1603 -2398 1599 -2390 813 -3192 1603 -2394 1603 -15146 823 -3204 1603 -2398 787 -3204 1595 -2388 805 -3216 807 -3192 1605 -2400 1601 -2398 1597 -2394 1605 -2396 1603 -2398 1605 -2392 1601 -2396 809 -3192 1605 -2398 807 -3190 809 -3186 811 -3194 1603 -2394 1605 -2394 1599 -2398 813 -3192 1609 -2394 1603 -15174 795 -3206 1605 -2398 783 -3196 1607 -2400 809 -3188 813 -3188 1609 -2402 1601 -2394 1609 -2396 1603 -2396 1603 -2400 1599 -2388 1599 -2400 811 -3192 1607 -2394 811 -3186 811 -3190 809 -3194 1603 -2400 1599 -2394 1601 -2392 813 -3192 1603 -2396 1605 -15162 799 -3218 1581 -2404 807 -3202 1603 -2396 787 -3196 819 -3192 1611 -2394 1603 -2396 1607 -2402 1601 -2392 1599 -2392 1601 -2400 1607 -2398 811 -3192 1603 -2396 811 -3190 813 -3188 813 -3186 1603 -2394 1601 -2392 1605 -2400 809 -3188 1609 -2394 1601 -15156 829 -3188 1601 -2414 797 -3182 1629 -2394 807 -3192 811 -3188 1603 -2398 1599 -2392 1603 -2398 1603 -2396 1603 -2396 1607 -2400 1607 -2392 809 -3186 1603 -2400 813 -3194 811 -3192 809 -3188 1599 -2400 1603 -2404 1609 -2394 809 -3194 1599 -2394 1607 -15176 829 -3158 1623 -2404 773 -3224 1605 -2386 799 -3210 811 -3190 1607 -2392 1605 -2398 1607 -2400 1601 -2388 1605 -2398 1603 -2402 1599 -2392 809 -3188 1605 -2400 811 -3186 813 -3190 809 -3190 1603 -2396 1599 -2404 1603 -2400 809 -3188 1605 -2396 1607 -15146 829 -3216 1561 -2414 817 -3196 1599 -2404 797 -3180 809 -3212 1607 -2400 1601 -2394 1603 -2400 1603 -2396 1599 -2400 1605 -2396 1605 -2394 813 -3186 1607 -2394 811 -3186 809 -3190 813 -3192 1607 -2398 1603 -2398 1601 -2396 813 -3192 1603 -2392 1605 -15144 827 -3188 1613 -2404 809 -3192 1615 -2370 811 -3188 811 -3188 1611 -2398 1603 -2400 1601 -2394 1601 -2402 1605 -2396 1601 -2394 1609 -2398 811 -3186 1603 -2392 813 -3196 811 -3182 809 -3188 1603 -2402 1605 -2400 1599 -2394 809 -3194 1607 -2398 1601 -15148 831 -3186 1587 -2424 811 -3192 1575 -2408 803 -3188 805 -3222 1599 -2392 1601 -2400 1609 -2398 1601 -2392 1597 -2394 1601 -2400 1601 -2400 807 -3190 1601 -2400 813 -3190 809 -3190 809 -3188 1607 -2398 1601 -2396 1605 -2398 809 -3184 1603 -2400 1605 -15176 795 -3200 1613 -2400 783 -3198 1603 -2398 813 -3192 809 -3186 1607 -2398 1605 -2398 1605 -2398 1599 -2394 1605 -2398 1603 -2392 1599 -2396 809 -3194 1609 -2390 811 -3194 813 -3188 811 -3188 1599 -2394 1603 -2398 1601 -2394 815 -3192 1605 -2402 1601 -15150 831 -3186 1605 -2412 799 -3206 1601 -2392 809 -3186 813 -3192 1603 -2402 1601 -2392 1605 -2398 1607 -2396 1601 -2392 1609 -2402 1599 -2396 811 -3186 1601 -2398 815 -3196 809 -3188 809 -3188 1607 -2394 1605 -2394 1603 -2394 811 -3194 1603 -2398 1607 -15174 797 -3218 1563 -2424 785 -3194 1633 -2396 795 -3178 805 -3214 1607 -2394 1603 -2400 +RAW_Data: 1603 -2392 1603 -2398 1605 -2400 1597 -2392 1603 -2396 811 -3198 1603 -2390 809 -3192 811 -3188 813 -3192 1599 -2394 1607 -2398 1607 -2394 811 -3192 1601 -2394 1605 -15152 861 -3154 1603 -2410 799 -3186 1601 -2422 809 -3190 809 -3186 1601 -2392 1603 -2394 1611 -2398 1605 -2400 1601 -2392 1609 -2396 1603 -2398 809 -3186 1605 -2400 811 -3188 811 -3188 807 -3192 1605 -2402 1597 -2392 1603 -2396 813 -3194 1601 -2398 1605 -15174 795 -3200 1597 -2428 785 -3196 1613 -2398 785 -3192 815 -3192 1611 -2400 1603 -2394 1603 -2400 1601 -2398 1607 -2394 1603 -2398 1603 -2396 811 -3190 1605 -2394 811 -3194 811 -3182 811 -3192 1607 -2392 1599 -2394 1601 -2398 811 -3192 1607 -2392 1603 -15156 827 -3190 1607 -2408 797 -3210 1599 -2398 777 -3218 811 -3192 1601 -2400 1599 -2398 1601 -2396 1597 -2396 1601 -2392 1607 -2392 1605 -2400 813 -3190 1601 -2396 811 -3194 809 -3190 813 -3190 1603 -2394 1599 -2390 1603 -2400 811 -3190 1607 -2398 1605 -15150 825 -3192 1603 -2404 793 -3178 1605 -2422 777 -3222 775 -3218 1603 -2398 1605 -2398 1597 -2392 1603 -2398 1605 -2400 1601 -2394 1601 -2392 811 -3192 1609 -2398 813 -3190 809 -3182 809 -3184 1607 -2398 1603 -2396 1607 -2398 813 -3190 1607 -2396 1601 -15172 797 -3230 1563 -2424 805 -3190 1599 -2404 795 -3182 807 -3214 1601 -2402 1603 -2396 1601 -2396 1603 -2398 1605 -2398 1599 -2392 1601 -2402 813 -3192 1601 -2396 809 -3188 811 -3188 809 -3192 1605 -2400 1607 -2398 1599 -2394 809 -3190 1607 -2400 1605 -15180 827 -3190 1577 -2394 819 -3196 1613 -2366 815 -3196 813 -3190 1607 -2396 1607 -2402 1599 -2398 1605 -2400 1603 -2398 1601 -2392 1605 -2400 811 -3186 1603 -2400 813 -3190 809 -3196 807 -3182 1601 -2396 1609 -2398 1601 -2398 813 -3192 1601 -2394 1607 -15174 793 -3202 1599 -2424 787 -3196 1607 -2404 785 -3192 815 -3188 1609 -2404 1603 -2398 1607 -2396 1601 -2400 1603 -2394 1601 -2394 1603 -2400 811 -3190 1605 -2400 811 -3188 809 -3190 813 -3194 1597 -2398 1607 -2394 1603 -2394 809 -3190 1603 -2392 1607 -15180 795 -3230 1581 -2392 807 -3218 1593 -2408 777 -3220 781 -3204 1597 -2424 1605 -2394 1595 -2392 1605 -2394 1599 -2396 1605 -2402 1603 -2394 809 -3188 1601 -2396 813 -3194 811 -3188 813 -3190 1605 -2398 1607 -2392 1601 -2398 811 -3192 1599 -2400 1605 -15178 797 -3218 1595 -2400 803 -3198 1605 -2370 825 -3182 803 -3214 1603 -2396 1601 -2398 1601 -2394 1599 -2398 1603 -2396 1607 -2394 1605 -2394 809 -3190 1607 -2398 809 -3194 811 -3188 809 -3194 1605 -2394 1599 -2396 1605 -2396 809 -3196 1603 -2402 1599 -15160 829 -3192 1579 -2400 817 -3198 1605 -2398 783 -3194 813 -3190 1609 -2400 1607 -2400 1599 -2394 1601 -2394 1609 -2398 1601 -2396 1605 -2394 809 -3186 1609 -2400 811 -3186 809 -3196 811 -3190 1605 -2396 1601 -2398 1607 -2396 809 -3186 1605 -2398 1607 -15170 +RAW_Data: 827 -3192 1595 -2376 813 -3192 1601 -2414 797 -3186 807 -3220 1601 -2398 1603 -2394 1599 -2396 1607 -2400 1605 -2394 1597 -2398 1603 -2398 813 -3192 1603 -2394 809 -3188 809 -3188 811 -3192 1607 -2396 1601 -2398 1605 -2398 811 -3188 1603 -2400 1603 -15174 829 -3162 1627 -2374 803 -3224 1571 -2412 801 -3186 807 -3222 1605 -2392 1605 -2392 1599 -2394 1605 -2404 1601 -2396 1607 -2396 1601 -2394 809 -3188 1601 -2398 811 -3190 815 -3194 811 -3184 1603 -2400 1605 -2400 1605 -2394 809 -3188 1609 -2394 1605 -15154 829 -3188 1603 -2412 801 -3210 1603 -2398 807 -3182 809 -3196 1605 -2400 1605 -2396 1599 -2402 1607 -2390 1599 -2396 1599 -2400 1607 -2396 811 -3192 1605 -2396 813 -3196 809 -3190 811 -3192 1609 -2394 1597 -2396 1607 -2398 809 -3186 1605 -2394 1605 -15178 795 -3216 1577 -2408 819 -3190 1607 -2394 817 -3194 779 -3194 1607 -2404 1605 -2398 1607 -2394 1601 -2398 1605 -2400 1603 -2402 1607 -2394 811 -3192 1601 -2396 809 -3186 813 -3194 811 -3188 1599 -2394 1601 -2402 1601 -2398 811 -3186 1603 -2396 1611 -15176 799 -3224 1567 -2424 785 -3202 1599 -2396 809 -3204 783 -3198 1605 -2398 1607 -2402 1605 -2398 1607 -2400 1599 -2398 1605 -2392 1603 -2400 811 -3186 1601 -2400 811 -3194 809 -3184 811 -3186 1603 -2396 1603 -2398 1607 -2398 811 -3188 1605 -2396 1605 -15174 829 -3166 1605 -2402 809 -3190 1615 -2368 815 -3194 815 -3192 1605 -2396 1603 -2400 1603 -2400 1605 -2392 1601 -2400 1607 -2400 1601 -2402 811 -3194 1599 -2392 809 -3188 813 -3184 813 -3192 1605 -2400 1605 -2400 1607 -2390 809 -3188 1607 -2398 1603 -15174 829 -3158 1617 -2400 787 -3192 1607 -2404 811 -3184 815 -3190 1607 -2402 1601 -2396 1605 -2400 1601 -2396 1603 -2396 1607 -2400 1603 -2394 809 -3188 1609 -2398 809 -3190 811 -3188 809 -3188 1607 -2396 1599 -2396 1607 -2400 809 -3188 1607 -2398 1603 -15172 797 -3228 1575 -2424 771 -3202 1615 -2386 801 -3198 807 -3218 1587 -2390 1603 -2394 1603 -2424 1603 -2396 1603 -2398 1599 -2394 1605 -2396 809 -3192 1605 -2400 807 -3184 809 -3190 813 -3190 1603 -2390 1601 -2394 1601 -2396 813 -3196 1607 -2402 1599 -15152 829 -3194 1605 -2408 793 -3182 1597 -2426 807 -3184 811 -3192 1607 -2392 1603 -2396 1605 -2400 1601 -2394 1603 -2394 1605 -2400 1605 -2394 809 -3190 1605 -2396 811 -3192 809 -3186 811 -3190 1601 -2394 1605 -2400 1607 -2398 809 -3186 1601 -2394 1603 -15174 829 -3160 1635 -2382 811 -3194 1609 -2400 779 -3220 781 -3222 1575 -2406 1603 -2398 1607 -2402 1601 -2394 1603 -2396 1601 -2402 1605 -2398 805 -3190 1605 -2394 813 -3194 809 -3188 811 -3192 1603 -2396 1599 -2394 1607 -2394 811 -3194 1603 -2394 1601 -15174 799 -3216 1599 -2402 785 -3198 1615 -2376 819 -3194 811 -3190 1599 -2394 1623 -2392 1599 -2396 1611 -2382 1599 -2390 1633 -2392 1599 -2396 811 -3194 1599 -2394 811 -3188 +RAW_Data: 811 -3190 809 -3192 1603 -2398 1607 -2392 1599 -2398 811 -3190 1603 -2402 1601 -15172 795 -3194 1603 -2404 807 -3186 1599 -2394 821 -3196 785 -3196 1609 -2396 1609 -2398 1603 -2396 1605 -2400 1599 -2394 1605 -2396 1605 -2398 809 -3190 1601 -2396 811 -3190 809 -3194 809 -3188 1601 -2398 1603 -2398 1607 -2392 807 -3190 1603 -2402 1601 -15178 803 -3198 1579 -2410 807 -3188 1625 -2406 793 -3204 779 -3192 1609 -2408 1597 -2392 1595 -2424 1605 -2394 1601 -2394 1601 -2392 1601 -2396 809 -3194 1607 -2398 811 -3194 811 -3186 809 -3182 1607 -2398 1605 -2392 1605 -2392 809 -3190 1611 -2400 1605 -15154 799 -3228 1567 -2434 795 -3180 1627 -2392 809 -3190 809 -3186 1603 -2396 1599 -2394 1603 -2398 1603 -2398 1603 -2392 1607 -2400 1601 -2390 809 -3186 1601 -2404 811 -3188 811 -3190 813 -3186 1605 -2398 1605 -2392 1599 -2400 813 -3190 1599 -2396 1603 -15184 799 -3194 1607 -2410 795 -3176 1603 -2428 807 -3188 811 -3188 1603 -2394 1607 -2398 1599 -2396 1603 -2400 1605 -2394 1601 -2394 1607 -2400 809 -3186 1607 -2400 809 -3184 811 -3188 809 -3196 1605 -2396 1603 -2394 1607 -2392 809 -3188 1607 -2396 1609 -15176 795 -3226 1567 -2406 819 -3198 1579 -2406 809 -3190 821 -3198 1575 -2400 1603 -2398 1611 -2400 1603 -2398 1607 -2396 1601 -2394 1607 -2402 809 -3190 1603 -2396 811 -3186 809 -3192 811 -3192 1607 -2394 1603 -2398 1601 -2396 809 -3196 1605 -2398 1603 -15148 827 -3196 1597 -2426 775 -3200 1613 -2398 783 -3198 813 -3184 1613 -2400 1607 -2400 1605 -2398 1603 -2400 1601 -2394 1603 -2398 1605 -2398 809 -3192 1603 -2396 811 -3190 811 -3190 809 -3194 1605 -2394 1601 -2396 1601 -2400 811 -3192 1607 -2396 1603 -15162 797 -3244 1573 -2398 817 -3196 1603 -2404 795 -3210 775 -3220 1603 -2396 1603 -2396 1607 -2394 1607 -2368 1633 -2392 1601 -2396 1607 -2396 811 -3190 1605 -2400 807 -3186 811 -3194 809 -3186 1607 -2396 1603 -2392 1599 -2394 811 -3186 1611 -2396 1601 -15178 763 -3288 1501 -2496 741 -3254 1543 -2442 777 -3194 815 -3206 1585 -2390 1603 -2426 1601 -2392 1599 -2400 1605 -2396 1599 -2398 1603 -2398 809 -3190 1601 -2396 811 -3188 811 -3188 811 -3194 1607 -2396 1599 -2396 1605 -2398 813 -3190 1605 -2400 1603 -16206 65 -230 181 -579692 165 -1118 1797 -3196 1591 -2420 773 -3224 1603 -2394 809 -3188 809 -3188 1609 -2402 1603 -2398 1599 -2400 1605 -2400 1605 -2396 1605 -2396 1603 -2394 813 -3194 1607 -2398 809 -3188 809 -3192 809 -3196 1603 -2394 1599 -2396 1605 -2402 811 -3190 1605 -2400 1605 -15178 793 -3222 1577 -2402 809 -3192 1601 -2394 807 -3202 819 -3196 1609 -2396 1603 -2396 1601 -2392 1613 -2400 1579 -2398 1613 -2396 1603 -2396 813 -3192 1607 -2394 813 -3198 809 -3188 809 -3188 1599 -2398 1607 -2400 1607 -2398 807 -3186 1603 -2400 1607 -15178 823 -3168 1615 -2398 809 -3192 1615 -2398 783 -3228 +RAW_Data: 779 -3200 1607 -2394 1605 -2402 1607 -2394 1601 -2396 1603 -2400 1607 -2398 1603 -2396 809 -3182 1607 -2402 813 -3194 811 -3188 811 -3186 1603 -2402 1605 -2398 1607 -2396 809 -3188 1603 -2398 1609 -15162 829 -3204 1575 -2428 783 -3202 1597 -2422 775 -3214 809 -3192 1605 -2400 1603 -2402 1601 -2392 1603 -2394 1605 -2392 1611 -2398 1603 -2398 811 -3182 1609 -2400 813 -3196 811 -3186 811 -3186 1609 -2400 1605 -2394 1601 -2402 807 -3190 1607 -2398 1607 -15178 829 -3182 1595 -2424 773 -3224 1589 -2384 805 -3222 809 -3188 1603 -2398 1605 -2400 1599 -2396 1601 -2392 1601 -2400 1609 -2396 1605 -2398 813 -3190 1603 -2396 813 -3186 811 -3194 811 -3196 1603 -2394 1603 -2400 1603 -2396 809 -3186 1609 -2400 1605 -15160 825 -3198 1605 -2402 785 -3208 1599 -2426 775 -3220 807 -3186 1601 -2396 1609 -2398 1607 -2392 1599 -2402 1605 -2398 1599 -2398 1603 -2402 807 -3190 1603 -2398 813 -3186 813 -3196 809 -3184 1601 -2394 1603 -2428 1571 -2400 815 -3220 1575 -2402 1609 -15178 793 -3234 1575 -2404 819 -3188 1599 -2398 807 -3204 819 -3192 1581 -2400 1607 -2396 1607 -2402 1601 -2392 1605 -2398 1605 -2400 1605 -2398 811 -3190 1609 -2396 811 -3186 811 -3194 811 -3186 1603 -2396 1609 -2396 1601 -2400 811 -3192 1603 -2394 1603 -15188 831 -3184 1609 -2382 803 -3190 1629 -2396 809 -3192 809 -3188 1607 -2396 1607 -2398 1607 -2392 1599 -2396 1607 -2398 1605 -2398 1605 -2394 811 -3188 1607 -2400 813 -3192 811 -3190 813 -3186 1603 -2400 1603 -2402 1599 -2394 811 -3190 1609 -2396 1609 -15164 823 -3196 1599 -2396 789 -3210 1595 -2424 809 -3188 811 -3186 1603 -2398 1605 -2390 1601 -2394 1609 -2400 1605 -2396 1607 -2394 1603 -2398 813 -3194 1599 -2394 815 -3194 809 -3192 809 -3190 1607 -2398 1605 -2396 1603 -2394 809 -3188 1605 -2402 1601 -15162 827 -3196 1579 -2426 805 -3206 1605 -2366 811 -3208 799 -3212 1603 -2400 1603 -2394 1601 -2398 1605 -2398 1599 -2394 1601 -2394 1609 -2394 813 -3192 1607 -2398 813 -3186 807 -3188 813 -3188 1601 -2396 1609 -2396 1603 -2392 811 -3194 1601 -2398 1611 -15174 831 -3186 1595 -2406 785 -3200 1625 -2378 813 -3190 815 -3202 1593 -2424 1603 -2400 1603 -2394 1597 -2400 1603 -2400 1605 -2396 1597 -2400 811 -3192 1601 -2400 811 -3190 811 -3190 811 -3192 1607 -2398 1603 -2392 1607 -2394 811 -3194 1603 -2396 1601 -15154 831 -3190 1605 -2404 797 -3180 1635 -2392 807 -3190 809 -3188 1605 -2400 1603 -2394 1605 -2396 1605 -2398 1601 -2394 1605 -2400 1605 -2396 811 -3192 1603 -2394 809 -3186 815 -3192 805 -3192 1601 -2396 1601 -2366 1629 -2388 807 -3192 1603 -2396 1599 -15118 825 -3198 1605 -2400 783 -3198 1589 -2392 809 -3180 809 -3186 1629 -2400 1573 -2390 1631 -2362 1633 -2360 1631 -2366 1599 -2394 1603 -2392 805 -3214 1601 -2396 809 -3184 811 -3190 807 -3160 1631 -2394 1601 -2364 1601 -2420 +RAW_Data: 807 -3192 1603 -2360 1633 -15120 827 -3200 1575 -2400 809 -3196 1605 -2394 807 -3186 809 -3160 1633 -2392 1599 -2366 1599 -2394 1631 -2358 1635 -2366 1601 -2396 1629 -2390 777 -3190 1629 -2400 775 -3218 775 -3216 809 -3188 1603 -2362 1631 -2390 1601 -2396 811 -3190 1597 -2400 1601 -15128 809 -3220 1577 -2398 809 -3196 1603 -2364 811 -3194 811 -3192 1605 -2400 1605 -2360 1601 -2396 1601 -2392 1603 -2390 1631 -2394 1571 -2394 807 -3218 1603 -2396 775 -3214 807 -3186 807 -3162 1603 -2394 1601 -2390 1603 -2396 805 -3222 1603 -2364 1635 -15142 791 -3228 1571 -2400 811 -3188 1601 -2394 809 -3194 809 -3186 1605 -2398 1601 -2390 1603 -2362 1633 -2362 1601 -2394 1635 -2362 1631 -2390 807 -3190 1605 -2394 773 -3220 775 -3186 807 -3192 1599 -2424 1597 -2366 1603 -2396 807 -3216 1601 -2398 1601 -15140 813 -3196 1571 -2398 813 -3190 1601 -2396 811 -3186 811 -3192 1603 -2402 1601 -2392 1601 -2392 1609 -2394 1603 -2394 1607 -2394 1611 -2396 811 -3190 1605 -2400 811 -3190 811 -3190 813 -3190 1601 -2400 1603 -2394 1607 -2398 809 -3188 1607 -2398 1605 -15176 793 -3226 1579 -2400 811 -3186 1613 -2400 785 -3194 815 -3194 1611 -2396 1607 -2396 1601 -2400 1607 -2396 1605 -2398 1603 -2394 1599 -2392 811 -3190 1605 -2396 815 -3192 815 -3190 813 -3188 1601 -2398 1603 -2398 1603 -2398 811 -3194 1605 -2398 1601 -15156 859 -3148 1639 -2378 803 -3214 1569 -2430 807 -3186 809 -3194 1601 -2396 1605 -2398 1607 -2400 1605 -2396 1605 -2396 1607 -2392 1599 -2394 811 -3184 1609 -2400 815 -3194 809 -3188 809 -3196 1605 -2394 1607 -2394 1599 -2396 813 -3194 1603 -2398 1603 -15170 797 -3212 1595 -2402 819 -3184 1613 -2390 831 -3174 819 -3196 1597 -2402 1589 -2388 1601 -2396 1633 -2398 1601 -2392 1599 -2400 1607 -2396 811 -3186 1609 -2402 809 -3188 813 -3192 809 -3188 1607 -2396 1601 -2398 1601 -2398 811 -3192 1599 -2396 1607 -15174 831 -3186 1579 -2402 801 -3202 1615 -2388 827 -3178 803 -3188 1617 -2392 1601 -2392 1635 -2396 1599 -2392 1603 -2398 1605 -2400 1601 -2392 813 -3194 1601 -2400 813 -3190 811 -3190 809 -3188 1603 -2396 1601 -2398 1605 -2400 809 -3184 1601 -2396 1607 -15178 831 -3166 1611 -2398 815 -3198 1577 -2398 811 -3194 815 -3192 1607 -2400 1605 -2400 1599 -2398 1603 -2396 1601 -2398 1605 -2400 1609 -2392 811 -3192 1605 -2398 811 -3188 811 -3192 813 -3190 1607 -2394 1605 -2398 1603 -2400 809 -3190 1601 -2396 1609 -15174 795 -3230 1567 -2432 781 -3204 1597 -2394 807 -3222 807 -3182 1605 -2398 1603 -2392 1603 -2396 1607 -2396 1603 -2404 1605 -2400 1599 -2396 811 -3186 1611 -2398 813 -3188 811 -3192 811 -3188 1605 -2404 1603 -2400 1605 -2398 807 -3190 1605 -2396 1605 -15164 827 -3198 1605 -2398 783 -3206 1595 -2424 807 -3192 807 -3184 1605 -2396 1605 -2400 1607 -2398 1599 -2394 1607 -2396 1605 -2400 1599 -2394 +RAW_Data: 809 -3184 1609 -2400 809 -3194 813 -3188 807 -3188 1603 -2400 1605 -2400 1599 -2398 809 -3190 1605 -2400 1603 -15170 803 -3208 1595 -2402 809 -3196 1589 -2388 807 -3216 809 -3182 1603 -2394 1607 -2398 1603 -2396 1607 -2396 1603 -2400 1605 -2396 1599 -2394 811 -3188 1605 -2396 817 -3196 811 -3182 811 -3192 1607 -2394 1603 -2394 1607 -2398 811 -3190 1603 -2398 1601 -15186 833 -3156 1605 -2412 799 -3218 1595 -2392 809 -3186 811 -3186 1609 -2404 1607 -2394 1605 -2396 1601 -2400 1607 -2396 1601 -2392 1607 -2400 809 -3192 1603 -2396 815 -3194 809 -3188 809 -3192 1603 -2400 1599 -2394 1605 -2400 811 -3188 1599 -2400 1605 -16142 167 -202 diff --git a/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a_render.c b/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a_render.c index 810242fbc..6ceb4bce0 100644 --- a/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a_render.c +++ b/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a_render.c @@ -1,6 +1,6 @@ #include "iso14443_3a_render.h" -void nfc_render_iso14443_3a_format_bytes(FuriString* str, const uint8_t* const data, size_t size) { +void nfc_render_iso14443_3a_format_bytes(FuriString* str, const uint8_t* data, size_t size) { for(size_t i = 0; i < size; i++) { furi_string_cat_printf(str, " %02X", data[i]); } diff --git a/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a_render.h b/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a_render.h index 34e347aa3..b81515566 100644 --- a/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a_render.h +++ b/applications/main/nfc/helpers/protocol_support/iso14443_3a/iso14443_3a_render.h @@ -11,7 +11,7 @@ void nfc_render_iso14443_3a_info( void nfc_render_iso14443_tech_type(const Iso14443_3aData* data, FuriString* str); -void nfc_render_iso14443_3a_format_bytes(FuriString* str, const uint8_t* const data, size_t size); +void nfc_render_iso14443_3a_format_bytes(FuriString* str, const uint8_t* data, size_t size); void nfc_render_iso14443_3a_brief(const Iso14443_3aData* data, FuriString* str); diff --git a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.c b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.c index c4ad67ff8..ef83d1942 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.c +++ b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.c @@ -10,22 +10,29 @@ static void nfc_render_mf_ultralight_pages_count(const MfUltralightData* data, F } void nfc_render_mf_ultralight_pwd_pack(const MfUltralightData* data, FuriString* str) { + MfUltralightConfigPages* config; + bool all_pages = mf_ultralight_is_all_data_read(data); - if(all_pages) { + bool has_config = mf_ultralight_get_config_page(data, &config); + + if(!has_config) { + furi_string_cat_printf(str, "\e#Already Unlocked!"); + } else if(all_pages) { furi_string_cat_printf(str, "\e#All Pages Are Unlocked!"); } else { furi_string_cat_printf(str, "\e#Some Pages Are Locked!"); } - MfUltralightConfigPages* config; - mf_ultralight_get_config_page(data, &config); + if(has_config) { + furi_string_cat_printf(str, "\nPassword: "); + nfc_render_iso14443_3a_format_bytes( + str, config->password.data, MF_ULTRALIGHT_AUTH_PASSWORD_SIZE); - furi_string_cat_printf(str, "\nPassword: "); - nfc_render_iso14443_3a_format_bytes( - str, config->password.data, MF_ULTRALIGHT_AUTH_PASSWORD_SIZE); - - furi_string_cat_printf(str, "\nPACK: "); - nfc_render_iso14443_3a_format_bytes(str, config->pack.data, MF_ULTRALIGHT_AUTH_PACK_SIZE); + furi_string_cat_printf(str, "\nPACK: "); + nfc_render_iso14443_3a_format_bytes(str, config->pack.data, MF_ULTRALIGHT_AUTH_PACK_SIZE); + } else { + furi_string_cat_printf(str, "\nThis card does not support\npassword protection!"); + } nfc_render_mf_ultralight_pages_count(data, str); } diff --git a/lib/lfrfid/protocols/protocol_gproxii.c b/lib/lfrfid/protocols/protocol_gproxii.c index 73cbe8f39..ab283742d 100644 --- a/lib/lfrfid/protocols/protocol_gproxii.c +++ b/lib/lfrfid/protocols/protocol_gproxii.c @@ -38,12 +38,52 @@ void protocol_gproxii_free(ProtocolGProxII* protocol) { free(protocol); } -uint8_t* protocol_gproxii_get_data(ProtocolGProxII* proto) { - return proto->data; +uint8_t* protocol_gproxii_get_data(ProtocolGProxII* protocol) { + return protocol->decoded_data; +} + +bool wiegand_check(uint64_t fc_and_card, bool even_parity, bool odd_parity, int card_len) { + uint8_t even_parity_sum = 0; + uint8_t odd_parity_sum = 1; + switch(card_len) { + case 26: + for(int8_t i = 12; i < 24; i++) { + if(((fc_and_card >> i) & 1) == 1) { + even_parity_sum++; + } + } + if(even_parity_sum % 2 != even_parity) return false; + + for(int8_t i = 0; i < 12; i++) { + if(((fc_and_card >> i) & 1) == 1) { + odd_parity_sum++; + } + } + if(odd_parity_sum % 2 != odd_parity) return false; + break; + case 36: + for(int8_t i = 17; i < 34; i++) { + if(((fc_and_card >> i) & 1) == 1) { + even_parity_sum++; + } + } + if(even_parity_sum % 2 != even_parity) return false; + + for(int8_t i = 0; i < 17; i++) { + if(((fc_and_card >> i) & 1) == 1) { + odd_parity_sum++; + } + } + if(odd_parity_sum % 2 != odd_parity) return false; + break; + default: + } + return true; } void protocol_gproxii_decoder_start(ProtocolGProxII* protocol) { memset(protocol->data, 0, GPROXII_ENCODED_BYTE_FULL_SIZE); + memset(protocol->decoded_data, 0, GPROXII_DATA_SIZE); protocol->last_short = false; } @@ -73,13 +113,13 @@ static bool protocol_gproxii_can_be_decoded(ProtocolGProxII* protocol) { // XORVALUE LLLLLL DD PPPPPPPPPPPPPPPP E FFFFFFFF CCCCCCCCCCCCCCCC O UUUUUUUUUUUUUU // 10010000 011010 11 0000000100000000 0 00000000 0000000000000001 0 00000000000000 - Profile: 256 FC: 0 Card: 1 - // 72 Bit Guardall/Verex/Chubb GProx II 36 bit key with 26 bit profile - // 0 10 20 30 40 50 60 70 - // | | | | | | | | - // 01234567 890123 45 67890123456789012345678901 2 34567890 1234567890123456 7 8901 + // 72 Bit Guardall/Verex/Chubb GProx II 36 bit key with 16 bit profile + // 0 10 20 30 40 50 60 70 + // | | | | | | | | + // 01234567 890123 45 67890123 45678901 2 34567890123456 78901234567890123456 7 8901 // -------------------------------------------------------------------------------- - // XORVALUE LLLLLL DD PPPPPPPPPPPPPPPPPPPPPPPPPP E FFFFFFFF CCCCCCCCCCCCCCCC O UUUU - // 10111000 100100 10 00000001000000000000000000 1 01000000 1000100010111000 1 0000 - Profile: 262144 FC: 64 Card: 35000 + // XORVALUE LLLLLL DD PPPPPPPP PPPPPPPP E UUUUUUFFFFFFFF UUUUCCCCCCCCCCCCCCCC O UUUU + // 10111000 100100 10 00000001 00000000 0 00000000010100 00001000100010111000 1 0000 - Profile: 256 FC: 20 Card: 35000 // X = XOR Key, L = Message length, D = 2 bit check digits, P = Profile, E = Wiegand leading even parity // F = Faclity code, C = Card number, O = Wiegand trailing odd parity, U = Unused bits @@ -88,7 +128,7 @@ static bool protocol_gproxii_can_be_decoded(ProtocolGProxII* protocol) { if(bit_lib_get_bits(protocol->data, 0, 6) != 0b111110) return false; // Check always 0 parity on every 5th bit after preamble - if(bit_lib_test_parity(protocol->data, 5, GPROXII_ENCODED_BIT_SIZE, BitLibParityAlways0, 5)) + if(!bit_lib_test_parity(protocol->data, 6, GPROXII_ENCODED_BIT_SIZE, BitLibParityAlways0, 5)) return false; // Start GProx II decode @@ -109,7 +149,20 @@ static bool protocol_gproxii_can_be_decoded(ProtocolGProxII* protocol) { // Check card length is either 26 or 36 int card_len = bit_lib_get_bits(protocol->decoded_data, 8, 6); + if(card_len == 26 || card_len == 36) { + // wiegand parity + if(card_len == 26) { + uint64_t fc_and_card = bit_lib_get_bits_64(protocol->decoded_data, 33, 24); + bool even_parity = bit_lib_get_bits(protocol->decoded_data, 32, 1); + bool odd_parity = bit_lib_get_bits(protocol->decoded_data, 57, 1); + if(!wiegand_check(fc_and_card, even_parity, odd_parity, card_len)) return false; + } else if(card_len == 36) { + uint64_t fc_and_card = bit_lib_get_bits_64(protocol->decoded_data, 33, 34); + uint8_t even_parity = bit_lib_get_bits(protocol->decoded_data, 32, 1); + uint8_t odd_parity = bit_lib_get_bits(protocol->decoded_data, 67, 1); + if(!wiegand_check(fc_and_card, even_parity, odd_parity, card_len)) return false; + } return true; } else { return false; // If we don't get a 26 or 36 it's not a known card type @@ -189,7 +242,7 @@ void protocol_gproxii_render_data(ProtocolGProxII* protocol, FuriString* result) // Print FC, Card and Length furi_string_cat_printf( result, - "FC: %hhu Card: %hu LEN: %hhu\n", + "FC: %u Card: %u LEN: %hhu\n", bit_lib_get_bits(protocol->decoded_data, 33, 8), bit_lib_get_bits_16(protocol->decoded_data, 41, 16), card_len); @@ -204,17 +257,17 @@ void protocol_gproxii_render_data(ProtocolGProxII* protocol, FuriString* result) // Print FC, Card and Length furi_string_cat_printf( result, - "FC: %hhu Card: %hu LEN: %hhu\n", - bit_lib_get_bits(protocol->decoded_data, 43, 8), + "FC: %u Card: %u LEN: %hhu\n", + bit_lib_get_bits_16(protocol->decoded_data, 33, 14), bit_lib_get_bits_16(protocol->decoded_data, 51, 16), card_len); // XOR Key, CRC and Profile furi_string_cat_printf( result, - "XOR: %hhu CRC: %hhu P: %06lX", + "XOR: %hhu CRC: %hhu P: %04hX", xor_code, crc_code, - bit_lib_get_bits_32(protocol->decoded_data, 16, 26)); + bit_lib_get_bits_16(protocol->decoded_data, 16, 16)); } else { furi_string_cat_printf(result, "Read Error\n"); } diff --git a/lib/subghz/protocols/gangqi.c b/lib/subghz/protocols/gangqi.c new file mode 100644 index 000000000..9dd8dd250 --- /dev/null +++ b/lib/subghz/protocols/gangqi.c @@ -0,0 +1,337 @@ +#include "gangqi.h" +#include "../blocks/const.h" +#include "../blocks/decoder.h" +#include "../blocks/encoder.h" +#include "../blocks/generic.h" +#include "../blocks/math.h" + +#define TAG "SubGhzProtocolGangQi" + +static const SubGhzBlockConst subghz_protocol_gangqi_const = { + .te_short = 500, + .te_long = 1200, + .te_delta = 200, + .min_count_bit_for_found = 34, +}; + +struct SubGhzProtocolDecoderGangQi { + SubGhzProtocolDecoderBase base; + + SubGhzBlockDecoder decoder; + SubGhzBlockGeneric generic; +}; + +struct SubGhzProtocolEncoderGangQi { + SubGhzProtocolEncoderBase base; + + SubGhzProtocolBlockEncoder encoder; + SubGhzBlockGeneric generic; +}; + +typedef enum { + GangQiDecoderStepReset = 0, + GangQiDecoderStepSaveDuration, + GangQiDecoderStepCheckDuration, +} GangQiDecoderStep; + +const SubGhzProtocolDecoder subghz_protocol_gangqi_decoder = { + .alloc = subghz_protocol_decoder_gangqi_alloc, + .free = subghz_protocol_decoder_gangqi_free, + + .feed = subghz_protocol_decoder_gangqi_feed, + .reset = subghz_protocol_decoder_gangqi_reset, + + .get_hash_data = NULL, + .get_hash_data_long = subghz_protocol_decoder_gangqi_get_hash_data, + .serialize = subghz_protocol_decoder_gangqi_serialize, + .deserialize = subghz_protocol_decoder_gangqi_deserialize, + .get_string = subghz_protocol_decoder_gangqi_get_string, + .get_string_brief = NULL, +}; + +const SubGhzProtocolEncoder subghz_protocol_gangqi_encoder = { + .alloc = subghz_protocol_encoder_gangqi_alloc, + .free = subghz_protocol_encoder_gangqi_free, + + .deserialize = subghz_protocol_encoder_gangqi_deserialize, + .stop = subghz_protocol_encoder_gangqi_stop, + .yield = subghz_protocol_encoder_gangqi_yield, +}; + +const SubGhzProtocol subghz_protocol_gangqi = { + .name = SUBGHZ_PROTOCOL_GANGQI_NAME, + .type = SubGhzProtocolTypeStatic, + .flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | + SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send, + + .decoder = &subghz_protocol_gangqi_decoder, + .encoder = &subghz_protocol_gangqi_encoder, +}; + +void* subghz_protocol_encoder_gangqi_alloc(SubGhzEnvironment* environment) { + UNUSED(environment); + SubGhzProtocolEncoderGangQi* instance = malloc(sizeof(SubGhzProtocolEncoderGangQi)); + + instance->base.protocol = &subghz_protocol_gangqi; + instance->generic.protocol_name = instance->base.protocol->name; + + instance->encoder.repeat = 10; + instance->encoder.size_upload = 256; + instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration)); + instance->encoder.is_running = false; + return instance; +} + +void subghz_protocol_encoder_gangqi_free(void* context) { + furi_assert(context); + SubGhzProtocolEncoderGangQi* instance = context; + free(instance->encoder.upload); + free(instance); +} + +/** + * Generating an upload from data. + * @param instance Pointer to a SubGhzProtocolEncoderGangQi instance + */ +static void subghz_protocol_encoder_gangqi_get_upload(SubGhzProtocolEncoderGangQi* instance) { + furi_assert(instance); + size_t index = 0; + + // Send key and GAP + for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) { + if(bit_read(instance->generic.data, i - 1)) { + // Send bit 1 + instance->encoder.upload[index++] = + level_duration_make(true, (uint32_t)subghz_protocol_gangqi_const.te_long); + if(i == 1) { + //Send gap if bit was last + instance->encoder.upload[index++] = level_duration_make( + false, + (uint32_t)subghz_protocol_gangqi_const.te_short * 4 + + subghz_protocol_gangqi_const.te_delta); + } else { + instance->encoder.upload[index++] = + level_duration_make(false, (uint32_t)subghz_protocol_gangqi_const.te_short); + } + } else { + // Send bit 0 + instance->encoder.upload[index++] = + level_duration_make(true, (uint32_t)subghz_protocol_gangqi_const.te_short); + if(i == 1) { + //Send gap if bit was last + instance->encoder.upload[index++] = level_duration_make( + false, + (uint32_t)subghz_protocol_gangqi_const.te_short * 4 + + subghz_protocol_gangqi_const.te_delta); + } else { + instance->encoder.upload[index++] = + level_duration_make(false, (uint32_t)subghz_protocol_gangqi_const.te_long); + } + } + } + + instance->encoder.size_upload = index; + return; +} + +/** + * Analysis of received data and parsing serial number + * @param instance Pointer to a SubGhzBlockGeneric* instance + */ +static void subghz_protocol_gangqi_remote_controller(SubGhzBlockGeneric* instance) { + instance->serial = (instance->data & 0xFFFFF0000) >> 16; +} + +SubGhzProtocolStatus + subghz_protocol_encoder_gangqi_deserialize(void* context, FlipperFormat* flipper_format) { + furi_assert(context); + SubGhzProtocolEncoderGangQi* instance = context; + SubGhzProtocolStatus ret = SubGhzProtocolStatusError; + do { + ret = subghz_block_generic_deserialize_check_count_bit( + &instance->generic, + flipper_format, + subghz_protocol_gangqi_const.min_count_bit_for_found); + if(ret != SubGhzProtocolStatusOk) { + break; + } + //optional parameter parameter + flipper_format_read_uint32( + flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); + + subghz_protocol_gangqi_remote_controller(&instance->generic); + subghz_protocol_encoder_gangqi_get_upload(instance); + instance->encoder.is_running = true; + } while(false); + + return ret; +} + +void subghz_protocol_encoder_gangqi_stop(void* context) { + SubGhzProtocolEncoderGangQi* instance = context; + instance->encoder.is_running = false; +} + +LevelDuration subghz_protocol_encoder_gangqi_yield(void* context) { + SubGhzProtocolEncoderGangQi* instance = context; + + if(instance->encoder.repeat == 0 || !instance->encoder.is_running) { + instance->encoder.is_running = false; + return level_duration_reset(); + } + + LevelDuration ret = instance->encoder.upload[instance->encoder.front]; + + if(++instance->encoder.front == instance->encoder.size_upload) { + instance->encoder.repeat--; + instance->encoder.front = 0; + } + + return ret; +} + +void* subghz_protocol_decoder_gangqi_alloc(SubGhzEnvironment* environment) { + UNUSED(environment); + SubGhzProtocolDecoderGangQi* instance = malloc(sizeof(SubGhzProtocolDecoderGangQi)); + instance->base.protocol = &subghz_protocol_gangqi; + instance->generic.protocol_name = instance->base.protocol->name; + return instance; +} + +void subghz_protocol_decoder_gangqi_free(void* context) { + furi_assert(context); + SubGhzProtocolDecoderGangQi* instance = context; + free(instance); +} + +void subghz_protocol_decoder_gangqi_reset(void* context) { + furi_assert(context); + SubGhzProtocolDecoderGangQi* instance = context; + instance->decoder.parser_step = GangQiDecoderStepReset; +} + +void subghz_protocol_decoder_gangqi_feed(void* context, bool level, volatile uint32_t duration) { + furi_assert(context); + SubGhzProtocolDecoderGangQi* instance = context; + + // Key example + // 00 10011010111101001101110101011101 00 + + switch(instance->decoder.parser_step) { + case GangQiDecoderStepReset: + if((!level) && (DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_long * 2) < + subghz_protocol_gangqi_const.te_delta * 3)) { + //Found GAP + instance->decoder.decode_data = 0; + instance->decoder.decode_count_bit = 0; + instance->decoder.parser_step = GangQiDecoderStepSaveDuration; + } + break; + case GangQiDecoderStepSaveDuration: + if(level) { + instance->decoder.te_last = duration; + instance->decoder.parser_step = GangQiDecoderStepCheckDuration; + } else { + instance->decoder.parser_step = GangQiDecoderStepReset; + } + break; + case GangQiDecoderStepCheckDuration: + if(!level) { + // Bit 0 is short and long timing + if((DURATION_DIFF(instance->decoder.te_last, subghz_protocol_gangqi_const.te_short) < + subghz_protocol_gangqi_const.te_delta) && + (DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_long) < + subghz_protocol_gangqi_const.te_delta)) { + subghz_protocol_blocks_add_bit(&instance->decoder, 0); + instance->decoder.parser_step = GangQiDecoderStepSaveDuration; + // Bit 1 is long and short timing + } else if( + (DURATION_DIFF(instance->decoder.te_last, subghz_protocol_gangqi_const.te_long) < + subghz_protocol_gangqi_const.te_delta) && + (DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_short) < + subghz_protocol_gangqi_const.te_delta)) { + subghz_protocol_blocks_add_bit(&instance->decoder, 1); + instance->decoder.parser_step = GangQiDecoderStepSaveDuration; + } else if( + // End of the key + DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_short * 4) < + subghz_protocol_gangqi_const.te_delta) { + //Found next GAP and add bit 0 or 1 (only bit 0 was found on the remotes) + if((DURATION_DIFF( + instance->decoder.te_last, subghz_protocol_gangqi_const.te_short) < + subghz_protocol_gangqi_const.te_delta) && + (DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_short * 4) < + subghz_protocol_gangqi_const.te_delta)) { + subghz_protocol_blocks_add_bit(&instance->decoder, 0); + } + if((DURATION_DIFF(instance->decoder.te_last, subghz_protocol_gangqi_const.te_long) < + subghz_protocol_gangqi_const.te_delta) && + (DURATION_DIFF(duration, subghz_protocol_gangqi_const.te_short * 4) < + subghz_protocol_gangqi_const.te_delta)) { + subghz_protocol_blocks_add_bit(&instance->decoder, 1); + } + // If got 34 bits key reading is finished + if(instance->decoder.decode_count_bit == + subghz_protocol_gangqi_const.min_count_bit_for_found) { + instance->generic.data = instance->decoder.decode_data; + instance->generic.data_count_bit = instance->decoder.decode_count_bit; + if(instance->base.callback) + instance->base.callback(&instance->base, instance->base.context); + } + instance->decoder.decode_data = 0; + instance->decoder.decode_count_bit = 0; + instance->decoder.parser_step = GangQiDecoderStepReset; + } else { + instance->decoder.parser_step = GangQiDecoderStepReset; + } + } else { + instance->decoder.parser_step = GangQiDecoderStepReset; + } + break; + } +} + +uint32_t subghz_protocol_decoder_gangqi_get_hash_data(void* context) { + furi_assert(context); + SubGhzProtocolDecoderGangQi* instance = context; + return subghz_protocol_blocks_get_hash_data_long( + &instance->decoder, (instance->decoder.decode_count_bit / 8) + 1); +} + +SubGhzProtocolStatus subghz_protocol_decoder_gangqi_serialize( + void* context, + FlipperFormat* flipper_format, + SubGhzRadioPreset* preset) { + furi_assert(context); + SubGhzProtocolDecoderGangQi* instance = context; + return subghz_block_generic_serialize(&instance->generic, flipper_format, preset); +} + +SubGhzProtocolStatus + subghz_protocol_decoder_gangqi_deserialize(void* context, FlipperFormat* flipper_format) { + furi_assert(context); + SubGhzProtocolDecoderGangQi* instance = context; + return subghz_block_generic_deserialize_check_count_bit( + &instance->generic, flipper_format, subghz_protocol_gangqi_const.min_count_bit_for_found); +} + +void subghz_protocol_decoder_gangqi_get_string(void* context, FuriString* output) { + furi_assert(context); + SubGhzProtocolDecoderGangQi* instance = context; + + // Parse serial + subghz_protocol_gangqi_remote_controller(&instance->generic); + + furi_string_cat_printf( + output, + "%s %db\r\n" + "Key: 0x%X%08lX\r\n" + "Serial: 0x%05lX\r\n" + "Button code: 0x%04lX\r\n", + instance->generic.protocol_name, + instance->generic.data_count_bit, + (uint8_t)(instance->generic.data >> 32), + (uint32_t)(instance->generic.data & 0xFFFFFFFF), + instance->generic.serial, + (uint32_t)(instance->generic.data & 0xFFFF)); +} diff --git a/lib/subghz/protocols/gangqi.h b/lib/subghz/protocols/gangqi.h new file mode 100644 index 000000000..3281117b5 --- /dev/null +++ b/lib/subghz/protocols/gangqi.h @@ -0,0 +1,109 @@ +#pragma once + +#include "base.h" + +#define SUBGHZ_PROTOCOL_GANGQI_NAME "GangQi" + +typedef struct SubGhzProtocolDecoderGangQi SubGhzProtocolDecoderGangQi; +typedef struct SubGhzProtocolEncoderGangQi SubGhzProtocolEncoderGangQi; + +extern const SubGhzProtocolDecoder subghz_protocol_gangqi_decoder; +extern const SubGhzProtocolEncoder subghz_protocol_gangqi_encoder; +extern const SubGhzProtocol subghz_protocol_gangqi; + +/** + * Allocate SubGhzProtocolEncoderGangQi. + * @param environment Pointer to a SubGhzEnvironment instance + * @return SubGhzProtocolEncoderGangQi* pointer to a SubGhzProtocolEncoderGangQi instance + */ +void* subghz_protocol_encoder_gangqi_alloc(SubGhzEnvironment* environment); + +/** + * Free SubGhzProtocolEncoderGangQi. + * @param context Pointer to a SubGhzProtocolEncoderGangQi instance + */ +void subghz_protocol_encoder_gangqi_free(void* context); + +/** + * Deserialize and generating an upload to send. + * @param context Pointer to a SubGhzProtocolEncoderGangQi instance + * @param flipper_format Pointer to a FlipperFormat instance + * @return status + */ +SubGhzProtocolStatus + subghz_protocol_encoder_gangqi_deserialize(void* context, FlipperFormat* flipper_format); + +/** + * Forced transmission stop. + * @param context Pointer to a SubGhzProtocolEncoderGangQi instance + */ +void subghz_protocol_encoder_gangqi_stop(void* context); + +/** + * Getting the level and duration of the upload to be loaded into DMA. + * @param context Pointer to a SubGhzProtocolEncoderGangQi instance + * @return LevelDuration + */ +LevelDuration subghz_protocol_encoder_gangqi_yield(void* context); + +/** + * Allocate SubGhzProtocolDecoderGangQi. + * @param environment Pointer to a SubGhzEnvironment instance + * @return SubGhzProtocolDecoderGangQi* pointer to a SubGhzProtocolDecoderGangQi instance + */ +void* subghz_protocol_decoder_gangqi_alloc(SubGhzEnvironment* environment); + +/** + * Free SubGhzProtocolDecoderGangQi. + * @param context Pointer to a SubGhzProtocolDecoderGangQi instance + */ +void subghz_protocol_decoder_gangqi_free(void* context); + +/** + * Reset decoder SubGhzProtocolDecoderGangQi. + * @param context Pointer to a SubGhzProtocolDecoderGangQi instance + */ +void subghz_protocol_decoder_gangqi_reset(void* context); + +/** + * Parse a raw sequence of levels and durations received from the air. + * @param context Pointer to a SubGhzProtocolDecoderGangQi instance + * @param level Signal level true-high false-low + * @param duration Duration of this level in, us + */ +void subghz_protocol_decoder_gangqi_feed(void* context, bool level, uint32_t duration); + +/** + * Getting the hash sum of the last randomly received parcel. + * @param context Pointer to a SubGhzProtocolDecoderGangQi instance + * @return hash Hash sum + */ +uint32_t subghz_protocol_decoder_gangqi_get_hash_data(void* context); + +/** + * Serialize data SubGhzProtocolDecoderGangQi. + * @param context Pointer to a SubGhzProtocolDecoderGangQi instance + * @param flipper_format Pointer to a FlipperFormat instance + * @param preset The modulation on which the signal was received, SubGhzRadioPreset + * @return status + */ +SubGhzProtocolStatus subghz_protocol_decoder_gangqi_serialize( + void* context, + FlipperFormat* flipper_format, + SubGhzRadioPreset* preset); + +/** + * Deserialize data SubGhzProtocolDecoderGangQi. + * @param context Pointer to a SubGhzProtocolDecoderGangQi instance + * @param flipper_format Pointer to a FlipperFormat instance + * @return status + */ +SubGhzProtocolStatus + subghz_protocol_decoder_gangqi_deserialize(void* context, FlipperFormat* flipper_format); + +/** + * Getting a textual representation of the received data. + * @param context Pointer to a SubGhzProtocolDecoderGangQi instance + * @param output Resulting text + */ +void subghz_protocol_decoder_gangqi_get_string(void* context, FuriString* output); diff --git a/lib/subghz/protocols/marantec24.c b/lib/subghz/protocols/marantec24.c new file mode 100644 index 000000000..92ac500bf --- /dev/null +++ b/lib/subghz/protocols/marantec24.c @@ -0,0 +1,344 @@ +#include "marantec24.h" +#include "../blocks/const.h" +#include "../blocks/decoder.h" +#include "../blocks/encoder.h" +#include "../blocks/generic.h" +#include "../blocks/math.h" + +#define TAG "SubGhzProtocolMarantec24" + +static const SubGhzBlockConst subghz_protocol_marantec24_const = { + .te_short = 800, + .te_long = 1600, + .te_delta = 200, + .min_count_bit_for_found = 24, +}; + +struct SubGhzProtocolDecoderMarantec24 { + SubGhzProtocolDecoderBase base; + + SubGhzBlockDecoder decoder; + SubGhzBlockGeneric generic; +}; + +struct SubGhzProtocolEncoderMarantec24 { + SubGhzProtocolEncoderBase base; + + SubGhzProtocolBlockEncoder encoder; + SubGhzBlockGeneric generic; +}; + +typedef enum { + Marantec24DecoderStepReset = 0, + Marantec24DecoderStepSaveDuration, + Marantec24DecoderStepCheckDuration, +} Marantec24DecoderStep; + +const SubGhzProtocolDecoder subghz_protocol_marantec24_decoder = { + .alloc = subghz_protocol_decoder_marantec24_alloc, + .free = subghz_protocol_decoder_marantec24_free, + + .feed = subghz_protocol_decoder_marantec24_feed, + .reset = subghz_protocol_decoder_marantec24_reset, + + .get_hash_data = NULL, + .get_hash_data_long = subghz_protocol_decoder_marantec24_get_hash_data, + .serialize = subghz_protocol_decoder_marantec24_serialize, + .deserialize = subghz_protocol_decoder_marantec24_deserialize, + .get_string = subghz_protocol_decoder_marantec24_get_string, + .get_string_brief = NULL, +}; + +const SubGhzProtocolEncoder subghz_protocol_marantec24_encoder = { + .alloc = subghz_protocol_encoder_marantec24_alloc, + .free = subghz_protocol_encoder_marantec24_free, + + .deserialize = subghz_protocol_encoder_marantec24_deserialize, + .stop = subghz_protocol_encoder_marantec24_stop, + .yield = subghz_protocol_encoder_marantec24_yield, +}; + +const SubGhzProtocol subghz_protocol_marantec24 = { + .name = SUBGHZ_PROTOCOL_MARA24_NAME, + .type = SubGhzProtocolTypeStatic, + .flag = SubGhzProtocolFlag_868 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | + SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send, + + .decoder = &subghz_protocol_marantec24_decoder, + .encoder = &subghz_protocol_marantec24_encoder, +}; + +void* subghz_protocol_encoder_marantec24_alloc(SubGhzEnvironment* environment) { + UNUSED(environment); + SubGhzProtocolEncoderMarantec24* instance = malloc(sizeof(SubGhzProtocolEncoderMarantec24)); + + instance->base.protocol = &subghz_protocol_marantec24; + instance->generic.protocol_name = instance->base.protocol->name; + + instance->encoder.repeat = 10; + instance->encoder.size_upload = 256; + instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration)); + instance->encoder.is_running = false; + return instance; +} + +void subghz_protocol_encoder_marantec24_free(void* context) { + furi_assert(context); + SubGhzProtocolEncoderMarantec24* instance = context; + free(instance->encoder.upload); + free(instance); +} + +/** + * Generating an upload from data. + * @param instance Pointer to a SubGhzProtocolEncoderMarantec24 instance + */ +static void + subghz_protocol_encoder_marantec24_get_upload(SubGhzProtocolEncoderMarantec24* instance) { + furi_assert(instance); + size_t index = 0; + + // Send key and GAP + for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) { + if(bit_read(instance->generic.data, i - 1)) { + // Send bit 1 + instance->encoder.upload[index++] = + level_duration_make(true, (uint32_t)subghz_protocol_marantec24_const.te_short); + if(i == 1) { + //Send gap if bit was last + instance->encoder.upload[index++] = level_duration_make( + false, + (uint32_t)subghz_protocol_marantec24_const.te_long * 9 + + subghz_protocol_marantec24_const.te_short); + } else { + instance->encoder.upload[index++] = level_duration_make( + false, (uint32_t)subghz_protocol_marantec24_const.te_long * 2); + } + } else { + // Send bit 0 + instance->encoder.upload[index++] = + level_duration_make(true, (uint32_t)subghz_protocol_marantec24_const.te_long); + if(i == 1) { + //Send gap if bit was last + instance->encoder.upload[index++] = level_duration_make( + false, + (uint32_t)subghz_protocol_marantec24_const.te_long * 9 + + subghz_protocol_marantec24_const.te_short); + } else { + instance->encoder.upload[index++] = level_duration_make( + false, (uint32_t)subghz_protocol_marantec24_const.te_short * 3); + } + } + } + + instance->encoder.size_upload = index; + return; +} + +/** + * Analysis of received data + * @param instance Pointer to a SubGhzBlockGeneric* instance + */ +static void subghz_protocol_marantec24_check_remote_controller(SubGhzBlockGeneric* instance) { + instance->serial = instance->data >> 4; + instance->btn = instance->data & 0xF; +} + +SubGhzProtocolStatus + subghz_protocol_encoder_marantec24_deserialize(void* context, FlipperFormat* flipper_format) { + furi_assert(context); + SubGhzProtocolEncoderMarantec24* instance = context; + SubGhzProtocolStatus ret = SubGhzProtocolStatusError; + do { + ret = subghz_block_generic_deserialize_check_count_bit( + &instance->generic, + flipper_format, + subghz_protocol_marantec24_const.min_count_bit_for_found); + if(ret != SubGhzProtocolStatusOk) { + break; + } + //optional parameter parameter + flipper_format_read_uint32( + flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); + + subghz_protocol_marantec24_check_remote_controller(&instance->generic); + subghz_protocol_encoder_marantec24_get_upload(instance); + instance->encoder.is_running = true; + } while(false); + + return ret; +} + +void subghz_protocol_encoder_marantec24_stop(void* context) { + SubGhzProtocolEncoderMarantec24* instance = context; + instance->encoder.is_running = false; +} + +LevelDuration subghz_protocol_encoder_marantec24_yield(void* context) { + SubGhzProtocolEncoderMarantec24* instance = context; + + if(instance->encoder.repeat == 0 || !instance->encoder.is_running) { + instance->encoder.is_running = false; + return level_duration_reset(); + } + + LevelDuration ret = instance->encoder.upload[instance->encoder.front]; + + if(++instance->encoder.front == instance->encoder.size_upload) { + instance->encoder.repeat--; + instance->encoder.front = 0; + } + + return ret; +} + +void* subghz_protocol_decoder_marantec24_alloc(SubGhzEnvironment* environment) { + UNUSED(environment); + SubGhzProtocolDecoderMarantec24* instance = malloc(sizeof(SubGhzProtocolDecoderMarantec24)); + instance->base.protocol = &subghz_protocol_marantec24; + instance->generic.protocol_name = instance->base.protocol->name; + return instance; +} + +void subghz_protocol_decoder_marantec24_free(void* context) { + furi_assert(context); + SubGhzProtocolDecoderMarantec24* instance = context; + free(instance); +} + +void subghz_protocol_decoder_marantec24_reset(void* context) { + furi_assert(context); + SubGhzProtocolDecoderMarantec24* instance = context; + instance->decoder.parser_step = Marantec24DecoderStepReset; +} + +void subghz_protocol_decoder_marantec24_feed(void* context, bool level, volatile uint32_t duration) { + furi_assert(context); + SubGhzProtocolDecoderMarantec24* instance = context; + + // Key samples + // 101011000000010111001000 = AC05C8 + // 101011000000010111000100 = AC05C4 + // 101011000000010111001100 = AC05CC + // 101011000000010111000000 = AC05C0 + + switch(instance->decoder.parser_step) { + case Marantec24DecoderStepReset: + if((!level) && (DURATION_DIFF(duration, subghz_protocol_marantec24_const.te_long * 9) < + subghz_protocol_marantec24_const.te_delta * 4)) { + //Found GAP + instance->decoder.decode_data = 0; + instance->decoder.decode_count_bit = 0; + instance->decoder.parser_step = Marantec24DecoderStepSaveDuration; + } + break; + case Marantec24DecoderStepSaveDuration: + if(level) { + instance->decoder.te_last = duration; + instance->decoder.parser_step = Marantec24DecoderStepCheckDuration; + } else { + instance->decoder.parser_step = Marantec24DecoderStepReset; + } + break; + case Marantec24DecoderStepCheckDuration: + if(!level) { + // Bit 0 is long and short x2 timing = 1600us HIGH (te_last) and 2400us LOW + if((DURATION_DIFF(instance->decoder.te_last, subghz_protocol_marantec24_const.te_long) < + subghz_protocol_marantec24_const.te_delta) && + (DURATION_DIFF(duration, subghz_protocol_marantec24_const.te_short * 3) < + subghz_protocol_marantec24_const.te_delta)) { + subghz_protocol_blocks_add_bit(&instance->decoder, 0); + instance->decoder.parser_step = Marantec24DecoderStepSaveDuration; + // Bit 1 is short and long x2 timing = 800us HIGH (te_last) and 3200us LOW + } else if( + (DURATION_DIFF( + instance->decoder.te_last, subghz_protocol_marantec24_const.te_short) < + subghz_protocol_marantec24_const.te_delta) && + (DURATION_DIFF(duration, subghz_protocol_marantec24_const.te_long * 2) < + subghz_protocol_marantec24_const.te_delta)) { + subghz_protocol_blocks_add_bit(&instance->decoder, 1); + instance->decoder.parser_step = Marantec24DecoderStepSaveDuration; + } else if( + // End of the key + DURATION_DIFF(duration, subghz_protocol_marantec24_const.te_long * 9) < + subghz_protocol_marantec24_const.te_delta * 4) { + //Found next GAP and add bit 0 or 1 (only bit 0 was found on the remotes) + if((DURATION_DIFF( + instance->decoder.te_last, subghz_protocol_marantec24_const.te_long) < + subghz_protocol_marantec24_const.te_delta) && + (DURATION_DIFF(duration, subghz_protocol_marantec24_const.te_long * 9) < + subghz_protocol_marantec24_const.te_delta * 4)) { + subghz_protocol_blocks_add_bit(&instance->decoder, 0); + } + if((DURATION_DIFF( + instance->decoder.te_last, subghz_protocol_marantec24_const.te_short) < + subghz_protocol_marantec24_const.te_delta) && + (DURATION_DIFF(duration, subghz_protocol_marantec24_const.te_long * 9) < + subghz_protocol_marantec24_const.te_delta * 4)) { + subghz_protocol_blocks_add_bit(&instance->decoder, 1); + } + // If got 24 bits key reading is finished + if(instance->decoder.decode_count_bit == + subghz_protocol_marantec24_const.min_count_bit_for_found) { + instance->generic.data = instance->decoder.decode_data; + instance->generic.data_count_bit = instance->decoder.decode_count_bit; + if(instance->base.callback) + instance->base.callback(&instance->base, instance->base.context); + } + instance->decoder.decode_data = 0; + instance->decoder.decode_count_bit = 0; + instance->decoder.parser_step = Marantec24DecoderStepReset; + } else { + instance->decoder.parser_step = Marantec24DecoderStepReset; + } + } else { + instance->decoder.parser_step = Marantec24DecoderStepReset; + } + break; + } +} + +uint32_t subghz_protocol_decoder_marantec24_get_hash_data(void* context) { + furi_assert(context); + SubGhzProtocolDecoderMarantec24* instance = context; + return subghz_protocol_blocks_get_hash_data_long( + &instance->decoder, (instance->decoder.decode_count_bit / 8) + 1); +} + +SubGhzProtocolStatus subghz_protocol_decoder_marantec24_serialize( + void* context, + FlipperFormat* flipper_format, + SubGhzRadioPreset* preset) { + furi_assert(context); + SubGhzProtocolDecoderMarantec24* instance = context; + return subghz_block_generic_serialize(&instance->generic, flipper_format, preset); +} + +SubGhzProtocolStatus + subghz_protocol_decoder_marantec24_deserialize(void* context, FlipperFormat* flipper_format) { + furi_assert(context); + SubGhzProtocolDecoderMarantec24* instance = context; + return subghz_block_generic_deserialize_check_count_bit( + &instance->generic, + flipper_format, + subghz_protocol_marantec24_const.min_count_bit_for_found); +} + +void subghz_protocol_decoder_marantec24_get_string(void* context, FuriString* output) { + furi_assert(context); + SubGhzProtocolDecoderMarantec24* instance = context; + + subghz_protocol_marantec24_check_remote_controller(&instance->generic); + + furi_string_cat_printf( + output, + "%s %db\r\n" + "Key: 0x%06lX\r\n" + "Serial: 0x%05lX\r\n" + "Btn: %01X", + instance->generic.protocol_name, + instance->generic.data_count_bit, + (uint32_t)(instance->generic.data & 0xFFFFFF), + instance->generic.serial, + instance->generic.btn); +} diff --git a/lib/subghz/protocols/marantec24.h b/lib/subghz/protocols/marantec24.h new file mode 100644 index 000000000..41f635a50 --- /dev/null +++ b/lib/subghz/protocols/marantec24.h @@ -0,0 +1,109 @@ +#pragma once + +#include "base.h" + +#define SUBGHZ_PROTOCOL_MARA24_NAME "Marantec24" + +typedef struct SubGhzProtocolDecoderMarantec24 SubGhzProtocolDecoderMarantec24; +typedef struct SubGhzProtocolEncoderMarantec24 SubGhzProtocolEncoderMarantec24; + +extern const SubGhzProtocolDecoder subghz_protocol_marantec24_decoder; +extern const SubGhzProtocolEncoder subghz_protocol_marantec24_encoder; +extern const SubGhzProtocol subghz_protocol_marantec24; + +/** + * Allocate SubGhzProtocolEncoderMarantec24. + * @param environment Pointer to a SubGhzEnvironment instance + * @return SubGhzProtocolEncoderMarantec24* pointer to a SubGhzProtocolEncoderMarantec24 instance + */ +void* subghz_protocol_encoder_marantec24_alloc(SubGhzEnvironment* environment); + +/** + * Free SubGhzProtocolEncoderMarantec24. + * @param context Pointer to a SubGhzProtocolEncoderMarantec24 instance + */ +void subghz_protocol_encoder_marantec24_free(void* context); + +/** + * Deserialize and generating an upload to send. + * @param context Pointer to a SubGhzProtocolEncoderMarantec24 instance + * @param flipper_format Pointer to a FlipperFormat instance + * @return status + */ +SubGhzProtocolStatus + subghz_protocol_encoder_marantec24_deserialize(void* context, FlipperFormat* flipper_format); + +/** + * Forced transmission stop. + * @param context Pointer to a SubGhzProtocolEncoderMarantec24 instance + */ +void subghz_protocol_encoder_marantec24_stop(void* context); + +/** + * Getting the level and duration of the upload to be loaded into DMA. + * @param context Pointer to a SubGhzProtocolEncoderMarantec24 instance + * @return LevelDuration + */ +LevelDuration subghz_protocol_encoder_marantec24_yield(void* context); + +/** + * Allocate SubGhzProtocolDecoderMarantec24. + * @param environment Pointer to a SubGhzEnvironment instance + * @return SubGhzProtocolDecoderMarantec24* pointer to a SubGhzProtocolDecoderMarantec24 instance + */ +void* subghz_protocol_decoder_marantec24_alloc(SubGhzEnvironment* environment); + +/** + * Free SubGhzProtocolDecoderMarantec24. + * @param context Pointer to a SubGhzProtocolDecoderMarantec24 instance + */ +void subghz_protocol_decoder_marantec24_free(void* context); + +/** + * Reset decoder SubGhzProtocolDecoderMarantec24. + * @param context Pointer to a SubGhzProtocolDecoderMarantec24 instance + */ +void subghz_protocol_decoder_marantec24_reset(void* context); + +/** + * Parse a raw sequence of levels and durations received from the air. + * @param context Pointer to a SubGhzProtocolDecoderMarantec24 instance + * @param level Signal level true-high false-low + * @param duration Duration of this level in, us + */ +void subghz_protocol_decoder_marantec24_feed(void* context, bool level, uint32_t duration); + +/** + * Getting the hash sum of the last randomly received parcel. + * @param context Pointer to a SubGhzProtocolDecoderMarantec24 instance + * @return hash Hash sum + */ +uint32_t subghz_protocol_decoder_marantec24_get_hash_data(void* context); + +/** + * Serialize data SubGhzProtocolDecoderMarantec24. + * @param context Pointer to a SubGhzProtocolDecoderMarantec24 instance + * @param flipper_format Pointer to a FlipperFormat instance + * @param preset The modulation on which the signal was received, SubGhzRadioPreset + * @return status + */ +SubGhzProtocolStatus subghz_protocol_decoder_marantec24_serialize( + void* context, + FlipperFormat* flipper_format, + SubGhzRadioPreset* preset); + +/** + * Deserialize data SubGhzProtocolDecoderMarantec24. + * @param context Pointer to a SubGhzProtocolDecoderMarantec24 instance + * @param flipper_format Pointer to a FlipperFormat instance + * @return status + */ +SubGhzProtocolStatus + subghz_protocol_decoder_marantec24_deserialize(void* context, FlipperFormat* flipper_format); + +/** + * Getting a textual representation of the received data. + * @param context Pointer to a SubGhzProtocolDecoderMarantec24 instance + * @param output Resulting text + */ +void subghz_protocol_decoder_marantec24_get_string(void* context, FuriString* output); diff --git a/lib/subghz/protocols/protocol_items.c b/lib/subghz/protocols/protocol_items.c index 13665cf0b..012f99003 100644 --- a/lib/subghz/protocols/protocol_items.c +++ b/lib/subghz/protocols/protocol_items.c @@ -74,6 +74,8 @@ const SubGhzProtocol* subghz_protocol_registry_items[] = { &subghz_protocol_hormann_bisecur, &subghz_protocol_legrand, &subghz_protocol_dickert_mahs, + &subghz_protocol_gangqi, + &subghz_protocol_marantec24, }; const SubGhzProtocolRegistry subghz_protocol_registry = { diff --git a/lib/subghz/protocols/protocol_items.h b/lib/subghz/protocols/protocol_items.h index 133d89135..2dc1a00a7 100644 --- a/lib/subghz/protocols/protocol_items.h +++ b/lib/subghz/protocols/protocol_items.h @@ -75,3 +75,5 @@ #include "hormann_bisecur.h" #include "legrand.h" #include "dickert_mahs.h" +#include "gangqi.h" +#include "marantec24.h"