def __init__(self, serverip, serverport, clientname, packetsize, simulation, samp_rate, center_freq, net_id, device_addr, stream_args): gr.hier_block2.__init__(self, "sim_source_c", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(0, 0, 0)) uhd_gate.__init__(self) self.simulation = simulation self.samp_rate = samp_rate self.typ = 'tx' if not self.simulation: self.usrp = uhd.usrp_sink(device_addr, stream_args) # TODO: Parameters self.connect(self, self.usrp) else: self.simsnk = sim_sink_cc(self, serverip, serverport, clientname, packetsize, samp_rate, center_freq, net_id) # self.tcp_sink = grc_blks2.tcp_sink(itemsize=gr.sizeof_gr_complex, # addr=serverip, # port=self.simsnk.get_dataport(), # server=False) self.tcp_sink = gr.udp_sink(itemsize=gr.sizeof_gr_complex, host=str(serverip), port=self.simsnk.get_dataport(), payload_size=1472, eof=False) self.gain_blk = gr.multiply_const_vcc((1, )) self.heartbeat = heart_beat(0.1, "", "") self.connect(self.heartbeat, (self.simsnk, 1)) #self.connect(self, (simsnk, 0), self.tcp_sink) self.connect(self, self.gain_blk, (self.simsnk, 0)) self.connect((self.simsnk, 0), self.tcp_sink)
def __init__(self, serverip, serverport, clientname, packetsize, simulation, samp_rate, center_freq, net_id, device_addr, stream_args): gr.hier_block2.__init__(self, "sim_source_c", gr.io_signature(0, 0, 0), gr.io_signature(1, 1, gr.sizeof_gr_complex)) uhd_gate.__init__(self) self.simulation = simulation self.serverip = serverip self.samp_rate = samp_rate self.typ = 'rx' if not self.simulation: self.usrp = uhd.usrp_source(device_addr, stream_args) # TODO: Parameters self.connect(self.usrp, self) else: self.simsrc = sim_source_cc(self, serverip, serverport, clientname, packetsize, samp_rate, center_freq, net_id) # TODO: dirty hack!!! # self.tcp_source = grc_blks2.tcp_source(itemsize=gr.sizeof_gr_complex, # addr=self.serverip, # port=self.simsrc.get_dataport(), # server=False) self.tcp_source = gr.udp_source(itemsize=gr.sizeof_gr_complex, host=self.serverip, port=self.simsrc.get_dataport(), payload_size=1472, eof=False, wait=True) self.gain_blk = blocks.multiply_const_vcc((1, )) self.connect(self.tcp_source, self.gain_blk, self.simsrc, self)