Advertisement
lukinma

basic block

Feb 3rd, 2015
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. from gnuradio import gr
  2. import numpy
  3.  
  4.  
  5. class stream_crc(gr.basic_block):
  6.     " Stream CRC"
  7.  
  8.     def __init__(self, packetLength, lengthTagKey):
  9.         gr.basic_block.__init__(
  10.             self,
  11.             name="stream_crc",
  12.             in_sig=[numpy.byte],
  13.             out_sig=[numpy.byte]
  14.         )
  15.         self.packetLength = packetLength
  16.  
  17.     def general_work(self, input_items, output_items):
  18.         print 'general_work'
  19.         print input_items
  20.  
  21.         output_items[0] = input_items[0]
  22.         print '>>', type(output_items[0]), type(input_items[0])
  23.         print 'len(output_items[0]) = '+str(len(output_items[0]))+' len(input_items[0]) = '+str(len(input_items[0]))
  24.         print "output: ", output_items
  25.         print output_items
  26.         print '#######'
  27.         return len(output_items[0])
  28.  
  29.  
  30.  
  31.  
  32.     def forecast(self, noutput_items, ninput_items_required):
  33.         """
  34.        forecast is only called from a general block
  35.        this is the default implementation
  36.        """
  37.         ninput_items_required[0] = noutput_items
  38.         print "Forecast:\n noutput_items: "
  39.         print noutput_items
  40.         print "ninput_items_required: "
  41.         print ninput_items_required[0]
  42.  
  43.         return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement