Advertisement
duggabe

str_pkt_3.grc

Mar 16th, 2023
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.31 KB | None | 0 0
  1. options:
  2. parameters:
  3. author: Barry Duggan
  4. catch_exceptions: 'True'
  5. category: '[GRC Hier Blocks]'
  6. cmake_opt: ''
  7. comment: ''
  8. copyright: ''
  9. description: Packet test
  10. gen_cmake: 'On'
  11. gen_linking: dynamic
  12. generate_options: qt_gui
  13. hier_block_src_path: '.:'
  14. id: str_pkt_3
  15. max_nouts: '0'
  16. output_language: python
  17. placement: (0,0)
  18. qt_qss_theme: ''
  19. realtime_scheduling: ''
  20. run: 'True'
  21. run_command: '{python} -u {filename}'
  22. run_options: prompt
  23. sizing_mode: fixed
  24. thread_safe_setters: ''
  25. title: str_pkt_3
  26. window_size: (1000,1000)
  27. states:
  28. bus_sink: false
  29. bus_source: false
  30. bus_structure: null
  31. coordinate: [16, 12.0]
  32. rotation: 0
  33. state: enabled
  34.  
  35. blocks:
  36. - name: samp_rate
  37. id: variable
  38. parameters:
  39. comment: ''
  40. value: '32000'
  41. states:
  42. bus_sink: false
  43. bus_source: false
  44. bus_structure: null
  45. coordinate: [200, 12.0]
  46. rotation: 0
  47. state: enabled
  48. - name: blocks_message_debug_1
  49. id: blocks_message_debug
  50. parameters:
  51. affinity: ''
  52. alias: ''
  53. comment: ''
  54. en_uvec: 'True'
  55. states:
  56. bus_sink: false
  57. bus_source: false
  58. bus_structure: null
  59. coordinate: [1016, 224.0]
  60. rotation: 0
  61. state: enabled
  62. - name: blocks_null_sink_0
  63. id: blocks_null_sink
  64. parameters:
  65. affinity: ''
  66. alias: ''
  67. bus_structure_sink: '[[0,],]'
  68. comment: ''
  69. num_inputs: '1'
  70. type: byte
  71. vlen: '1'
  72. states:
  73. bus_sink: false
  74. bus_source: false
  75. bus_structure: null
  76. coordinate: [720, 288.0]
  77. rotation: 0
  78. state: disabled
  79. - name: blocks_tag_debug_0
  80. id: blocks_tag_debug
  81. parameters:
  82. affinity: ''
  83. alias: ''
  84. comment: ''
  85. display: 'True'
  86. filter: '""'
  87. name: ''
  88. num_inputs: '1'
  89. type: byte
  90. vlen: '1'
  91. states:
  92. bus_sink: false
  93. bus_source: false
  94. bus_structure: null
  95. coordinate: [552, 292.0]
  96. rotation: 0
  97. state: disabled
  98. - name: blocks_throttle_0
  99. id: blocks_throttle
  100. parameters:
  101. affinity: ''
  102. alias: ''
  103. comment: ''
  104. ignoretag: 'True'
  105. maxoutbuf: '0'
  106. minoutbuf: '0'
  107. samples_per_second: samp_rate
  108. type: byte
  109. vlen: '1'
  110. states:
  111. bus_sink: false
  112. bus_source: false
  113. bus_structure: null
  114. coordinate: [520, 220.0]
  115. rotation: 0
  116. state: true
  117. - name: epy_block_0
  118. id: epy_block
  119. parameters:
  120. _source_code: "\"\"\"\nEmbedded Python Block: File Source to Tagged Stream\n\"\
  121. \"\"\n\nimport numpy as np\nfrom gnuradio import gr\nimport pmt\nimport os.path\n\
  122. import sys\n\nclass blk(gr.sync_block):\n def __init__(self):\n gr.sync_block.__init__(\n\
  123. \ self,\n name='EPB: File Source to Tagged Stream',\n\
  124. \ in_sig=None,\n out_sig=[np.uint8])\n\n global\
  125. \ _eof\n global indx\n _eof = False\n indx = 0\n \
  126. \ fn = \"/home/barry/Documents/Gettysburg.txt\"\n if (os.path.exists(fn)):\n\
  127. \ # open input file\n global f_in\n f_in =\
  128. \ open (fn, 'rb')\n else:\n print('The input file does not\
  129. \ exist')\n _eof = True\n\n def work(self, input_items, output_items):\n\
  130. \ global _eof\n global indx\n global f_in\n Pkt_len\
  131. \ = 252\n # print(type(output_items[0][0]))\n while (not (_eof)):\n\
  132. \ buff = f_in.read (Pkt_len)\n b_len = len(buff)\n \
  133. \ if b_len == 0:\n print ('End of file')\n \
  134. \ _eof = True\n f_in.close()\n break\n \
  135. \ key0 = pmt.intern(\"packet_len\")\n val0 = pmt.from_long(b_len)\n\
  136. \ self.add_item_tag(0, # Write to output port 0\n \
  137. \ indx, # Index of the tag\n key0, # Key of the tag\n \
  138. \ val0 # Value of the tag\n )\n # print\
  139. \ (indx, b_len)\n indx += b_len\n i = 0\n while\
  140. \ (i < b_len):\n output_items[0][i] = buff[i]\n \
  141. \ i += 1\n return (b_len)\n\n"
  142. affinity: ''
  143. alias: ''
  144. comment: ''
  145. maxoutbuf: '0'
  146. minoutbuf: '0'
  147. states:
  148. _io_cache: '(''EPB: File Source to Tagged Stream'', ''blk'', [], [], [(''0'',
  149. ''byte'', 1)], '''', [])'
  150. bus_sink: false
  151. bus_source: false
  152. bus_structure: null
  153. coordinate: [224, 224.0]
  154. rotation: 0
  155. state: true
  156. - name: pdu_tagged_stream_to_pdu_0
  157. id: pdu_tagged_stream_to_pdu
  158. parameters:
  159. affinity: ''
  160. alias: ''
  161. comment: ''
  162. maxoutbuf: '0'
  163. minoutbuf: '0'
  164. tag: packet_len
  165. type: byte
  166. states:
  167. bus_sink: false
  168. bus_source: false
  169. bus_structure: null
  170. coordinate: [720, 220.0]
  171. rotation: 0
  172. state: enabled
  173.  
  174. connections:
  175. - [blocks_throttle_0, '0', blocks_null_sink_0, '0']
  176. - [blocks_throttle_0, '0', pdu_tagged_stream_to_pdu_0, '0']
  177. - [epy_block_0, '0', blocks_tag_debug_0, '0']
  178. - [epy_block_0, '0', blocks_throttle_0, '0']
  179. - [pdu_tagged_stream_to_pdu_0, pdus, blocks_message_debug_1, print]
  180.  
  181. metadata:
  182. file_format: 1
  183. grc_version: 3.10.5.1
  184.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement