// MyComponent.h #include "standardinterfaces/complexShort_u.h" #include "standardinterfaces/realChar_p.h" class MyComponent_i : public virtual Resource_impl { public: // ... private: // list components provides and uses ports standardInterfaces_i::realChar_p *bitsInPort; standardInterfaces_i::complexShort_u *symbolsOutPort; standardInterfaces::MetaData *metadata; };
And here is an example of the resulting source file
// MyComponent.cpp // Constructor MyComponent_i::MyComponent_i() { // Create the ports bitsInPort = new standardInterfaces_i::realChar_p("bitsIn"); symbolsOutPort = new standardInterfaces_i::complexShort_u("symbolsOut"); } // Worker method void MyComponent_i::ProcessData() { PortTypes::CharSequence * bits_in; PortTypes::ShortSequence I_out, Q_out; while (continue_processing) { // Get data from port bitsInPort->getData(bits_in, metadata); // Process data here... unsigned int N = bits_in->length(); I_out.length(N); Q_out.length(N); for (unsigned int i=0; i<N; i++) { I_out[i] = (*bits_in)[i]; Q_out[i] = 0; } // Release input port bitsInPort->bufferEmptied(); // Push output data symbolsOutPort->(I_out, Q_out, *metadata); }
Note that the MetaData object is optional. If the component does not use the MetaData interface the components would invoke the pushPacket() and getData() methods without the last argument. The figure below depicts the flow of data through the ports between components.
complexShort interface with MetaData
| Name | Description | Type/Range |
mod_scheme | Scheme used to modulate the data | UNKNOWN, PSK, DPSK, PAM, FSK, QAM |
M | Number of symbols in mod_scheme constellation | unsigned long int |
sampling_frequency | Frequency (Hz) at which the data are sampled | float |
carrier_frequency | Frequency (Hz) for which the signal is modulated | float |
signal_bandwidth | Bandwidth (Hz) of the signal | float |
signal_strength | Nominal strength of signal (dB) | float |
eom | End-of-message flag | boolean |
$ ./reconf $ ./configure $ make # make install
If installing the libraries for the first time you will also need to link the libraries by running the following command with root permissions
# /sbin/ldconfig
1.5.4