Changeset 2425

Show
Ignore:
Timestamp:
12/20/06 11:29:50 (6 years ago)
Author:
balister
Message:

Builds without any signal processing.

Location:
components/EnergyMeasure/trunk/EnergyMeasure
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • components/EnergyMeasure/trunk/EnergyMeasure/EnergyMeasure.cpp

    r2420 r2425  
    2424#include <string> 
    2525#include <iostream> 
     26 
    2627#include "EnergyMeasure.h" 
    2728 
     
    3132 
    3233 
    33     processing_thread = new omni_thread(process_data, (void *) this);   //Create the thread for the writer's processing function  
     34    processing_thread = new omni_thread(run_process_data, (void *) this);   //Create the thread for the writer's processing function  
    3435    processing_thread->start();    //Start the thread containing the writer's processing function  
    3536 
     
    8485    std::cout << "props length : " << props.length() << std::endl; 
    8586 
    86     for (unsigned int i = 0; i <props.length(); i++) 
    87     { 
     87    for (unsigned int i = 0; i <props.length(); i++) { 
    8888        std::cout << "Property id : " << props[i].id << std::endl; 
    8989 
    90         if (strcmp(props[i].id, "DCE:2a20d289-f84a-4acd-bf5b-449c30e72949") == 0) 
    91         { 
    92             CORBA::unsupported_type simple_temp; 
    93             props[i].value >>= simple_temp; 
    94             simple_0_value = simple_temp; 
     90        // outputFileName, string - If set, write output to the file with the name passed in the property 
     91        if (strcmp(props[i].id, "DCE:2a20d289-f84a-4acd-bf5b-449c30e72949") == 0) { 
     92            const char *str; 
     93            props[i].value >>= str; 
     94 
     95            fileName = str; 
     96            std::cout << "EnergyMeasure: Output file name is: " << fileName << std::endl; 
    9597        } 
    96  
    97         if (strcmp(props[i].id, "DCE:2a32bbe6-c43f-44f6-b553-b51c95f40e33") == 0) 
    98         { 
    99             CORBA::unsupported_type simple_temp; 
    100             props[i].value >>= simple_temp; 
    101             simple_1_value = simple_temp; 
     98         
     99        // display, boolean - If true print the per packet energy to the console 
     100        if (strcmp(props[i].id, "DCE:2a32bbe6-c43f-44f6-b553-b51c95f40e33") == 0) { 
     101            CORBA::Boolean b; 
     102            props[i].value >>= b; 
     103            printEnergy = b; 
    102104        } 
    103105 
     
    105107} 
    106108 
    107 void process_data(void *data) 
     109void EnergyMeasure_i::process_data() 
    108110{ 
    109111    std::cout << "EnergyMeasure's process_data thread started" << std::endl; 
    110  
    111     EnergyMeasure_i *Class_instance_name = (EnergyMeasure_i *) data;  //Change Class_instance_name here i.e. to Tx, Rx, Channel, Modulator... 
    112      
    113  
    114112 
    115113    PortTypes::ShortSequence *I_in_0(NULL), *Q_in_0(NULL); 
     
    118116    while(1) 
    119117    { 
    120         Class_instance_name->dataIn_0->getData(I_in_0, Q_in_0); 
     118        dataIn_0->getData(I_in_0, Q_in_0); 
    121119 
    122120        I_in_0_length = I_in_0->length(); 
     
    130128 
    131129 
    132         Class_instance_name->dataIn_0->bufferEmptied(); 
     130        dataIn_0->bufferEmptied(); 
    133131    } 
    134132} 
  • components/EnergyMeasure/trunk/EnergyMeasure/EnergyMeasure.h

    r2420 r2425  
    2525#define ENERGYMEASURE_IMPL_H 
    2626 
     27#include <string> 
     28 
    2729#include <stdlib.h> 
     30 
    2831#include "ossie/cf.h" 
    2932 
    3033 
    3134#include "ossie/PortTypes.h" 
     35 
    3236#include "standardinterfaces/complexShort.h" 
    3337#include "standardinterfaces/complexShort_p.h" 
    3438 
    3539#include "ossie/Resource_impl.h" 
     40 
    3641class EnergyMeasure_i; 
    37  
    38 void process_data(void *data); 
    3942 
    4043class EnergyMeasure_i : public virtual Resource_impl 
    4144{ 
    42  
    43     friend void process_data(void *data); 
    44  
    4545    public: 
    4646        EnergyMeasure_i(const char *uuid, omni_condition *sem); 
    4747        ~EnergyMeasure_i(void); 
     48 
     49        static void run_process_data(void *data) { ((EnergyMeasure_i *)data)->process_data();}; 
    4850 
    4951        void start() throw (CF::Resource::StartError, CORBA::SystemException); 
     
    6264        EnergyMeasure_i(EnergyMeasure_i&); 
    6365    
     66        void process_data(); 
     67 
    6468        omni_condition *component_running;  //for component shutdown 
    6569        omni_thread *processing_thread;     //for component writer function 
    6670         
    67         CORBA::String simple_0_value; 
    68         CORBA::Boolean simple_1_value; 
     71        std::string fileName; 
     72        bool printEnergy; 
    6973 
    7074