Changeset 8152

Show
Ignore:
Timestamp:
08/07/08 14:51:23 (5 years ago)
Author:
mcarrick
Message:

finished editing component instructions

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • documentation/ossie/user-guide-0.7.0/OEFGuide.tex

    r8151 r8152  
    116116\end{center} 
    117117 
    118  
    119118Now the default value for the gain must be entered. Click on the clear blank text box under Default value in the Properties panel, and enter 1. 
    120119 
     
    131130\subsubsection{Generating the Source Code} 
    132131\label{section:oef:generatesourcecode} 
    133  
    134  
     132On the OEF toolbar, select OSSIE : Generate Component. This generates all of the files for the component in the local eclipse workspace directory. 
     133 
     134Generating the component will produce multiple files along with the source code. 
     135\begin{enumerate} 
     136\item {\tt configure.ac}: This is the script that autoconf uses to generate the configure file. It checks for dependencies such as which compiler to use, as well as the presence of OSSIE libraries. 
     137\item {\tt Makefile.am}: This is the script that automake uses to generate the Makefile. It includes all the source files for the component. 
     138\item {\tt reconf}: This is a script to run the automake tools. 
     139\item {\tt component\_name.h}: Component class header file. 
     140\item {\tt component\_name.cpp}: Component class implementation definition. 
     141\item {\tt main.cpp}: Contains the mandatory {\tt int main()} definition. 
     142\item {\tt component\_name.prf.xml}: Component property file. 
     143\item {\tt component\_name.scd.xml}: Software component descriptor. 
     144\item {\tt component\_name.spd.xml}: Software package descriptor. 
     145\item {\tt documentation.txt}: File for documenting your component. 
     146\item {\tt Doxyfile}: Doxygen file for generating documentation. 
     147\end{enumerate} 
     148Additional files are generated when using the {\tt pyi\_comp} option: 
     149\begin{enumerate} 
     150\item {\tt component\_name.py}: Python file with port implementations. 
     151\item {\tt WorkModule.py}: Python file where processing is done. 
     152\item {\tt setup.py}: Install script used to copy Python and XML files into the appropriate subdirectories under {\tt /sdr} once the component is edited to provide functionality. This is executed by typing {\tt python setup.py install}. 
     153\end{enumerate}  
     154 
     155At this point the signal processing or logical function of the component must be defined. The process for doing so is different depending on whether the component is written in C++ or python. 
     156 
     157\subsubsection{Editing C++ Components} 
     158\label{section:oef:editingccomponent} 
     159In this example, by selecting {\tt basic\_ports} the component was generated as a C++ component. To edit the component, open {\tt component\_name.cpp} and find the {\tt ProcessData} function. 
     160\begin{lstlisting}[] 
     161$ cd /path/to/OEF/workspace/component_name/ 
     162$ vim component_name.cpp 
     163\end{lstlisting} 
     164 
     165Within the function, there will be a {\tt while} loop and inside of it will be a line: 
     166\begin{lstlisting}[] 
     167/*insert code here to do work*/ 
     168\end{lstlisting} 
     169This is where the signal processing function should be implemented. The property that was generated, {\tt gain} will be availble in the source code initially as {\tt simplei\_0\_value}. Reassign this to a new variable named {\tt gain} in the {\tt configure} function in the same file. 
     170 
     171\subsubsection{Editing Python Components} 
     172\label{section:oef:editpythoncomponents} 
     173Generated component template code must be modified to 
     174process data. The instructions here apply to a very basic Python component with 
     175one {\it uses} and one {\it provides} port and no properties.  Property values 
     176can be used in the processing operations, but this will be the subject of a 
     177future excercise. 
     178 
     179All data coming into a {\it provides} port will be loaded into the 
     180WorkModule buffer.  The data going into this buffer will be loaded 
     181into variables called I and Q.  See the generated WorkModule.py and 
     182look for: 
     183\begin{lstlisting}[] 
     184    I = new_data[0] 
     185    Q = new_data[1] 
     186\end{lstlisting} 
     187This implies that if you try to run a component that is getting real 
     188data only, Q should be empty, and this may even cause an error.  There are 
     189comments in various parts of the python files describing how to adjust your code 
     190appropriately. 
     191 
     192The next two lines initialize two arrays to store your new data: 
     193\begin{lstlisting}[] 
     194    newI = [0 for x in range(len(I)))] 
     195    newQ = [0 for x in range(len(Q)))] 
     196\end{lstlisting} 
     197%TODO: Make listings highlighted 
     198Following these lines are comments with an example of how to 
     199process data.  If you uncomment the 3-line example, your 
     200component will pass the data received by the {\it provides} (input) port to the 
     201{\it uses} (output) port, assuming you have one {\it uses} port of type {\tt 
     202complexShort} and one {\it provides} port, also of type {\tt complexShort}. 
     203Code can be added to process the data. 
     204 
     205The next set of lines following the comment ``{\tt \# Output the new data},'' 
     206will send the {\tt newI} and {\tt newQ} vectors to all of your output ports. 
     207 
     208\subsubsection{Editing the SPD File} 
     209 
     210You will need to edit {\tt MyComponent.spd.xml} before your Python 
     211component will work properly.  Find the XML tag below the tag {\tt <code 
     212type="'Executable"'>}. By default the next tag is: 
     213\begin{lstlisting}[] 
     214 <localfile name="'bin/MyComponent"'/>} 
     215\end{lstlisting} 
     216This needs to be changed to: 
     217\begin{lstlisting}[] 
     218 <localfile name="'bin/MyComponent/MyComponent.py"'/> 
     219\end{lstlisting} 
     220 
     221\subsubsection{Making Sure Files are Executable} 
     222 
     223After you have installed the component (see below), you will need to make sure 
     224that you have permission to execute the Python files.  To do this, navigate to 
     225{\tt /sdr/bin/MyComponent} and type: 
     226\begin{lstlisting}[] 
     227 $ chmod +x *.py 
     228\end{lstlisting} 
     229 
     230\subsubsection{Installing a Component} 
     231\label{section:oef:installcomponent} 
     232After the component has been edited, it must be compiled and installed to {\tt /sdr}. To do this, move into the component's workspace directory and run the automake tools. 
     233\begin{lstlisting}[] 
     234$ cd /path/to/eclipse/workspace/component_name/ 
     235$ ./reconf 
     236$ ./configure 
     237$ make 
     238$ make install 
     239\end{lstlisting}  
     240 
     241If the commands execute successfully, the component will be installed to {\tt /sdr} and it will be possible to use the component in a waveform. Start a new waveform in OEF to verify that the component has been installed correctly. 
    135242 
    136243\subsection{Additional OEF Instruction}