コード例 #1
0
    def __init__(self, *args, **kwargs):
        """
    Hierarchical block for BPSK demodulation.

    The input is the complex modulated signal at baseband.
        Demodulated packets are sent to the handler.

        @param callback:  function of two args: ok, payload
        @type callback: ok: bool; payload: string
        @param threshold: detect access_code with up to threshold bits wrong (-1 -> use default)
        @type threshold: int

        See ieee802_15_4_demod for remaining parameters.
    """
        try:
            self.callback = kwargs.pop('callback')
            self.threshold = kwargs.pop('threshold')    
            #Return the demodulator
            self.demodulator = kwargs.pop('demodulator')
            self.gui = kwargs.pop('gui')
            self._samples_per_symbol = kwargs.pop('sps')
        except KeyError:
            pass
        gr.hier_block2.__init__(self, "ieee_pkt_receiver",
                        gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input
                        gr.io_signature(0, 0, 0))  # Output
        
        self._rcvd_pktq = gr.msg_queue()          # holds packets from the PHY
        
        #Create the sink of packets
        self._packet_sink = ieee.ieee802_15_4_packet_sink(self._rcvd_pktq, self.threshold)
        
        #self.complex_to_float = gr.complex_to_float(1)
        self.complex_to_real = gr.complex_to_real()
        #self.null_sink = gr.null_sink(gr.sizeof_float*1)
        #self.connect((self.gr_complex_to_float_0, 0), (self.gr_vector_sink_x_0, 0))
        #self.connect(self.complex_to_float, self.null_sink)
#        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
#            self.gui.GetWin(),
#            title="Constellation Plot",
#            sample_rate=self._samples_per_symbol,
#            frame_rate=5,
#            const_size=2048,
#            M=2,
#            theta=0,
#            alpha=0.005,
#            fmax=0.06,
#            mu=0.5,
#            gain_mu=0.005,
#            symbol_rate=self._samples_per_symbol/2,
#            omega_limit=0.005,
#        )
#        self.gui.Add(self.wxgui_constellationsink2_0.win)
        

        self.connect(self, self.demodulator, self.complex_to_real, self._packet_sink)
        #self.connect(self, self.demodulator, self.wxgui_constellationsink2_0)
      
        self._watcher = _queue_watcher_thread(self._rcvd_pktq, self.callback)
コード例 #2
0
    def __init__(self, *args, **kwargs):
        """
    Hierarchical block for BPSK demodulation.

    The input is the complex modulated signal at baseband.
        Demodulated packets are sent to the handler.

        @param callback:  function of two args: ok, payload
        @type callback: ok: bool; payload: string
        @param threshold: detect access_code with up to threshold bits wrong (-1 -> use default)
        @type threshold: int

        See ieee802_15_4_demod for remaining parameters.
    """
        try:
            self.callback = kwargs.pop('callback')
            self.threshold = kwargs.pop('threshold')    
            #Return the demodulator
            self.demodulator = kwargs.pop('demodulator')
            self.gui = kwargs.pop('gui')
            self._samples_per_symbol = kwargs.pop('sps')
        except KeyError:
            pass
        gr.hier_block2.__init__(self, "ieee_pkt_receiver",
                        gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input
                        gr.io_signature(0, 0, 0))  # Output
        
        self._rcvd_pktq = gr.msg_queue()          # holds packets from the PHY
        
        #Create the sink of packets
        self._packet_sink = ieee.ieee802_15_4_packet_sink(self._rcvd_pktq, self.threshold)
        
        #self.complex_to_float = gr.complex_to_float(1)
        self.complex_to_real = gr.complex_to_real()
        
        self.connect(self, self.demodulator, self.complex_to_real, self._packet_sink)
      
        self._watcher = _queue_watcher_thread(self._rcvd_pktq, self.callback)