Commit c3d1908a authored by Marco De Marco's avatar Marco De Marco
Browse files

Auto start properties added

parent 38f433bf
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -207,6 +207,13 @@ void FitsImporter::init_device()
            //Create event thread
            m_eventThread_sp = EventThread::create(this, m_configuration_sp, 
                m_instrumentList_spvector, m_defaultInstrument_sp);

            //Start device if auto start enabled
            if(autoStart)
            {
                INFO_STREAM << "FitsImporter::init_device() auto start enabled " << endl;
                on();
            }
        }
        catch(std::exception& ex)
        {
@@ -258,6 +265,7 @@ void FitsImporter::get_device_property()
	dev_prop.push_back(Tango::DbDatum("DMDBInstrumentTable"));
	dev_prop.push_back(Tango::DbDatum("DMDBDestinationTable"));
	dev_prop.push_back(Tango::DbDatum("DMDBMappingTable"));
	dev_prop.push_back(Tango::DbDatum("AutoStart"));

	//	is there at least one property to be read ?
	if (dev_prop.size()>0)
@@ -448,6 +456,17 @@ void FitsImporter::get_device_property()
		//	And try to extract DMDBMappingTable value from database
		if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  dMDBMappingTable;

		//	Try to initialize AutoStart from class property
		cl_prop = ds_class->get_class_property(dev_prop[++i].name);
		if (cl_prop.is_empty()==false)	cl_prop  >>  autoStart;
		else {
			//	Try to initialize AutoStart from default device value
			def_prop = ds_class->get_default_device_property(dev_prop[i].name);
			if (def_prop.is_empty()==false)	def_prop  >>  autoStart;
		}
		//	And try to extract AutoStart value from database
		if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  autoStart;

	}

	/*----- PROTECTED REGION ID(FitsImporter::get_device_property_after) ENABLED START -----*/
+2 −0
Original line number Diff line number Diff line
@@ -155,6 +155,8 @@ public:
	string	dMDBDestinationTable;
	//	DMDBMappingTable:	Mapping table name
	string	dMDBMappingTable;
	//	AutoStart:	Exec On command after init if state is not fault
	Tango::DevBoolean	autoStart;

//	Attribute data members
public:
+6 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
    </deviceProperties>
    <deviceProperties name="DMDBPort" description="Port where data model database is listening">
      <type xsi:type="pogoDsl:UShortType"/>
      <type xsi:type="pogoDsl:UIntType"/>
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
      <DefaultPropValue>3306</DefaultPropValue>
    </deviceProperties>
@@ -112,6 +112,11 @@
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
      <DefaultPropValue>mapping</DefaultPropValue>
    </deviceProperties>
    <deviceProperties name="AutoStart" description="Exec On command after init if state is not fault">
      <type xsi:type="pogoDsl:BooleanType"/>
      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
      <DefaultPropValue>false</DefaultPropValue>
    </deviceProperties>
    <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
      <argin description="none">
        <type xsi:type="pogoDsl:VoidType"/>
+14 −0
Original line number Diff line number Diff line
@@ -737,6 +737,20 @@ void FitsImporterClass::set_default_property()
	}
	else
		add_wiz_dev_prop(prop_name, prop_desc);
	prop_name = "AutoStart";
	prop_desc = "Exec On command after init if state is not fault";
	prop_def  = "false";
	vect_data.clear();
	vect_data.push_back("false");
	if (prop_def.length()>0)
	{
		Tango::DbDatum	data(prop_name);
		data << vect_data ;
		dev_def_prop.push_back(data);
		add_wiz_dev_prop(prop_name, prop_desc,  prop_def);
	}
	else
		add_wiz_dev_prop(prop_name, prop_desc);
}

//--------------------------------------------------------