示例#1
0
 def __init__(self, modulator_class, options):
     gr.top_block.__init__(self)
     self.txpath = usrp_transmit_path.usrp_transmit_path(
         modulator_class, options)
     self.audio_rx = audio_rx(options.audio_input)
     self.connect(self.txpath)
     self.connect(self.audio_rx)
示例#2
0
    def __init__(self, mod_class, demod_class,
                 rx_callback, options):

        gr.top_block.__init__(self)
        self.txpath = usrp_transmit_path.usrp_transmit_path(mod_class, options)
        self.rxpath = usrp_receive_path.usrp_receive_path(demod_class, rx_callback, options)
        self.connect(self.txpath)
        self.connect(self.rxpath)
示例#3
0
文件: tunnel.py 项目: GREO/GNU-Radio
    def __init__(self, mod_class, demod_class,
                 rx_callback, options):

        gr.top_block.__init__(self)
        self.txpath = usrp_transmit_path.usrp_transmit_path(mod_class, options)
        self.rxpath = usrp_receive_path.usrp_receive_path(demod_class, rx_callback, options)
        self.connect(self.txpath)
        self.connect(self.rxpath)
示例#4
0
    def __init__(self, callback):
        gr.top_block.__init__(self)

        parser = OptionParser(option_class=eng_option,
                              conflict_handler="resolve")
        expert_grp = parser.add_option_group("Expert")
        parser.add_option("",
                          "--discontinuous",
                          action="store_true",
                          default=False,
                          help="enable discontinuous")
        transceiver.add_options(parser, expert_grp)
        args = ['-f', '2.4G', '-u', '1', '-i', '64', '-d', '32']
        (options, args) = parser.parse_args(args)

        #init receive
        self._rx_freq = options.rx_freq
        self._rx_gain = options.rx_gain
        self._rx_subdev_spec = options.rx_subdev_spec
        self._decim = options.decim

        #init transmit
        self._tx_freq = options.tx_freq
        self._tx_subdev_spec = options.tx_subdev_spec
        self._interp = options.interp

        #check receive
        if self._rx_freq is None:
            sys.stderr.write(
                "-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
            raise SystemExit

        #check transmit
        if self._tx_freq is None:
            sys.stderr.write(
                "-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
            raise SystemExit

        demods = modulation_utils.type_1_demods()
        self.rx_path = usrp_receive_path.usrp_receive_path(
            demods[options.modulation], callback, options)
        self.connect(self.rx_path)

        mods = modulation_utils.type_1_mods()
        self.tx_path = usrp_transmit_path.usrp_transmit_path(
            mods[options.modulation], options)
        self.connect(self.tx_path)
        r = gr.enable_realtime_scheduling()
        if r != gr.RT_OK:
            print "Warning: failed to enable realtime scheduling"
示例#5
0
    def __init__(self, callback):
        gr.top_block.__init__(self)
        
        parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
        expert_grp = parser.add_option_group("Expert")
        parser.add_option("","--discontinuous", action="store_true", default=False, help="enable discontinuous")
        transceiver.add_options(parser, expert_grp)
        args = ['-f', '2.4G', '-u', '1', '-i', '64', '-d', '32']
        (options, args) = parser.parse_args(args)

        #init receive
        self._rx_freq = options.rx_freq
        self._rx_gain = options.rx_gain
        self._rx_subdev_spec = options.rx_subdev_spec
        self._decim = options.decim

        #init transmit
        self._tx_freq = options.tx_freq
        self._tx_subdev_spec = options.tx_subdev_spec
        self._interp = options.interp
        
        #check receive
        if self._rx_freq is None:
            sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
            raise SystemExit

        #check transmit
        if self._tx_freq is None:
            sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
            raise SystemExit

        demods = modulation_utils.type_1_demods()
        self.rx_path = usrp_receive_path.usrp_receive_path(demods[options.modulation], callback, options)
        self.connect(self.rx_path)

        mods = modulation_utils.type_1_mods()
        self.tx_path = usrp_transmit_path.usrp_transmit_path(mods[options.modulation], options)
        self.connect(self.tx_path)
        r = gr.enable_realtime_scheduling()
        if r != gr.RT_OK:
            print "Warning: failed to enable realtime scheduling"
	def __init__(self, callback, options):
		gr.top_block.__init__(self)
		#self.rxpath = usrp_receive_path.usrp_receive_path(callback, options)
		self.txpath = usrp_transmit_path.usrp_transmit_path(options)
		#self.rxpath = receive_path.receive_path(callback, options)
		#self.tovector_1 = gr.stream_to_vector(gr.sizeof_gr_complex, packet_len)
		#self.tovector_2 = gr.stream_to_vector(gr.sizeof_gr_complex, packet_len)
		#self.tostream = gr.vector_to_stream(gr.sizeof_gr_complex, packet_len)
		#self.interleaver = gr.interleave(gr.sizeof_gr_complex*packet_len)
		#self.noise = gr.noise_source_c(gr.GR_GAUSSIAN, options.noise, 1002)
		#self.file_sink = gr.file_sink(gr.sizeof_gr_complex, "transmitted.dat")
		#self.file_source = gr.file_source(gr.sizeof_gr_complex, "transmitted.dat", True)
		#self.null_source = gr.null_source(gr.sizeof_gr_complex)
		#self.throttle = gr.throttle(gr.sizeof_gr_complex, 500000)
		# self.add = gr.add_cc()

		#self.connect(self.txpath, self.tovector_1, (self.interleaver, 0))
		#self.connect(self.noise, self.tovector_2, (self.interleaver, 1))
		#self.connect(self.interleaver, self.tostream)
		#self.connect(self.tostream, self.file_sink)
		#self.connect(self.tostream, self.rxpath)
		#self.connect(self.rxpath)
		self.connect(self.txpath)
	def __init__(self, options):
	    gr.top_block.__init__(self)
	    self.txpath = usrp_transmit_path.usrp_transmit_path(options)
	    self.connect(self.txpath)
示例#8
0
    def __init__(self, max_loss, options):
        gr.top_block.__init__(self)
        self._state = _INIT
        self._n_rcvd = 0
        self._n_right = 0
        self._sender = options.sender
        self._occupied_tones = options.occupied_tones_sender
        self.num_groups = options.num_groups
        self._group_size = int(math.floor((self._occupied_tones - 4)/self.num_groups))
        self.group_sort = [0]*self.num_groups
        self.group_sort[self.num_groups - 1] = self.num_groups//2
        j = 0
        for i in range (self.num_groups):
            if i != self.num_groups//2:
                self.group_sort[j] = i
                j += 1
        self.group_sort = [2,4,5,1,6,0,3]
        self._current_mcs = "qam64"
        self._current_width = self.num_groups * self._group_size
        #options.tone_map_sender = _map_per_width[self._current_width]
        options.width_map = "1111111"
        self._time_per_subcarrier = options.fft_length/float(options.sample_rate)
        self.verbose = options.verbose
        if self._sender:
            self._pkt_size = options.size
            self._spacing = options.spacing
            self.txpath = usrp_transmit_path.usrp_transmit_path(options)
            self.connect(self.txpath)
            #self.file_sink = gr.file_sink(gr.sizeof_gr_complex, "transmitted.dat")
            #self.connect(self.txpath.tx_path, self.file_sink)
            
            client_a = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            client_a.connect((options.rx_ip, options.rx_port))
            #client_a = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
            #client_a.connect((options.rx_ip, options.rx_port, 0, 0))
            
            client_a.settimeout(options.ack_timeout)
            self.ack_recvr = ACKReceivingThread(client_a, self, self.verbose)
            self.ack_recvr.start()
            time.sleep(2)
            
            client_w = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            client_w.connect((options.rx_ip, options.rx_port+1))
            #client_w = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
            #client_w.connect((options.rx_ip, options.rx_port+1, 0, 0))
            
            self.width_sender = WidthSendingThread(client_w, self.verbose)
            self.width_sender.start()
            self.s = whiterate.state_table(max_loss, self.num_groups, self._group_size, self._time_per_subcarrier)
            self.refresh_gains = True
            #self.s = samplerate.state_table(max_loss)
            self._total_ok = 0
            self._time = 0
            self._total_energy = 0
            self._small_time = 0
            self._small_total_energy = 0
        else:
            self.rxpath = usrp_receive_path.usrp_receive_path(self.rx_callback, options)
            self.connect(self.rxpath)

            server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            #server = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
            
            server.bind(( '', options.rx_port ))
            server.listen(5)
            channel, details = server.accept()
            self.ack_sender = ACKSendingThread(channel, details, self.verbose)
            self.ack_sender.start()
            
            server_w = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            #server_w = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
            
            server_w.bind(( '', options.rx_port+1))
            server_w.listen(5)
            channel_w, details_w = server_w.accept()
            self.width_recv = WidthReceiveThread(channel_w, details_w, self, options)
            self.width_recv.start()

        #loss_table = self.t.calc_averages(max_loss)

        settings.program_start()
示例#9
0
	def __init__(self, options):
		gr.top_block.__init__(self)

		self.txpath = usrp_transmit_path.usrp_transmit_path(options)
		self.connect(self.txpath)
示例#10
0
 def __init__(self, options):
     gr.top_block.__init__(self)
     self.txpath = usrp_transmit_path.usrp_transmit_path(
         options
     )  # Define the transmitter_path -- Initializes and connects blocks and pass the options to transmit_path
     self.connect(self.txpath)  # Adding txpath block to flowgraph
示例#11
0
    def __init__(self, modulator_class, options):
        gr.top_block.__init__(self)
        self.txpath = usrp_transmit_path.usrp_transmit_path(modulator_class, options)
        self.audio_rx = audio_rx(options.audio_input)
	self.connect(self.txpath)
	self.connect(self.audio_rx)
示例#12
0
      def __init__(self, options):
	  gr.top_block.__init__(self)
	  self.txpath = usrp_transmit_path.usrp_transmit_path(options)       # Define the transmitter_path -- Initializes and connects blocks and pass the options to transmit_path
	  self.connect(self.txpath)		# Adding txpath block to flowgraph