コード例 #1
0
    def __init__(self, *args, **kwargs):
        """
	Hierarchical block for O-QPSK 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')
	except KeyError:
		pass

	gr.hier_block2.__init__(self, "ieee802_15_4_demod_pkts",
				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
        self.ieee802_15_4_demod = ieee802_15_4.ieee802_15_4_demod(self, *args, **kwargs)
        self._packet_sink = ucla.ieee802_15_4_packet_sink(self._rcvd_pktq, self.threshold)

        print "GR: ieee802_15_4_pkt: Connecting demodulator and packet sink."
        self.connect(self, self.ieee802_15_4_demod, self._packet_sink)

        self._watcher = _queue_watcher_thread(self._rcvd_pktq, self.callback)
コード例 #2
0
    def __init__(self, fg, callback=None, threshold=-1, *args, **kwargs):
        """
	Hierarchical block for O-QPSK demodulation.

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

	@param fg: flow graph
	@type fg: flow graph
        @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.
	"""

        self._rcvd_pktq = gr.msg_queue()          # holds packets from the PHY
        self.ieee802_15_4_demod = ieee802_15_4.ieee802_15_4_demod(fg, *args, **kwargs)
        self._packet_sink = ucla.ieee802_15_4_packet_sink(self._rcvd_pktq, threshold)
        
        fg.connect(self.ieee802_15_4_demod, self._packet_sink)
      
        gr.hier_block.__init__(self, fg, self.ieee802_15_4_demod, None)
        self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
コード例 #3
0
    def __init__(self, *args, **kwargs):
        """
	Hierarchical block for O-QPSK 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')
            self.chan_num = kwargs.pop('channel')
        except KeyError:
            pass

        gr.hier_block2.__init__(
            self,
            "ieee802_15_4_demod_pkts",
            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
        self.ieee802_15_4_demod = ieee802_15_4.ieee802_15_4_demod(
            self, *args, **kwargs)
        self._packet_sink = ucla.ieee802_15_4_packet_sink(
            self._rcvd_pktq, self.threshold)

        self.connect(self, self.ieee802_15_4_demod, self._packet_sink)

        self._watcher = _queue_watcher_thread(self._rcvd_pktq, self.callback,
                                              self.chan_num)