-
Notifications
You must be signed in to change notification settings - Fork 3
/
halow_scan.grc
1261 lines (1256 loc) · 35.6 KB
/
halow_scan.grc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
options:
parameters:
author: ''
catch_exceptions: 'True'
category: Custom
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: halow_rx
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: prompt
sizing_mode: fixed
thread_safe_setters: ''
title: ''
window_size: (1000,1000)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 12.0]
rotation: 0
state: enabled
blocks:
- name: activity_threshold
id: variable
parameters:
comment: power level greater than this value satisfies second condition
value: '-80'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1080, 636.0]
rotation: 0
state: enabled
- name: correlation_threshold
id: variable
parameters:
comment: less that this value satisfies first condition
value: '0.4'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [808, 636.0]
rotation: 0
state: enabled
- name: driver
id: variable
parameters:
comment: ''
value: '"airspy"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [200, 204.0]
rotation: 0
state: enabled
- name: filter_cutoff
id: variable
parameters:
comment: ''
value: (samp_rate / 2) - (samp_rate /10)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [360, 436.0]
rotation: 0
state: enabled
- name: filter_transition
id: variable
parameters:
comment: ''
value: 10e3
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [456, 436.0]
rotation: 0
state: enabled
- name: gain
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: ''
label: ''
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '1'
stop: '21'
value: '3'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [32, 92.0]
rotation: 0
state: enabled
- name: guard_interval_size
id: variable
parameters:
comment: ''
value: '8'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1896, 60.0]
rotation: 0
state: enabled
- name: halow_channel_json_filename
id: variable
parameters:
comment: location of JSON file for channels to scan
value: '''/home/dragon/Documents/gr-halow/flowgraphs/1mhz_halow_channels.json'''
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [944, 484.0]
rotation: 0
state: enabled
- name: input_samp_rate
id: variable
parameters:
comment: ''
value: 10e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [80, 268.0]
rotation: 0
state: enabled
- name: loiter_time
id: variable
parameters:
comment: in seconds, how long to wait on each channel
value: '0.5'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [968, 356.0]
rotation: 0
state: enabled
- name: lpf_taps
id: variable
parameters:
comment: ''
value: firdes.low_pass(1, input_samp_rate, filter_cutoff, filter_transition)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [360, 500.0]
rotation: 0
state: enabled
- name: samp_rate
id: variable
parameters:
comment: ''
value: 1e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [200, 268.0]
rotation: 0
state: enabled
- name: sdr_center_freq
id: variable
parameters:
comment: ''
value: '918000000'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [80, 204.0]
rotation: 0
state: enabled
- name: start_time
id: variable
parameters:
comment: in seconds, 1mhz_mcs0 capture
value: '7.607'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [152, 764.0]
rotation: 0
state: disabled
- name: stop_time
id: variable
parameters:
comment: in seconds, 1mhz_mcs0 capture
value: '7.674'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [248, 764.0]
rotation: 0
state: disabled
- name: training_field_size
id: variable
parameters:
comment: in samples, length of STF + LTF
value: '320'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1880, 804.0]
rotation: 0
state: enabled
- name: window_size
id: variable
parameters:
comment: ''
value: '24'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1896, 124.0]
rotation: 0
state: enabled
- name: blocks_complex_to_mag_0
id: blocks_complex_to_mag
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1904, 328.0]
rotation: 0
state: enabled
- name: blocks_complex_to_mag_squared_0
id: blocks_complex_to_mag_squared
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1592, 160.0]
rotation: 0
state: enabled
- name: blocks_conjugate_cc_0
id: blocks_conjugate_cc
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1496.0, 416]
rotation: 90
state: enabled
- name: blocks_delay_0_0
id: blocks_delay
parameters:
affinity: ''
alias: ''
comment: ''
delay: guard_interval_size
maxoutbuf: '0'
minoutbuf: '0'
num_ports: '1'
showports: 'False'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1444.0, 512]
rotation: 270
state: enabled
- name: blocks_delay_0_0_0
id: blocks_delay
parameters:
affinity: ''
alias: ''
comment: ''
delay: training_field_size
maxoutbuf: '0'
minoutbuf: '0'
num_ports: '1'
showports: 'False'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1712, 836.0]
rotation: 180
state: enabled
- name: blocks_divide_xx_0
id: blocks_divide_xx
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
num_inputs: '2'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [2072.0, 424]
rotation: 270
state: enabled
- name: blocks_file_source_0
id: blocks_file_source
parameters:
affinity: ''
alias: ''
begin_tag: pmt.PMT_NIL
comment: ''
file: /home/dragon/Documents/gr-halow/captures/1mhz-mcs0.sigmf-data
length: int((stop_time - start_time) * input_samp_rate)
maxoutbuf: '0'
minoutbuf: '0'
offset: int(start_time * input_samp_rate)
repeat: 'False'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [168, 652.0]
rotation: 180
state: disabled
- name: blocks_moving_average_xx_0
id: blocks_moving_average_xx
parameters:
affinity: ''
alias: ''
comment: ''
length: window_size + guard_interval_size
max_iter: '4000'
maxoutbuf: '0'
minoutbuf: '0'
scale: '1'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1896, 188.0]
rotation: 0
state: enabled
- name: blocks_moving_average_xx_1
id: blocks_moving_average_xx
parameters:
affinity: ''
alias: ''
comment: ''
length: window_size
max_iter: '4000'
maxoutbuf: '0'
minoutbuf: '0'
scale: '1'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1696, 300.0]
rotation: 0
state: enabled
- name: blocks_multiply_xx_0
id: blocks_multiply_xx
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
num_inputs: '2'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1568, 312.0]
rotation: 0
state: enabled
- name: blocks_tag_gate_0
id: blocks_tag_gate
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
propagate_tags: 'False'
single_key: '""'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [600, 244.0]
rotation: 0
state: enabled
- name: blocks_throttle2_0
id: blocks_throttle2
parameters:
affinity: ''
alias: ''
comment: ''
ignoretag: 'True'
limit: auto
maximum: '0.1'
maxoutbuf: '0'
minoutbuf: '0'
samples_per_second: input_samp_rate
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [176, 588.0]
rotation: 0
state: disabled
- name: epy_block_0
id: epy_block
parameters:
_source_code: "import numpy as np\nfrom gnuradio import gr\nimport pmt\nimport\
\ json\nimport os\n\nclass blk(gr.sync_block): \n\n\n def __init__(self,\
\ upper_detection_threshold=0.2, correlation_threshold=0.2, halow_channel_json_filename=\"\
\"): \n \"\"\"arguments to this function show up as parameters in GRC\"\
\"\"\n gr.sync_block.__init__(\n self,\n name='HaLow\
\ Usage Detector', \n in_sig=[np.complex64],\n out_sig=[np.complex64]\n\
\ )\n self.upper_detection_threshold = upper_detection_threshold\n\
\ self.correlation_threshold = correlation_threshold\n self.halow_channel_json_filename\
\ = halow_channel_json_filename\n self.all_halow_channels = {}\n \
\ if(os.path.isfile(halow_channel_json_filename)):\n json_file\
\ = open(self.halow_channel_json_filename)\n self.all_halow_channels\
\ = json.load(json_file)\n json_file.close()\n self.port_freq_in\
\ = \"freq_in\"\n self.message_port_register_in(pmt.intern(self.port_freq_in))\n\
\ self.set_msg_handler(pmt.intern(self.port_freq_in), self.handle_freq_in)\n\
\ self.port_tune_in = \"tune_in\"\n self.message_port_register_in(pmt.intern(self.port_tune_in))\n\
\ self.set_msg_handler(pmt.intern(self.port_tune_in), self.handle_tune_in)\n\
\ self.tune_frequency = 0\n self.offset_frequency = 0\n\n def\
\ handle_tune_in(self, msg):\n key = pmt.intern(\"freq\")\n value\
\ = pmt.dict_ref(msg, key, pmt.PMT_NIL) \n if(value is not pmt.PMT_NIL):\n\
\ self.tune_frequency = pmt.to_double(value)\n \n def handle_freq_in(self,\
\ msg):\n key = pmt.intern(\"freq\")\n value = pmt.dict_ref(msg,\
\ key, pmt.PMT_NIL) \n if(value is not pmt.PMT_NIL):\n self.offset_frequency\
\ = pmt.to_double(value)\n\n def channel_lookup(self):\n channel_frequency\
\ = self.tune_frequency + self.offset_frequency\n #print(f\"{self.tune_frequency}\
\ {self.offset_frequency}\")\n for channel, value in self.all_halow_channels.items():\n\
\ if(value[\"freq\"] == channel_frequency):\n return\
\ (channel, value)\n return (-1, -1)\n\n def work(self, input_items,\
\ output_items):\n # this block does not operate on samples\n \
\ output_items[0][:] = input_items[0]\n\n # find any identified wifi\
\ frames and print out the current channel\n \n \n \n \
\ tags = self.get_tags_in_window(0, 0, len(input_items[0]))\n channel\
\ = self.channel_lookup()\n for tag in tags:\n key = pmt.to_python(tag.key)\n\
\ value = pmt.to_python(tag.value)\n #print(f\"{value}\
\ {self.upper_detection_threshold} {channel[0]}\")\n if(np.abs(value)\
\ < self.correlation_threshold and channel[0] != -1):\n tag_index\
\ = tag.offset - self.nitems_read(0)\n average = 0\n \
\ for i in range(tag_index, tag_index + 10):\n if(i\
\ < len(input_items[0])):\n average += np.real(input_items[0][i])**2\
\ + np.imag(input_items[0][i])**2\n average = 10 * np.log10(average/10)\n\
\ #print(average)\n if(average > self.upper_detection_threshold):\n\
\ channel_freq = channel[1][\"freq\"]/1e6\n \
\ channel_bw = channel[1][\"bw\"]/1e6\n print(f\"\
HaLow activity - channel {channel[0]:>4s}, freq {channel_freq:>6.1f} MHz, bw\
\ {channel_bw:>4.1f} MHz, power avg: {average:>6.2f} dB\")\n\n return\
\ len(output_items[0])\n"
affinity: ''
alias: ''
comment: 'detections whose correlation is less than the correlation threshold
and whose power average exceeds the power threshold will be
perceived as HaLow activity'
correlation_threshold: correlation_threshold
halow_channel_json_filename: halow_channel_json_filename
maxoutbuf: '0'
minoutbuf: '0'
upper_detection_threshold: activity_threshold
states:
_io_cache: ('HaLow Usage Detector', 'blk', [('upper_detection_threshold', '0.2'),
('correlation_threshold', '0.2'), ('halow_channel_json_filename', "''")], [('0',
'complex', 1), ('tune_in', 'message', 1), ('freq_in', 'message', 1)], [('0',
'complex', 1)], 'arguments to this function show up as parameters in GRC', ['correlation_threshold',
'halow_channel_json_filename', 'upper_detection_threshold'])
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [784, 728.0]
rotation: 180
state: enabled
- name: epy_block_1
id: epy_block
parameters:
_source_code: "import numpy as np\nfrom gnuradio import gr\nimport pmt\nimport\
\ json\nimport os\n\nclass blk(gr.sync_block): \n \"\"\"Embedded Python Block\
\ example - a simple multiply const\"\"\"\n\n def __init__(self, loiter_time=2,\
\ sdr_center_freq=902e6, sdr_samp_rate=10e6, samp_rate=1e6, debug=False, halow_channel_json_filename=\"\
\"):\n \"\"\"arguments to this function show up as parameters in GRC\"\
\"\"\n gr.sync_block.__init__(\n self,\n name='HaLow\
\ Scan Controller', \n in_sig=[np.complex64],\n out_sig=[np.complex64]\n\
\ )\n self.halow_channel_json_filename = halow_channel_json_filename\n\
\ self.debug = debug\n self.all_halow_channels = {}\n if(os.path.isfile(halow_channel_json_filename)):\n\
\ json_file = open(self.halow_channel_json_filename)\n \
\ self.all_halow_channels = json.load(json_file)\n json_file.close()\n\
\ else:\n print(\"incorrect file path!\")\n self.sdr_center_freq\
\ = sdr_center_freq\n self.samp_rate = samp_rate\n self.sdr_samp_rate\
\ = sdr_samp_rate\n self.port_freq_control = \"freq_control\"\n \
\ self.port_tuning_control = \"tuning_control\"\n self.message_port_register_out(pmt.intern(self.port_freq_control))\n\
\ self.message_port_register_out(pmt.intern(self.port_tuning_control))\n\
\ self.available_halow_channels = []\n self.channel_index = 0\n\
\ self.loiter_samples = int(loiter_time * samp_rate) # how many samples\
\ to read before switching channels\n self.sample_count = 0\n \
\ self.freq_message = None\n self.tune_message = None\n\n # first\
\ time setup operations\n self.find_available_channels()\n freq_offset\
\ = 0 # initial offset of 0 unless there are available channels\n if(len(self.available_halow_channels)\
\ > 0):\n freq_offset = self.available_halow_channels[self.channel_index][1][\"\
freq\"] - self.sdr_center_freq\n self.set_freq_message(freq_offset) #\
\ initial offset of 0\n self.set_tune_message(self.sdr_center_freq)\n\
\ print(f\"{len(self.available_halow_channels)} available halow channels\
\ in the current range\")\n\n def find_available_channels(self):\n \
\ self.available_halow_channels = []\n for channel, value in self.all_halow_channels.items():\n\
\ channel_lowerbound = value[\"freq\"] - value[\"bw\"]/2\n \
\ channel_upperbound = value[\"freq\"] + value[\"bw\"]/2\n radio_lowerbound\
\ = self.sdr_center_freq - self.sdr_samp_rate / 2\n radio_upperbound\
\ = self.sdr_center_freq + self.sdr_samp_rate / 2\n if(channel_lowerbound\
\ >= radio_lowerbound and channel_upperbound <= radio_upperbound):\n \
\ self.available_halow_channels.append((channel, value))\n\n def\
\ find_next_tuning_freq(self):\n radio_lowerbound = self.sdr_center_freq\
\ - self.sdr_samp_rate / 2\n radio_upperbound = self.sdr_center_freq\
\ + self.sdr_samp_rate / 2\n search_lowerbound = radio_upperbound - 4e6\
\ # 4e6 because it is the maximum width of a HaLow channel that we care about\n\
\ first_channel_miss = None # we will set the radio lowerbound so that\
\ it captures the first missed channel\n count = 0 # ensures we don't\
\ have endless while loop\n if(search_lowerbound < radio_lowerbound):\n\
\ search_lowerbound = radio_lowerbound\n\n # find first channel\
\ miss\n while(first_channel_miss is None):\n for channel,\
\ value in self.all_halow_channels.items():\n # detect miss\n\
\ right_of_search_lowerbound = value[\"freq\"] >= search_lowerbound\n\
\ outside_current_range = radio_upperbound < (value[\"freq\"\
] + value[\"bw\"]/2)\n sdr_can_capture = value[\"\
bw\"] <= self.sdr_samp_rate\n if(right_of_search_lowerbound and\
\ outside_current_range and sdr_can_capture):\n # new lowest\
\ miss\n if(first_channel_miss is None or value[\"freq\"\
] < first_channel_miss[1][\"freq\"]):\n first_channel_miss\
\ = (channel, value)\n # wraparound condition\n if(first_channel_miss\
\ is None and count < 1):\n search_lowerbound = 902e6 # lowest\
\ edge of ISM band\n radio_upperbound = 901e6 # 1MHz lower than\
\ lowest edge of ISM band\n count = count + 1\n elif(first_channel_miss\
\ is None and count >= 1):\n return self.sdr_center_freq\n \
\ \n new_tuning_freq = (self.sdr_samp_rate / 2) + (first_channel_miss[1][\"\
freq\"] - first_channel_miss[1][\"bw\"] / 2)\n return new_tuning_freq\n\
\n\n def set_freq_message(self, freq_offset):\n self.freq_message\
\ = pmt.make_dict()\n self.freq_message = pmt.dict_add(self.freq_message,\
\ pmt.intern(\"freq\"), pmt.from_double(freq_offset))\n\n def set_tune_message(self,\
\ tuning_freq):\n self.sdr_center_freq = tuning_freq\n self.tune_message\
\ = pmt.make_dict()\n self.tune_message = pmt.dict_add(self.tune_message,\
\ pmt.intern(\"freq\"), pmt.from_double(tuning_freq))\n self.find_available_channels()\n\
\n def work(self, input_items, output_items):\n # pass all samples\
\ through; this block doesn't change samples, it just detects them for timing\n\
\ output_items[0][:] = input_items[0]\n\n # increment sample count\
\ so we know how long we've stared at a channel before switching to the next\n\
\ self.sample_count = self.sample_count + len(input_items[0])\n \
\ if(self.sample_count > self.loiter_samples):\n self.sample_count\
\ = 0\n self.channel_index = self.channel_index + 1\n \
\ # check for rollover condition\n if(self.channel_index >= len(self.available_halow_channels)):\n\
\ self.channel_index = 0\n next_tuning_freq =\
\ self.find_next_tuning_freq()\n if(self.debug):\n \
\ print(f\"SDR frequency is {next_tuning_freq/1e6:.2f} MHz\")\n \
\ self.set_tune_message(next_tuning_freq)\n if(len(self.available_halow_channels)\
\ > 0):\n if(self.debug):\n print(f\"current\
\ channel is {self.available_halow_channels[self.channel_index][0]} freq {self.available_halow_channels[self.channel_index][1]['freq']/1e6:.2f}\
\ MHz, bw {self.available_halow_channels[self.channel_index][1]['bw']/1e6:.2f}\
\ MHz\")\n self.set_freq_message(self.available_halow_channels[self.channel_index][1][\"\
freq\"] - self.sdr_center_freq)\n\n # control FIR filter and tuner\n\
\ self.message_port_pub(pmt.intern(self.port_freq_control), self.freq_message)\n\
\ self.message_port_pub(pmt.intern(self.port_tuning_control), self.tune_message)\n\
\ \n # GRC expects this as a return value\n return len(output_items[0])\n\
\n"
affinity: ''
alias: ''
comment: ''
debug: 'True'
halow_channel_json_filename: halow_channel_json_filename
loiter_time: loiter_time
maxoutbuf: '0'
minoutbuf: '0'
samp_rate: samp_rate
sdr_center_freq: sdr_center_freq
sdr_samp_rate: input_samp_rate
states:
_io_cache: ('HaLow Scan Controller', 'blk', [('loiter_time', '2'), ('sdr_center_freq',
'902000000.0'), ('sdr_samp_rate', '10000000.0'), ('samp_rate', '1000000.0'),
('debug', 'False'), ('halow_channel_json_filename', "''")], [('0', 'complex',
1)], [('0', 'complex', 1), ('tuning_control', 'message', 1), ('freq_control',
'message', 1)], 'Embedded Python Block example - a simple multiply const', ['debug',
'halow_channel_json_filename', 'samp_rate', 'sdr_center_freq', 'sdr_samp_rate'])
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [808, 220.0]
rotation: 0
state: enabled
- name: freq_xlating_fir_filter_xxx_0
id: freq_xlating_fir_filter_xxx
parameters:
affinity: ''
alias: ''
center_freq: sdr_center_freq
comment: ''
decim: int(input_samp_rate/samp_rate)
maxoutbuf: '0'
minoutbuf: '0'
samp_rate: input_samp_rate
taps: lpf_taps
type: ccc
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [360, 340.0]
rotation: 0
state: true
- name: ieee802_11_sync_long_0
id: ieee802_11_sync_long
parameters:
affinity: ''
alias: ''
comment: ''
debug: 'False'
log: 'False'
maxoutbuf: '0'
minoutbuf: '0'
sync_length: training_field_size
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1496, 716.0]
rotation: 180
state: enabled
- name: ieee802_11_sync_short_0
id: ieee802_11_sync_short
parameters:
affinity: ''
alias: ''
comment: ''
debug: 'False'
log: 'False'
maxoutbuf: '0'
min_plateau: '2'
minoutbuf: '0'
threshold: '0.7'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1752.0, 576]
rotation: 270
state: enabled
- name: qtgui_time_sink_x_0_0
id: qtgui_time_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
axislabels: 'True'
color1: blue
color10: dark blue
color2: red
color3: green
color4: black
color5: cyan
color6: magenta
color7: yellow
color8: dark red
color9: dark green
comment: ''
ctrlpanel: 'True'
entags: 'False'
grid: 'False'
gui_hint: ''
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
name: '"autocorrelation"'
nconnections: '1'
size: (int((stop_time - start_time) * samp_rate) - 8) * 5
srate: samp_rate
stemplot: 'False'
style1: '1'
style10: '1'
style2: '1'
style3: '1'
style4: '1'
style5: '1'
style6: '1'
style7: '1'
style8: '1'
style9: '1'
tr_chan: '0'
tr_delay: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: float
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
ylabel: Amplitude
ymax: '1'
ymin: '-1'
yunit: '""'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1904, 580.0]
rotation: 180
state: disabled
- name: qtgui_time_sink_x_1_0
id: qtgui_time_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
axislabels: 'True'
color1: blue
color10: dark blue
color2: red
color3: green
color4: black
color5: cyan
color6: magenta
color7: yellow
color8: dark red
color9: dark green
comment: ''
ctrlpanel: 'True'
entags: 'True'
grid: 'False'
gui_hint: ''
label1: Signal 1
label10: Signal 10
label2: Signal 2
label3: Signal 3
label4: Signal 4
label5: Signal 5
label6: Signal 6
label7: Signal 7
label8: Signal 8
label9: Signal 9
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
name: '"post sync long"'
nconnections: '1'
size: '16500'
srate: samp_rate
stemplot: 'False'
style1: '1'
style10: '1'
style2: '1'
style3: '1'
style4: '1'
style5: '1'
style6: '1'
style7: '1'
style8: '1'
style9: '1'
tr_chan: '0'
tr_delay: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: complex
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
ylabel: Amplitude
ymax: '1'
ymin: '-1'
yunit: '""'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [552, 732.0]
rotation: 180
state: enabled
- name: qtgui_time_sink_x_1_0_0
id: qtgui_time_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
axislabels: 'True'
color1: blue
color10: dark blue
color2: red
color3: green
color4: black
color5: cyan
color6: magenta
color7: yellow
color8: dark red
color9: dark green
comment: ''
ctrlpanel: 'True'
entags: 'True'
grid: 'False'
gui_hint: ''
label1: Signal 1
label10: Signal 10
label2: Signal 2
label3: Signal 3
label4: Signal 4
label5: Signal 5
label6: Signal 6
label7: Signal 7
label8: Signal 8
label9: Signal 9
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
name: '"post sync short"'
nconnections: '1'
size: '16500'
srate: samp_rate
stemplot: 'False'
style1: '1'
style10: '1'
style2: '1'
style3: '1'
style4: '1'
style5: '1'
style6: '1'
style7: '1'
style8: '1'
style9: '1'
tr_chan: '0'
tr_delay: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: complex
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
ylabel: Amplitude
ymax: '1'
ymin: '-1'
yunit: '""'
states:
bus_sink: false