root/ossiedev/branches/hvolos/components/MIMODec/MIMODec.cpp @ 9338

Revision 9338, 3.4 KB (checked in by hvolos, 4 years ago)

Initial checking of MIMO components

Line 
1/****************************************************************************
2
3Copyright 2009 by your_name_or_organization, all rights reserved.
4
5****************************************************************************/
6
7
8#include <string>
9#include <iostream>
10#include "MIMODec.h"
11
12MIMODec_i::MIMODec_i(const char *uuid, omni_condition *condition) :
13    Resource_impl(uuid), component_running(condition)
14{
15    dataOut_0 = new standardInterfaces_i::complexShort_u("Symbols_OUT");
16    dataIn_0 = new standardInterfaces_i::complexShort_p("MUX_MIMO_Symbols_IN");
17
18    //Create the thread for the writer's processing function
19    processing_thread = new omni_thread(Run, (void *) this);
20
21    //Start the thread containing the writer's processing function
22    processing_thread->start();
23
24}
25
26MIMODec_i::~MIMODec_i(void)
27{   
28    delete dataOut_0;
29    delete dataIn_0;
30}
31
32// Static function for omni thread
33void MIMODec_i::Run( void * data )
34{
35    ((MIMODec_i*)data)->ProcessData();
36}
37
38CORBA::Object_ptr MIMODec_i::getPort( const char* portName ) throw (
39    CORBA::SystemException, CF::PortSupplier::UnknownPort)
40{
41    DEBUG(3, MIMODec, "getPort() invoked with " << portName)
42   
43    CORBA::Object_var p;
44
45    p = dataOut_0->getPort(portName);
46
47    if (!CORBA::is_nil(p))
48        return p._retn();
49
50    p = dataIn_0->getPort(portName);
51
52    if (!CORBA::is_nil(p))
53        return p._retn();
54
55    /*exception*/
56    throw CF::PortSupplier::UnknownPort();
57}
58
59void MIMODec_i::start() throw (CORBA::SystemException,
60    CF::Resource::StartError)
61{
62    DEBUG(3, MIMODec, "start() invoked")
63}
64
65void MIMODec_i::stop() throw (CORBA::SystemException, CF::Resource::StopError)
66
67    DEBUG(3, MIMODec, "stop() invoked")
68}
69
70void MIMODec_i::releaseObject() throw (CORBA::SystemException,
71    CF::LifeCycle::ReleaseError)
72{
73    DEBUG(3, MIMODec, "releaseObject() invoked")
74   
75    component_running->signal();
76}
77
78void MIMODec_i::initialize() throw (CF::LifeCycle::InitializeError,
79    CORBA::SystemException)
80{
81    DEBUG(3, MIMODec, "initialize() invoked")
82}
83
84void MIMODec_i::configure(const CF::Properties& props)
85throw (CORBA::SystemException,
86    CF::PropertySet::InvalidConfiguration,
87    CF::PropertySet::PartialConfiguration)
88{
89    DEBUG(3, MIMODec, "configure() invoked")
90   
91    std::cout << "props length : " << props.length() << std::endl;
92
93    for (unsigned int i = 0; i <props.length(); i++)
94    {
95        std::cout << "Property id : " << props[i].id << std::endl;
96
97        if (strcmp(props[i].id, "DCE:4c5f385e-3b3e-11de-b7e0-0000e80014f9") == 0)
98        {
99            CORBA::Short simple_temp;
100            props[i].value >>= simple_temp;
101            simple_0_value = simple_temp;
102        }
103
104        if (strcmp(props[i].id, "DCE:74a38a7c-3b3e-11de-b7e0-0000e80014f9") == 0)
105        {
106}
107
108void MIMODec_i::ProcessData()
109{
110    DEBUG(3, MIMODec, "ProcessData() invoked")
111
112    PortTypes::ShortSequence I_out_0, Q_out_0;
113
114
115    PortTypes::ShortSequence *I_in_0(NULL), *Q_in_0(NULL);
116    CORBA::UShort I_in_0_length, Q_in_0_length;
117
118    while(1)
119    {
120        dataIn_0->getData(I_in_0, Q_in_0);
121
122        I_in_0_length = I_in_0->length();
123        Q_in_0_length = Q_in_0->length();
124
125        I_out_0.length(); //must define length of output
126        Q_out_0.length(); //must define length of output
127
128        /*insert code here to do work*/
129
130
131
132
133
134
135        dataIn_0->bufferEmptied();
136        dataOut_0->pushPacket(I_out_0, Q_out_0);
137    }
138}
139
140
Note: See TracBrowser for help on using the browser.