Ejemplo n.º 1
0
def add_options(parser, expert):
    add_freq_option(parser)
    usrp_options.add_rx_options(parser)
    receive_path.receive_path.add_options(parser, expert)
    expert.add_option("", "--rx-freq", type="eng_float", default=None,
                          help="set Rx frequency to FREQ [default=%default]", metavar="FREQ")
    parser.add_option("-v", "--verbose", action="store_true", default=False)
Ejemplo n.º 2
0
def add_options(parser, expert):
    add_freq_option(parser)
    usrp_options.add_rx_options(parser)
    receive_path.receive_path.add_options(parser, expert)
    expert.add_option("",
                      "--rx-freq",
                      type="eng_float",
                      default=None,
                      help="set Rx frequency to FREQ [default=%default]",
                      metavar="FREQ")
    parser.add_option("-v", "--verbose", action="store_true", default=False)
Ejemplo n.º 3
0
def main():
    global n_rcvd, n_right, pktno

    n_rcvd = 0
    n_right = 0
    pktno = 1
    
    def rx_callback(ok, payload):
        global n_rcvd, n_right, pktno
        (pktno,) = struct.unpack('!H', payload[0:2])
        n_rcvd += 1
        if ok:
            n_right += 1

        if not options.gui:
            print "ok = %5s  pktno = %4d  n_rcvd = %4d  n_right = %4d" % (
                ok, pktno, n_rcvd, n_right)


    demods = modulation_utils.type_1_demods()

    # Create Options Parser:
    parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
    expert_grp = parser.add_option_group("Expert")

    parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), 
                      default='dbpsk',
                      help="Select modulation from: %s [default=%%default]"
                            % (', '.join(demods.keys()),))

    my_top_block.add_options(parser, expert_grp)
    receive_path.add_options(parser, expert_grp)
    usrp_options.add_rx_options(parser)

    for mod in demods.values():
        mod.add_options(expert_grp)

    (options, args) = parser.parse_args ()

    if len(args) != 0:
        parser.print_help(sys.stderr)
        sys.exit(1)

    if options.rx_freq is None:
        sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
        parser.print_help(sys.stderr)
        sys.exit(1)


    # build the graph
    tb = my_top_block(demods[options.modulation], rx_callback, options)

    r = gr.enable_realtime_scheduling()
    if r != gr.RT_OK:
        print "Warning: Failed to enable realtime scheduling."

    tb.start()        # start flow graph

    if(options.gui):
        tb.qapp.exec_()
    else:
        tb.wait()         # wait for it to finish