예제 #1
0
파일: events.cpp 프로젝트: t-b/tango-doc
void MyClass::read_attr(Tango::Attribute &attr)
{
    ...
    ...
    
    
    if (attr_name == "Sinusoide")
    {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        sinusoide = 100 * sin( 2 * 3.14 * frequency * tv.tv_sec);
        attr.set_value(&sinusoide);
	
	if (sinusoide >= 0)              
        {
            vector<string> filterable_names;
            vector<double> filterable_value;
   
            filterable_names.push_back("value");
            filterable_value.push_back((double)sinusoide);
           
            push_event( filterable_names,
                        filterable_value,
                        attr);
			
            attr.set_value(&sinusoide);
	    
        }
      
    }
    
    ....
    ....
    
}
예제 #2
0
파일: Attr.cpp 프로젝트: t-b/tango-doc
void DocDs::read_attr(Tango::Attribute &attr)
{
	string &attr_name = attr.get_name();

	cout << "In read_attr for attribute " << attr_name << endl;

	//	Switch on attribute name
	//---------------------------------
	if (attr_name == "LongRdAttr")
	{
		//	Add your own code here
      		attr.set_value(&attr_rd);
	}
	if (attr_name == "LongWrAttr")
	{
		//	Add your own code here
		attr.set_value(&attr_wr);
	}
	if (attr_name == "StrAttr")
	{
		//	Add your own code here
      		attr_str_array[0] = CORBA::string_dup("Rock");
      		attr_str_array[1] = CORBA::string_dup("Samba");
      
      		attr.set_value(attr_str_array, 2);
	}
}
예제 #3
0
//+----------------------------------------------------------------------------
//
// method :         SimulatorCCD::read_exposureTime
//
// description :     Extract real attribute values for exposureTime acquisition result.
//
//-----------------------------------------------------------------------------
void SimulatorCCD::read_exposureTime(Tango::Attribute &attr)
{
    DEBUG_STREAM << "SimulatorCCD::read_exposureTime(Tango::Attribute &attr) entering... "<< endl;
    if(m_ct!=0)
    {
        try
        {
            double exposure;
            m_ct->acquisition()->getAcqExpoTime(exposure);
            *attr_exposureTime_read = (Tango::DevDouble)(exposure*1000.0);
            attr.set_value(attr_exposureTime_read);
        }
        catch(Tango::DevFailed& df)
        {
            ERROR_STREAM << df << endl;
            //- rethrow exception
            Tango::Except::re_throw_exception(df,
                        static_cast<const char*> ("TANGO_DEVICE_ERROR"),
                        static_cast<const char*> (string(df.errors[0].desc).c_str()),
                        static_cast<const char*> ("SimulatorCCD::read_exposureTime"));
        }
        catch(Exception& e)
        {
            ERROR_STREAM << e.getErrMsg() << endl;
            //- throw exception
            Tango::Except::throw_exception(
                        static_cast<const char*> ("TANGO_DEVICE_ERROR"),
                        static_cast<const char*> (e.getErrMsg().c_str()),
                        static_cast<const char*> ("SimulatorCCD::read_exposureTime"));
        }
    }
	DEBUG_STREAM << "SimulatorCCD::read_exposureTime() ending... "<< endl;		
}
예제 #4
0
 void GrabberAttrT<std::string>::read(Tango::DeviceImpl* dev, Tango::Attribute &att)
 {
   //- retrieve the value from the plugin :
   try
   {
     this->callbacks_[dev].info.get_cb( this->callbacks_[dev].read_value );
     if (this->callbacks_[dev].read_value.empty())
       THROW_DEVFAILED("NO_VALUE",
                       "No value has been assigned to the container",
                       "PlugInAttr<std::string>::read");
     this->callbacks_[dev].read_ptr = const_cast<char*>( (yat::any_cast<std::string>(&this->callbacks_[dev].read_value))->c_str() );
     att.set_value( &this->callbacks_[dev].read_ptr );
   }
   catch( yat::Exception& ex )
   {
     yat4tango::YATDevFailed df(ex);
     RETHROW_DEVFAILED(df,
                       "SOFTWARE_FAILURE",
                       "Error while reading a plugin attribute",
                       "PlugInAttr<std::string>::read");
   }
   catch( ... )
   {
     THROW_DEVFAILED("UNKNWON_ERROR",
                     "Unknwon error while reading a plugin attribute",
                     "PlugInAttr<std::string>::read");
   }
 }
예제 #5
0
//+----------------------------------------------------------------------------
//
// method : 		UviewCCD::read_ivsTRoi4
// 
// description : 	Extract real attribute values for ivsTRoi4 acquisition result.
//
//-----------------------------------------------------------------------------
void UviewCCD::read_ivsTRoi4(Tango::Attribute &attr)
{
	DEBUG_STREAM << "UviewCCD::read_ivsTRoi4(Tango::Attribute &attr) entering... "<< endl;
    
    if (!m_roi4Enable)
       *attr_ivsTRoi4_read = yat::IEEE_NAN;

    attr.set_value(attr_ivsTRoi4_read);
}
예제 #6
0
//--------------------------------------------------------
void MyFirstDS::read_MyAttr(Tango::Attribute &attr)
{
	DEBUG_STREAM << "MyFirstDS::read_MyAttr(Tango::Attribute &attr) entering... " << endl;
	/*----- PROTECTED REGION ID(MyFirstDS::read_MyAttr) ENABLED START -----*/
	//	Set the attribute value
	attr.set_value(attr_MyAttr_read);
	
	/*----- PROTECTED REGION END -----*/	//	MyFirstDS::read_MyAttr
}
예제 #7
0
//--------------------------------------------------------
void StateScanner::read_Spectrum(Tango::Attribute &attr)
{
	DEBUG_STREAM << "StateScanner::read_Spectrum(Tango::Attribute &attr) entering... " << endl;
	/*----- PROTECTED REGION ID(StateScanner::read_Spectrum) ENABLED START -----*/
	machine_->update_spectrum(attr_Spectrum_read, 2048);
	//	Set the attribute value
	attr.set_value(attr_Spectrum_read, 2048);

	/*----- PROTECTED REGION END -----*/	//	StateScanner::read_Spectrum
}
예제 #8
0
//--------------------------------------------------------
void StateScanner::read_Sensor(Tango::Attribute &attr)
{
	DEBUG_STREAM << "StateScanner::read_Sensor(Tango::Attribute &attr) entering... " << endl;
	/*----- PROTECTED REGION ID(StateScanner::read_Sensor) ENABLED START -----*/
	pData d = machine_->data();
	attr_Sensor_read[0] = d->name_sensor;
	//	Set the attribute value
	attr.set_value(attr_Sensor_read);

	/*----- PROTECTED REGION END -----*/	//	StateScanner::read_Sensor
}
예제 #9
0
void read_Position(Tango::Attribute &att)
{
	att.set_value(attr_Position_read);
}
예제 #10
0
//+----------------------------------------------------------------------------
//
// method : 		UviewCCD::read_ivsTRoi4Inf
// 
// description : 	Extract real attribute values for ivsTRoi4Inf acquisition result.
//
//-----------------------------------------------------------------------------
void UviewCCD::read_ivsTRoi4Inf(Tango::Attribute &attr)
{
	DEBUG_STREAM << "UviewCCD::read_ivsTRoi4Inf(Tango::Attribute &attr) entering... "<< endl;
    attr.set_value(attr_ivsTRoi4Inf_read, nbInf);
}