aboutsummaryrefslogtreecommitdiffstats
path: root/gr-qtgui/grc/qtgui_sink_x.block.yml
blob: 2a20eead980f8aff5ffc0d595ed20f5e9d203067 (plain) (blame)
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
id: qtgui_sink_x
label: QT GUI Sink
flags: [ python, cpp ]

parameters:
-   id: type
    label: Type
    dtype: enum
    default: complex
    options: [complex, float]
    option_attributes:
        fcn: [sink_c, sink_f]
    hide: part
-   id: name
    label: Name
    dtype: string
    default: '""'
-   id: fftsize
    label: FFT Size
    dtype: int
    default: '1024'
    options: ['32','64','128','256','512','1024','2048','4096','8192','16384','32768']
-   id: wintype
    label: Window Type
    dtype: enum
    default: window.WIN_BLACKMAN_hARRIS
    options: [window.WIN_BLACKMAN_hARRIS, window.WIN_HAMMING, window.WIN_HANN, window.WIN_BLACKMAN,
        window.WIN_RECTANGULAR, window.WIN_KAISER]
    option_labels: [Blackman-harris, Hamming, Hann, Blackman, Rectangular, Kaiser]
    option_attributes:
        cpp_opts: ["fft::window::WIN_BLACKMAN_hARRIS", "fft::window::WIN_HAMMING", "fft::window::WIN_HANN", "fft::window::WIN_BLACKMAN",
        "fft::window::WIN_RECTANGULAR", "fft::window::WIN_KAISER"]
    hide: part
-   id: fc
    label: Center Frequency (Hz)
    dtype: real
    default: '0'
-   id: bw
    label: Bandwidth (Hz)
    dtype: real
    default: samp_rate
-   id: rate
    label: Update Rate
    dtype: real
    default: '10'
-   id: showrf
    label: Show RF Freq
    dtype: enum
    default: 'False'
    options: ['True', 'False']
    option_labels: ['Yes', 'No']
    hide: part
-   id: plotfreq
    label: Plot Frequency
    dtype: bool
    default: 'True'
    options: ['True', 'False']
    option_labels: ['On', 'Off']
    hide: part
-   id: plotwaterfall
    label: Plot Waterfall
    dtype: bool
    default: 'True'
    options: ['True', 'False']
    option_labels: ['On', 'Off']
    hide: part
-   id: plottime
    label: Plot Time
    dtype: bool
    default: 'True'
    options: ['True', 'False']
    option_labels: ['On', 'Off']
    hide: part
-   id: plotconst
    label: Plot Const
    dtype: bool
    default: 'True'
    options: ['True', 'False']
    option_labels: ['On', 'Off']
    hide: part
-   id: gui_hint
    label: GUI Hint
    dtype: gui_hint
    hide: part
-   id: showports
    label: Show Msg Ports
    dtype: bool
    default: 'False'
    hide: part

inputs:
-   domain: stream
    dtype: ${ type }
    multiplicity: ${ num_inputs }
-   domain: message
    id: freq
    optional: true
    hide: ${ not showports }

outputs:
-   domain: message
    id: freq
    optional: true
    hide: ${ not showports }

asserts:
- ${fftsize >= 32 and fftsize <= 32768}
- ${not (fftsize & (fftsize -1))}

templates:
    imports: |-
        from PyQt5 import Qt
        from gnuradio import qtgui
        from gnuradio.filter import firdes
        import sip
    callbacks:
    - set_frequency_range(${fc}, ${bw})
    make: |-
        <%
            win = 'self._%s_win'%id
        %>\
        qtgui.${type.fcn}(
            ${fftsize}, #fftsize
            ${wintype}, #wintype
            ${fc}, #fc
            ${bw}, #bw
            ${name}, #name
            ${plotfreq}, #plotfreq
            ${plotwaterfall}, #plotwaterfall
            ${plottime}, #plottime
            ${plotconst}, #plotconst
            None # parent
        )
        self.${id}.set_update_time(1.0/${rate})
        ${win} = sip.wrapinstance(self.${id}.qwidget(), Qt.QWidget)

        self.${id}.enable_rf_freq(${showrf})

        ${gui_hint() % win}


cpp_templates:
  includes: ['#include <gnuradio/qtgui/${type.fcn}.h>', '#include <gnuradio/filter/firdes.h>']
  declarations: gr::qtgui::${type.fcn}::sptr ${id};
  make: |-
    <%
        win = '_%s_win'%id
    %>\
    ${id} = gr::qtgui::${type.fcn}::make(
            ${fftsize}, //fftsize
            ${wintype.cpp_opts}, // wintype
            ${fc}, //fc
            ${bw}, //bw
            "${name.strip("'").strip('"')}", //name
            ${plotfreq}, //plotfreq
            ${plotwaterfall}, //plotwaterfall
            ${plottime}, //plottime
            ${plotconst} //plotconst
        );
    ${id}->set_update_time(1.0/${rate});   
    ${id}->enable_rf_freq(${showrf});
    QWidget* _${id}_win;
    _${id}_win = this->${id}->qwidget();
    ${gui_hint() % win}
    
  link: ['gnuradio::gnuradio-qtgui']
  translations:
    'True': 'true'
    'False': 'false'

documentation: |-
    The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.

file_format: 1