Editing Guided Tutorial GNU Radio in C++

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 449: Line 449:
 
In GNU Radio 3.7 the .xml provides the user interface between the OOT module displayed in the GRC and the source code. For GNU Radio 3.8 and newer, see the next section which describes the YAML format. Moreover, the XML file defines an interface to pass the parameters specific for the module. Hence, to access the module inside GRC, it is important to modify the .xml files manually. The XML file for our block is named as <code>demod_my_qpsk_demod_cb.xml</code> inside the <code>grc/</code> folder. Presently, the <code>gr_modtool</code>'s version looks like:
 
In GNU Radio 3.7 the .xml provides the user interface between the OOT module displayed in the GRC and the source code. For GNU Radio 3.8 and newer, see the next section which describes the YAML format. Moreover, the XML file defines an interface to pass the parameters specific for the module. Hence, to access the module inside GRC, it is important to modify the .xml files manually. The XML file for our block is named as <code>demod_my_qpsk_demod_cb.xml</code> inside the <code>grc/</code> folder. Presently, the <code>gr_modtool</code>'s version looks like:
  
Default version:
+
{{collapse(Default version:)
 +
 
 
<pre>
 
<pre>
<?xml version="1.0"?>
 
<block>
 
  <name>my_qpsk_demod_cb</name>
 
  <key>tutorial_my_qpsk_demod_cb</key>
 
  <category>tutorial</category>
 
  <import>import tutorial</import>
 
  <make>tutorial.my_qpsk_demod_cb($gray_code)</make>
 
  <!-- Make one 'param' node for every Parameter you want settable from the GUI.
 
      Sub-nodes:
 
      * name
 
      * key (makes the value accessible as $keyname, e.g. in the make node)
 
      * type -->
 
  <param>
 
    <name>...</name>
 
    <key>...</key>
 
    <type>...</type>
 
  </param>
 
  
   <!-- Make one 'sink' node per input. Sub-nodes:
+
   my_qpsk_demod_cb
      * name (an identifier for the GUI)
+
  tutorial_my_qpsk_demod_cb
      * type
+
  tutorial
      * vlen
+
  import tutorial
      * optional (set to 1 for optional inputs) -->
+
  tutorial.my_qpsk_demod_cb($gray_code)
   <sink>
+
    
     <name>in</name>
+
 
     <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+
     ...
   </sink>
+
     ...
 +
    ...
 +
    
  
   <!-- Make one 'source' node per output. Sub-nodes:
+
    
      * name (an identifier for the GUI)
+
    
      * type
+
     in
      * vlen
+
      
      * optional (set to 1 for optional inputs) -->
+
    
   <source>
 
     <name>out</name>
 
     <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
 
   </source>
 
</block>
 
  
 +
 
 +
 
 +
    out
 +
   
 +
 
 
</pre>
 
</pre>
 
+
}}
  
 
The parameter <code>gray_code</code> can be put under the <code><parameter></code> tag.
 
The parameter <code>gray_code</code> can be put under the <code><parameter></code> tag.
  
Adding parameter tag:
+
{{collapse(Adding parameter tag:)
  
 
<pre>
 
<pre>
   <?xml version="1.0"?>
+
    
  <param>
+
     Gray Code
     <name>Gray Code</name>
+
     gray_code
     <key>gray_code</key>
+
     True
     <value>True</value>
+
     bool
     <type>bool</type>
+
      
     <option>
+
       Yes
       <name>Yes</name>
+
       True
       <key>True</key>
+
      
     </option>
+
      
     <option>
+
       No
       <name>No</name>
+
       False
       <key>False</key>
+
      
     </option>
 
  </param> 
 
 
   </pre>
 
   </pre>
 
+
}}
  
 
Like the work function, the datatypes for the input and output ports represented by <code><sink></code> and <code><nowiki><source></nowiki></code> tags should be modified.
 
Like the work function, the datatypes for the input and output ports represented by <code><sink></code> and <code><nowiki><source></nowiki></code> tags should be modified.
  
Modifying source and sink tag:
+
{{collapse(Modifying source and sink tag:)
  
 
<pre>   
 
<pre>   
<sink>
+
     in
     <name>in</name>
+
     complex
     <type>complex</type>
 
  </sink>
 
 
   </pre>
 
   </pre>
 
<pre>   
 
<pre>   
<source>
+
     out
     <name>out</name>
+
     byte
     <type>byte</type>
 
  </source>
 
 
   </pre>
 
   </pre>
  
Line 536: Line 516:
 
After all the necessary modification the "tutorial_my_qpsk_demod_cb.xml" looks like this:
 
After all the necessary modification the "tutorial_my_qpsk_demod_cb.xml" looks like this:
  
Modified version:
+
{{collapse(Modified version:)
  
 
<pre>
 
<pre>
<?xml version="1.0"?>
 
<block>
 
  <name>My QPSK Demodulator</name>
 
  <key>tutorial_my_qpsk_demod_cb</key>
 
  <category>tutorial</category>
 
  <import>import tutorial</import>
 
  <make>tutorial.my_qpsk_demod_cb($gray_code)</make>
 
  <param>
 
    <name>Gray Code</name>
 
    <key>gray_code</key>
 
    <value>True</value>
 
    <type>bool</type>
 
    <option>
 
      <name>Yes</name>
 
      <key>True</key>
 
    </option>
 
    <option>
 
      <name>No</name>
 
      <key>False</key>
 
    </option>
 
  </param>
 
  <sink>
 
    <name>in</name>
 
    <type>complex</type>
 
  </sink>
 
  <source>
 
    <name>out</name>
 
    <type>byte</type>
 
  </source>
 
</block>
 
  
 +
  My QPSK Demodulator
 +
  tutorial_my_qpsk_demod_cb
 +
  tutorial
 +
  import tutorial
 +
  tutorial.my_qpsk_demod_cb($gray_code)
 +
 
 +
    Gray Code
 +
    gray_code
 +
    True
 +
    bool
 +
   
 +
      Yes
 +
      True
 +
   
 +
   
 +
      No
 +
      False
 +
   
 +
 
 +
 
 +
    in
 +
    complex
 +
 
 +
 
 +
    out
 +
    byte
 +
 
 
</pre>
 
</pre>
 +
}}
  
 
== Step 4 bis: Flesh out the YAML file ==
 
== Step 4 bis: Flesh out the YAML file ==

Please note that all contributions to GNU Radio are considered to be released under the Creative Commons Attribution-ShareAlike (see GNU Radio:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)