Exemplo n.º 1
0
 def set_data_chan(self, data_chan):
     self.data_chan = data_chan
     self.set_packets(
         gotenna_packet.encode_shout_packets(self.data_chan, self.app_id,
                                             self.sender_gid, self.initials,
                                             self.message))
     self.blocks_vector_source_x_2.set_data(
         gotenna_packet.vco(self.center_freq, self.control_chan,
                            self.data_chan, self.packets) +
         [0] * self.silence_time, [])
Exemplo n.º 2
0
    def __init__(self,
                 app_id=0x3fff,
                 initials='VE3IRR',
                 message='Hello world!',
                 sender_gid=1234567890):
        gr.top_block.__init__(self, "Gotenna Tx Hackrf")

        ##################################################
        # Parameters
        ##################################################
        self.app_id = app_id
        self.initials = initials
        self.message = message
        self.sender_gid = sender_gid

        ##################################################
        # Variables
        ##################################################
        self.samp_per_sym = samp_per_sym = 4
        self.interp = interp = 20
        self.data_chan = data_chan = 2
        self.silence_time = silence_time = 5000
        self.samp_rate = samp_rate = 24000 * samp_per_sym * interp
        self.packets = packets = gotenna_packet.encode_shout_packets(
            data_chan, app_id, sender_gid, initials, message)
        self.control_chan = control_chan = 2
        self.center_freq = center_freq = 926250000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=interp, decimation=1, taps=None, fractional_bw=None)
        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + '')
        self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(1, 0)
        self.osmosdr_sink_0.set_if_gain(20, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
            samples_per_symbol=samp_per_sym,
            sensitivity=1.0,
            bt=0.5,
            verbose=False,
            log=False)
        self.blocks_vector_source_x_2 = blocks.vector_source_f(
            gotenna_packet.vco(center_freq, control_chan, data_chan, packets) +
            [0] * silence_time, False, 1, [])
        self.blocks_vector_source_x_1 = blocks.vector_source_c(
            gotenna_packet.envelope(packets) + [0] * silence_time, False, 1,
            [])
        self.blocks_vector_source_x_0 = blocks.vector_source_b(
            gotenna_packet.gfsk_bytes(packets) + [0] * silence_time, False, 1,
            [])
        self.blocks_vco_c_0 = blocks.vco_c(samp_rate, 2 * math.pi, 0.9)
        self.blocks_repeat_1 = blocks.repeat(gr.sizeof_float * 1,
                                             8 * samp_per_sym * interp)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1,
                                             8 * samp_per_sym)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_repeat_1, 0), (self.blocks_vco_c_0, 0))
        self.connect((self.blocks_vco_c_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.digital_gfsk_mod_0, 0))
        self.connect((self.blocks_vector_source_x_1, 0),
                     (self.blocks_repeat_0, 0))
        self.connect((self.blocks_vector_source_x_2, 0),
                     (self.blocks_repeat_1, 0))
        self.connect((self.digital_gfsk_mod_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_1, 0))
Exemplo n.º 3
0
 def set_message(self, message):
     self.message = message
     self.set_packets(
         gotenna_packet.encode_shout_packets(self.data_chan, self.app_id,
                                             self.sender_gid, self.initials,
                                             self.message))
Exemplo n.º 4
0
 def set_sender_gid(self, sender_gid):
     self.sender_gid = sender_gid
     self.set_packets(
         gotenna_packet.encode_shout_packets(self.data_chan, self.app_id,
                                             self.sender_gid, self.initials,
                                             self.message))
Exemplo n.º 5
0
 def set_initials(self, initials):
     self.initials = initials
     self.set_packets(
         gotenna_packet.encode_shout_packets(self.data_chan, self.app_id,
                                             self.sender_gid, self.initials,
                                             self.message))