Example #1
0
//+----------------------------------------------------------------------------
//
// method :         SimulatorCCD::init_device()
//
// description :     will be called at device initialization.
//
//-----------------------------------------------------------------------------
void SimulatorCCD::init_device()
{
    INFO_STREAM << "SimulatorCCD::SimulatorCCD() create device " << device_name << endl;

    // Initialise variables to default values
    //--------------------------------------------
    CREATE_SCALAR_ATTRIBUTE(attr_exposureTime_read,1.0);
    //By default INIT, need to ensure that all objets are OK before set the device to STANDBY
    set_state(Tango::INIT);
    m_is_device_initialized = false;
    m_status_message.str("");

    try
    {
        //- get the main object used to pilot the lima framework
        //in fact LimaDetector is create the singleton control objet
        //so this call, will only return existing object, no need to give it the ip !!
        m_ct = ControlFactory::instance().get_control("SimulatorCCD");

        //- get interface to specific camera
        m_hw = dynamic_cast<Simulator::Interface*>(m_ct->hwInterface());
        if(m_hw==0)
        {
            INFO_STREAM<<"Initialization Failed : Unable to get the interface of camera plugin "<<"("<<"SimulatorCCD"<<") !"<< endl;
            m_status_message <<"Initialization Failed : Unable to get the interface of camera plugin "<<"("<<"SimulatorCCD"<<") !"<< endl;
            m_is_device_initialized = false;
            set_state(Tango::FAULT);
            return;
        }

    }
    catch(Exception& e)
    {
        INFO_STREAM<<"Initialization Failed : "<<e.getErrMsg()<<endl;
        m_status_message <<"Initialization Failed : "<<e.getErrMsg( )<< endl;
        m_is_device_initialized = false;
        set_state(Tango::FAULT);
        return;
    }
    catch(...)
    {
        INFO_STREAM<<"Initialization Failed : UNKNOWN"<<endl;
        m_status_message <<"Initialization Failed : UNKNOWN"<< endl;
        set_state(Tango::FAULT);
        m_is_device_initialized = false;
        return;
    }
    m_is_device_initialized = true;
    set_state(Tango::STANDBY);
    this->dev_state();
}
Example #2
0
//+----------------------------------------------------------------------------
//
// method : 		UviewCCD::init_device()
// 
// description : 	will be called at device initialization.
//
//-----------------------------------------------------------------------------
void UviewCCD::init_device()
{
	INFO_STREAM << "UviewCCD::UviewCCD() create device " << device_name << endl;

	
    // Initialise variables to default values
    //--------------------------------------------
  short zero = 0;
	CREATE_SCALAR_ATTRIBUTE(attr_ivsTRoi1_read);
    CREATE_SCALAR_ATTRIBUTE(attr_ivsTRoi2_read);
    CREATE_SCALAR_ATTRIBUTE(attr_ivsTRoi3_read);
    CREATE_SCALAR_ATTRIBUTE(attr_ivsTRoi4_read);
    CREATE_SPECTRUM_ATTRIBUTE(attr_ivsTRoi1Inf_read		,MAX_LENGTH, zero);
    CREATE_SPECTRUM_ATTRIBUTE(attr_ivsTRoi2Inf_read		,MAX_LENGTH, zero);
    CREATE_SPECTRUM_ATTRIBUTE(attr_ivsTRoi3Inf_read		,MAX_LENGTH, zero);
    CREATE_SPECTRUM_ATTRIBUTE(attr_ivsTRoi4Inf_read		,MAX_LENGTH, zero);

    //-- INITIALIZE VARIABLES--//
    set_state(Tango::INIT);
    m_status_message.str("");
    m_roiId = "";
    m_is_device_initialized = false;
    m_is_acquiring = false;
    m_roi1Enable = false;
    m_roi2Enable = false;
    m_roi3Enable = false;
    m_roi4Enable = false;
  
    try
    {
        //- get the main object used to pilot the lima framework
        //in fact LimaDetector is create the singleton control objet
        //so this call, will only return existing object, no need to give it the ip !!
        m_ct = ControlFactory::instance().get_control("Uview");

        //- get interface to specific camera
        m_hw = dynamic_cast<Uview::Interface*>(m_ct->hwInterface());
        if(m_hw==0)
        {
            INFO_STREAM<<"Initialization Failed : Unable to get the interface of camera plugin "<<"("<<"Uview"<<") !"<< endl;
            m_status_message <<"Initialization Failed : Unable to get the interface of camera plugin "<<"("<<"Uview"<<") !"<< endl;
            m_is_device_initialized = false;
            set_state(Tango::FAULT);
            set_status(m_status_message.str());
            return;
        }
		
		//- get camera to specific detector
		m_camera = &(m_hw->getCamera());
       
		if(m_camera == 0)
		{
			INFO_STREAM<<"Initialization Failed : Unable to get the camera of plugin !"<<endl;
			m_status_message <<"Initialization Failed : Unable to get the camera object !"<< endl;
			m_is_device_initialized = false;
			set_state(Tango::FAULT);
            set_status(m_status_message.str());
			return;			
		}		
	
    }
    catch(Exception& e)
    {
        INFO_STREAM<<"Initialization Failed : "<<e.getErrMsg()<<endl;
        m_status_message <<"Initialization Failed : "<<e.getErrMsg( )<< endl;
        m_is_device_initialized = false;
        set_state(Tango::FAULT);
        set_status(m_status_message.str());
        return;
    }
    catch(...)
    {
        INFO_STREAM<<"Initialization Failed : UNKNOWN"<<endl;
        m_status_message <<"Initialization Failed : UNKNOWN"<< endl;
        set_state(Tango::FAULT);
        set_status(m_status_message.str());
        m_is_device_initialized = false;
        return;
    }

	  //-- from UviewCCD plugin--//
    m_camera->m_ivs_roi_data_1_enable = false;
    m_camera->m_ivs_roi_data_2_enable = false;
    m_camera->m_ivs_roi_data_3_enable = false;
    m_camera->m_ivs_roi_data_4_enable = false;
	m_is_device_initialized = true;		
    set_state(Tango::STANDBY);
	set_status("Device initialized");
}