diff --git a/src/DataExporter.cpp b/src/DataExporter.cpp index a819848b2c0456aa8bf33792b0b2332510a2fe88..8dde8fcbcc12390f3a3a1397f58723ff8f3b1d7f 100644 --- a/src/DataExporter.cpp +++ b/src/DataExporter.cpp @@ -159,6 +159,13 @@ void DataExporter::init_device() m_server_sp = SSLServer::create(this, m_configuration_sp); else m_server_sp = PlainServer::create(this, m_configuration_sp); + + //Start device if auto start enabled + if(autoStart) + { + INFO_STREAM << "FitsImporter::init_device() auto start enabled " << endl; + on(); + } } catch(std::exception& ex) { @@ -212,6 +219,7 @@ void DataExporter::get_device_property() dev_prop.push_back(Tango::DbDatum("DatabaseUsername")); dev_prop.push_back(Tango::DbDatum("DatabasePassword")); dev_prop.push_back(Tango::DbDatum("DatabaseConnectionNumber")); + dev_prop.push_back(Tango::DbDatum("AutoStart")); // is there at least one property to be read ? if (dev_prop.size()>0) @@ -380,6 +388,17 @@ void DataExporter::get_device_property() // And try to extract DatabaseConnectionNumber value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> databaseConnectionNumber; + // 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(DataExporter::get_device_property_after) ENABLED START -----*/ @@ -462,7 +481,7 @@ void DataExporter::get_device_property() //-------------------------------------------------------- void DataExporter::always_executed_hook() { - DEBUG_STREAM << "DataExporter::always_executed_hook() " << device_name << endl; + INFO_STREAM << "DataExporter::always_executed_hook() " << device_name << endl; /*----- PROTECTED REGION ID(DataExporter::always_executed_hook) ENABLED START -----*/ if(get_state() != Tango::FAULT) diff --git a/src/DataExporter.h b/src/DataExporter.h index 5db2bac94b3cb1e0a2b052093a9ae144589fbb10..92c751b1b0c8b7ebf62291c29b5a71a14a99c5fc 100644 --- a/src/DataExporter.h +++ b/src/DataExporter.h @@ -48,7 +48,7 @@ /** * DataExporter class description: - * + * */ namespace DataExporter_ns @@ -117,6 +117,8 @@ public: string databasePassword; // DatabaseConnectionNumber: Number of database connection created Tango::DevUShort databaseConnectionNumber; + // AutoStart: Exec On command after init if state is not fault + Tango::DevBoolean autoStart; // Constructors and destructors @@ -145,7 +147,7 @@ public: DataExporter(Tango::DeviceClass *cl,const char *s,const char *d); /** * The device object destructor. - */ + */ ~DataExporter() {delete_device();}; diff --git a/src/DataExporter.xmi b/src/DataExporter.xmi index e310dc2b043edc3d03bc2963ab38fe159c11d8a4..46378fb640e023cf27a0938b2f53f46c9997abfd 100644 --- a/src/DataExporter.xmi +++ b/src/DataExporter.xmi @@ -84,6 +84,11 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <DefaultPropValue>2</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"/> diff --git a/src/DataExporterClass.cpp b/src/DataExporterClass.cpp index 373c6ab99fd6860e9d81af2f907b9d9ffeb9bb6f..88065a80b2e7d4423a4030b6efcb5ae28006b9ce 100644 --- a/src/DataExporterClass.cpp +++ b/src/DataExporterClass.cpp @@ -606,6 +606,20 @@ void DataExporterClass::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); } //--------------------------------------------------------