| | 204 | |
|---|
| | 205 | |
|---|
| | 206 | * Standard command line options |
|---|
| | 207 | |
|---|
| | 208 | When writing programs that are executable from the command line, |
|---|
| | 209 | please follow these guidelines for command line argument names (short |
|---|
| | 210 | and long) and types of the arguments. We list them below using the |
|---|
| | 211 | Python optparse syntax. In general, the default value should be coded |
|---|
| | 212 | into the help string using the "... [default=%default]" syntax. |
|---|
| | 213 | |
|---|
| | 214 | ** Mandatory options by gr_block |
|---|
| | 215 | |
|---|
| | 216 | *** USRP source |
|---|
| | 217 | |
|---|
| | 218 | Any program using a USRP source (usrp.source_*) shall include: |
|---|
| | 219 | |
|---|
| | 220 | add_option("", "--which-usrp", type="intx", default=0, |
|---|
| | 221 | help="select which USRP to use [default=%default]") |
|---|
| | 222 | |
|---|
| | 223 | add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 0), |
|---|
| | 224 | help="select USRP Rx side A or B [default=A]") |
|---|
| | 225 | |
|---|
| | 226 | You are free to change the default if it makes sense in your application. |
|---|
| | 227 | |
|---|
| | 228 | |
|---|
| | 229 | *** USRP sink |
|---|
| | 230 | |
|---|
| | 231 | Any program using a USRP sink (usrp.sink_*) shall include: |
|---|
| | 232 | |
|---|
| | 233 | add_option("", "--which-usrp", type="intx", default=0, |
|---|
| | 234 | help="select which USRP to use [default=%default]") |
|---|
| | 235 | |
|---|
| | 236 | add_option("-T", "--tx-subdev-spec", type="subdev", default=(0, 0), |
|---|
| | 237 | help="select USRP Tx side A or B [default=A]") |
|---|
| | 238 | |
|---|
| | 239 | You are free to change the default if it makes sense in your application. |
|---|
| | 240 | |
|---|
| | 241 | |
|---|
| | 242 | *** Audio source |
|---|
| | 243 | |
|---|
| | 244 | Any program using an audio source shall include: |
|---|
| | 245 | |
|---|
| | 246 | add_option("-I", "--audio-input", type="string", default="", |
|---|
| | 247 | help="pcm input device name. E.g., hw:0,0 or /dev/dsp") |
|---|
| | 248 | |
|---|
| | 249 | The default must be "". This allows an audio module-dependent default |
|---|
| | 250 | to be specified in the user preferences file. |
|---|
| | 251 | |
|---|
| | 252 | |
|---|
| | 253 | *** Audio sink |
|---|
| | 254 | |
|---|
| | 255 | add_option("-O", "--audio-output", type="string", default="", |
|---|
| | 256 | help="pcm output device name. E.g., hw:0,0 or /dev/dsp") |
|---|
| | 257 | |
|---|
| | 258 | The default must be "". This allows an audio module-dependent default |
|---|
| | 259 | to be specified in the user preferences file. |
|---|
| | 260 | |
|---|
| | 261 | |
|---|
| | 262 | ** Standard options names by parameter |
|---|
| | 263 | |
|---|
| | 264 | Whenever you want an integer, use the "intx" type. This allows the |
|---|
| | 265 | user to input decimal, hex or octal numbers. E.g., 10, 012, 0xa. |
|---|
| | 266 | |
|---|
| | 267 | Whenever you want a float, use the "eng_float" type. This allows the |
|---|
| | 268 | user to input numbers with SI suffixes. E.g, 10000, 10k, 10M, 10m, 92.1M |
|---|
| | 269 | |
|---|
| | 270 | If your program allows the user to specify values for any of the |
|---|
| | 271 | following parameters, please use these options to specify them: |
|---|
| | 272 | |
|---|
| | 273 | |
|---|
| | 274 | To specify a frequency (typically an RF center frequency) use: |
|---|
| | 275 | |
|---|
| | 276 | add_option("-f", "--freq", type="eng_float", default=<your-default-here>, |
|---|
| | 277 | help="set frequency to FREQ [default=%default]") |
|---|
| | 278 | |
|---|
| | 279 | |
|---|
| | 280 | To specify a decimation factor use: |
|---|
| | 281 | |
|---|
| | 282 | add_option("-d", "--decim", type="intx", default=<your-default-here>, |
|---|
| | 283 | help="set decimation rate to DECIM [default=%default]") |
|---|
| | 284 | |
|---|
| | 285 | |
|---|
| | 286 | To specify an interpolation factor use: |
|---|
| | 287 | |
|---|
| | 288 | add_option("-i", "--interp", type="intx", default=<your-default-here>, |
|---|
| | 289 | help="set interpolation rate to INTERP [default=%default]") |
|---|
| | 290 | |
|---|
| | 291 | |
|---|
| | 292 | To specify a gain setting use: |
|---|
| | 293 | |
|---|
| | 294 | add_option("-g", "--gain", type="eng_float", default=<your-default-here>, |
|---|
| | 295 | help="set gain in dB [default=%default]") |
|---|
| | 296 | |
|---|
| | 297 | |
|---|
| | 298 | If your application specifies both a tx and an rx gain, use: |
|---|
| | 299 | |
|---|
| | 300 | add_option("", "--rx-gain", type="eng_float", default=<your-default-here>, |
|---|
| | 301 | help="set receive gain in dB [default=%default]") |
|---|
| | 302 | |
|---|
| | 303 | add_option("", "--tx-gain", type="eng_float", default=<your-default-here>, |
|---|
| | 304 | help="set transmit gain in dB [default=%default]") |
|---|
| | 305 | |
|---|
| | 306 | |
|---|
| | 307 | To specify the number of channels of something use: |
|---|
| | 308 | |
|---|
| | 309 | add_option("-n", "--nchannels", type="intx", default=1, |
|---|
| | 310 | help="specify number of channels [default=%default]") |
|---|
| | 311 | |
|---|
| | 312 | |
|---|
| | 313 | To specify an output filename use: |
|---|
| | 314 | |
|---|
| | 315 | add_option("-o", "--output-filename", type="string", default=<your-default-here>, |
|---|
| | 316 | help="specify output-filename [default=%default]") |
|---|
| | 317 | |
|---|
| | 318 | |
|---|
| | 319 | To specify a rate use: |
|---|
| | 320 | |
|---|
| | 321 | add_option("-r", "--bit-rate", type="eng_float", default=<your-default-here>, |
|---|
| | 322 | help="specify bit-rate [default=%default]") |
|---|
| | 323 | or |
|---|
| | 324 | |
|---|
| | 325 | add_option("-r", "--sample-rate", type="eng_float", default=<your-default-here>, |
|---|
| | 326 | help="specify sample-rate [default=%default]") |
|---|
| | 327 | |
|---|
| | 328 | |
|---|
| | 329 | If your application has a verbose option, use: |
|---|
| | 330 | |
|---|
| | 331 | add_option('-v', '--verbose', action="store_true", default=False, |
|---|
| | 332 | help="verbose output") |
|---|
| | 333 | |
|---|
| | 334 | |
|---|
| | 335 | If your application allows the user to specify the "fast USB" options, use: |
|---|
| | 336 | |
|---|
| | 337 | add_option("", "--fusb-block-size", type="intx", default=0, |
|---|
| | 338 | help="specify fast usb block size [default=%default]") |
|---|
| | 339 | |
|---|
| | 340 | add_option("", "--fusb-nblocks", type="intx", default=0, |
|---|
| | 341 | help="specify number of fast usb blocks [default=%default]") |
|---|