Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- parameters:
- author: Barry Duggan
- catch_exceptions: 'True'
- category: '[GRC Hier Blocks]'
- cmake_opt: ''
- comment: ''
- copyright: ''
- description: Packet test
- gen_cmake: 'On'
- gen_linking: dynamic
- generate_options: qt_gui
- hier_block_src_path: '.:'
- id: str_pkt_3
- max_nouts: '0'
- output_language: python
- placement: (0,0)
- qt_qss_theme: ''
- realtime_scheduling: ''
- run: 'True'
- run_command: '{python} -u {filename}'
- run_options: prompt
- sizing_mode: fixed
- thread_safe_setters: ''
- title: str_pkt_3
- window_size: (1000,1000)
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [16, 12.0]
- rotation: 0
- state: enabled
- blocks:
- - name: samp_rate
- id: variable
- parameters:
- comment: ''
- value: '32000'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [200, 12.0]
- rotation: 0
- state: enabled
- - name: blocks_message_debug_1
- id: blocks_message_debug
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- en_uvec: 'True'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1016, 224.0]
- rotation: 0
- state: enabled
- - name: blocks_null_sink_0
- id: blocks_null_sink
- parameters:
- affinity: ''
- alias: ''
- bus_structure_sink: '[[0,],]'
- comment: ''
- num_inputs: '1'
- type: byte
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [720, 288.0]
- rotation: 0
- state: disabled
- - name: blocks_tag_debug_0
- id: blocks_tag_debug
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- display: 'True'
- filter: '""'
- name: ''
- num_inputs: '1'
- type: byte
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [552, 292.0]
- rotation: 0
- state: disabled
- - name: blocks_throttle_0
- id: blocks_throttle
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- ignoretag: 'True'
- maxoutbuf: '0'
- minoutbuf: '0'
- samples_per_second: samp_rate
- type: byte
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [520, 220.0]
- rotation: 0
- state: true
- - name: epy_block_0
- id: epy_block
- parameters:
- _source_code: "\"\"\"\nEmbedded Python Block: File Source to Tagged Stream\n\"\
- \"\"\n\nimport numpy as np\nfrom gnuradio import gr\nimport pmt\nimport os.path\n\
- import sys\n\nclass blk(gr.sync_block):\n def __init__(self):\n gr.sync_block.__init__(\n\
- \ self,\n name='EPB: File Source to Tagged Stream',\n\
- \ in_sig=None,\n out_sig=[np.uint8])\n\n global\
- \ _eof\n global indx\n _eof = False\n indx = 0\n \
- \ fn = \"/home/barry/Documents/Gettysburg.txt\"\n if (os.path.exists(fn)):\n\
- \ # open input file\n global f_in\n f_in =\
- \ open (fn, 'rb')\n else:\n print('The input file does not\
- \ exist')\n _eof = True\n\n def work(self, input_items, output_items):\n\
- \ global _eof\n global indx\n global f_in\n Pkt_len\
- \ = 252\n # print(type(output_items[0][0]))\n while (not (_eof)):\n\
- \ buff = f_in.read (Pkt_len)\n b_len = len(buff)\n \
- \ if b_len == 0:\n print ('End of file')\n \
- \ _eof = True\n f_in.close()\n break\n \
- \ key0 = pmt.intern(\"packet_len\")\n val0 = pmt.from_long(b_len)\n\
- \ self.add_item_tag(0, # Write to output port 0\n \
- \ indx, # Index of the tag\n key0, # Key of the tag\n \
- \ val0 # Value of the tag\n )\n # print\
- \ (indx, b_len)\n indx += b_len\n i = 0\n while\
- \ (i < b_len):\n output_items[0][i] = buff[i]\n \
- \ i += 1\n return (b_len)\n\n"
- affinity: ''
- alias: ''
- comment: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- states:
- _io_cache: '(''EPB: File Source to Tagged Stream'', ''blk'', [], [], [(''0'',
- ''byte'', 1)], '''', [])'
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [224, 224.0]
- rotation: 0
- state: true
- - name: pdu_tagged_stream_to_pdu_0
- id: pdu_tagged_stream_to_pdu
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- tag: packet_len
- type: byte
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [720, 220.0]
- rotation: 0
- state: enabled
- connections:
- - [blocks_throttle_0, '0', blocks_null_sink_0, '0']
- - [blocks_throttle_0, '0', pdu_tagged_stream_to_pdu_0, '0']
- - [epy_block_0, '0', blocks_tag_debug_0, '0']
- - [epy_block_0, '0', blocks_throttle_0, '0']
- - [pdu_tagged_stream_to_pdu_0, pdus, blocks_message_debug_1, print]
- metadata:
- file_format: 1
- grc_version: 3.10.5.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement