예제 #1
0
 def test_encode_ook_fast(self):
     rolling, fixed = self.v1_rolling_list[0], self.v1_fixed_list[0]
     ook_out = secplus.encode_ook(rolling, fixed)
     ook = "000100010001001100010001000100010111001100110011011101110011000101110111011101110011" \
         + "0000000000000000000000000000000000000000" \
         + "011100010011001100110111011100110011000100110111001100010011000100010011001100110001" \
         + "0000000000000000000000000000000000000000"
     ook = [int(bit) for bit in ook]
     self.assertEqual(ook, ook_out)
예제 #2
0
    def __init__(self, fixed=1234567890, freq=315150000, rolling=1234567890):
        gr.top_block.__init__(self, "Secplus Tx")

        ##################################################
        # Parameters
        ##################################################
        self.fixed = fixed
        self.freq = freq
        self.rolling = rolling

        ##################################################
        # Variables
        ##################################################
        self.seq = seq = [0] * 100 + secplus.encode_ook(
            rolling, fixed, fast=False) * 4 + [0] * 100
        self.samp_rate = samp_rate = 2e6

        ##################################################
        # Blocks
        ##################################################
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_cc(
            0.1, 1)
        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(freq - 300e3, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(0, 0)
        self.osmosdr_sink_0.set_if_gain(47, 0)
        self.osmosdr_sink_0.set_bb_gain(0, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
        self.blocks_vector_source_x_0 = blocks.vector_source_c(
            seq, False, 1, [])
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, 1000)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 300e3, 0.9, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.blocks_repeat_0, 0),
                     (self.single_pole_iir_filter_xx_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_repeat_0, 0))
        self.connect((self.single_pole_iir_filter_xx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
예제 #3
0
 def set_rolling(self, rolling):
     self.rolling = rolling
     self.set_seq([0] * 100 +
                  secplus.encode_ook(self.rolling, self.fixed, fast=False) *
                  4 + [0] * 100)
예제 #4
0
 def set_fixed(self, fixed):
     self.fixed = fixed
     self.set_seq([0] * 100 +
                  secplus.encode_ook(self.rolling, self.fixed, fast=False) *
                  4 + [0] * 100)