Loading src/Client.cpp +5 −4 Original line number Diff line number Diff line #include <Client.h> #include <DataImporter.h> #include <boost/lexical_cast.hpp> #include <boost/bind.hpp> Loading @@ -10,8 +11,8 @@ namespace DataImporter_ns //============================================================================== // Client::Client() //============================================================================== Client::Client(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_sp) : Tango::LogAdapter(deviceImpl_p), m_deviceImpl_p(deviceImpl_p), Client::Client(DataImporter* dataImporter_p, Configuration::SP configuration_sp) : Tango::LogAdapter(dataImporter_p), m_dataImporter_p(dataImporter_p), m_configuration_sp(configuration_sp), m_resolver(m_ioService), m_resetConnectionTimer(m_ioService), m_listsUpdateTimer(m_ioService) { Loading @@ -19,7 +20,7 @@ Client::Client(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_ GOOGLE_PROTOBUF_VERIFY_VERSION; m_dBManager_sp = DBManager::create(deviceImpl_p, configuration_sp); m_dBManager_sp = DBManager::create(dataImporter_p, configuration_sp); m_state = Tango::OFF; m_status="Disconnected"; Loading Loading @@ -55,7 +56,7 @@ void Client::start() m_dBManager_sp->connectAll(); m_protocolManager_sp = ProtocolManager::create(m_deviceImpl_p, m_protocolManager_sp = ProtocolManager::create(m_dataImporter_p, m_configuration_sp, m_dBManager_sp); m_ioService.reset(); Loading src/Client.h +4 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ namespace DataImporter_ns { class DataImporter; class Client : public Tango::LogAdapter { public: Loading @@ -32,7 +34,7 @@ protected: //------------------------------------------------------------------------------ // [Protected] Constructor destructor //------------------------------------------------------------------------------ Client(Tango::DeviceImpl*, Configuration::SP); Client(DataImporter*, Configuration::SP); virtual ~Client(); Loading Loading @@ -143,7 +145,7 @@ protected: // [Protected] Class variables //------------------------------------------------------------------------------ //Tango server class pointer Tango::DeviceImpl* m_deviceImpl_p; DataImporter* m_dataImporter_p; //Configuration shared pointer Configuration::SP m_configuration_sp; Loading src/DataImporter.cpp +108 −2 Original line number Diff line number Diff line Loading @@ -63,11 +63,14 @@ // Status | Inherited (no method) // On | on // Off | off // ResetCounter | reset_counter //================================================================ //================================================================ // Attributes managed is: // Attributes managed are: //================================================================ // RegularFileCounter | Tango::DevULong Scalar // FailedFileCounter | Tango::DevULong Scalar //================================================================ namespace DataImporter_ns Loading Loading @@ -126,6 +129,8 @@ void DataImporter::delete_device() // Delete device allocated objects /*----- PROTECTED REGION END -----*/ // DataImporter::delete_device delete[] attr_RegularFileCounter_read; delete[] attr_FailedFileCounter_read; } //-------------------------------------------------------- Loading @@ -148,6 +153,8 @@ void DataImporter::init_device() // Get the device properties from database get_device_property(); attr_RegularFileCounter_read = new Tango::DevULong[1]; attr_FailedFileCounter_read = new Tango::DevULong[1]; /*----- PROTECTED REGION ID(DataImporter::init_device) ENABLED START -----*/ Loading Loading @@ -608,7 +615,7 @@ void DataImporter::get_device_property() //-------------------------------------------------------- void DataImporter::always_executed_hook() { INFO_STREAM << "DataImporter::always_executed_hook() " << device_name << endl; DEBUG_STREAM << "DataImporter::always_executed_hook() " << device_name << endl; /*----- PROTECTED REGION ID(DataImporter::always_executed_hook) ENABLED START -----*/ if(get_state() != Tango::FAULT) Loading Loading @@ -640,6 +647,46 @@ void DataImporter::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) /*----- PROTECTED REGION END -----*/ // DataImporter::read_attr_hardware } //-------------------------------------------------------- /** * Read attribute RegularFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void DataImporter::read_RegularFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "DataImporter::read_RegularFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(DataImporter::read_RegularFileCounter) ENABLED START -----*/ boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); attr.set_value(attr_RegularFileCounter_read); /*----- PROTECTED REGION END -----*/ // DataImporter::read_RegularFileCounter } //-------------------------------------------------------- /** * Read attribute FailedFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void DataImporter::read_FailedFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "DataImporter::read_FailedFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(DataImporter::read_FailedFileCounter) ENABLED START -----*/ boost::mutex::scoped_lock failedCounterLock(m_failedCounterMutex); attr.set_value(attr_FailedFileCounter_read); /*----- PROTECTED REGION END -----*/ // DataImporter::read_FailedFileCounter } //-------------------------------------------------------- /** Loading Loading @@ -722,9 +769,68 @@ void DataImporter::off() /*----- PROTECTED REGION END -----*/ // DataImporter::off } //-------------------------------------------------------- /** * Command ResetCounter related method * Description: * */ //-------------------------------------------------------- void DataImporter::reset_counter() { DEBUG_STREAM << "DataImporter::ResetCounter() - " << device_name << endl; /*----- PROTECTED REGION ID(DataImporter::reset_counter) ENABLED START -----*/ boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); *attr_RegularFileCounter_read = 0; boost::mutex::scoped_lock failedCounterLock(m_failedCounterMutex); *attr_FailedFileCounter_read = 0; /*----- PROTECTED REGION END -----*/ // DataImporter::reset_counter } /*----- PROTECTED REGION ID(DataImporter::namespace_ending) ENABLED START -----*/ //============================================================================== // DataImporter::incrementRegularCounter() //============================================================================== void DataImporter::incrementRegularCounter() { DEBUG_STREAM << "DataImporter::incrementRegularCounter() - " << device_name << endl; boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); ++*attr_RegularFileCounter_read; } //============================================================================== // DataImporter::incrementFailedCounter() //============================================================================== void DataImporter::incrementFailedCounter() { DEBUG_STREAM << "DataImporter::incrementFailedCounter() - " << device_name << endl; boost::mutex::scoped_lock failedCounterLock(m_failedCounterMutex); ++*attr_FailedFileCounter_read; } //============================================================================== // DataImporter::decrementFailedCounter() //============================================================================== void DataImporter::decrementFailedCounter() { DEBUG_STREAM << "DataImporter::decrementFailedCounter() - " << device_name << endl; boost::mutex::scoped_lock failedCounterLock(m_failedCounterMutex); if(*attr_FailedFileCounter_read > 0) --*attr_FailedFileCounter_read; } //============================================================================== // DataImporter::checkIfFileExists() //============================================================================== Loading src/DataImporter.h +47 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,12 @@ class DataImporter : public TANGO_BASE_CLASS //Client class shared pointer Client::SP m_client_sp; //Regular file counter synchronization boost::mutex m_regularCounterMutex; //Failed file counter synchronization boost::mutex m_failedCounterMutex; //Max port number allowed value for data import database static const unsigned int MAX_PORT_NUMBER = 65535; Loading Loading @@ -138,6 +144,10 @@ public: // AuxDatabaseFailedTable: File transfer auxiliary database failed transfer table string auxDatabaseFailedTable; // Attribute data members public: Tango::DevULong *attr_RegularFileCounter_read; Tango::DevULong *attr_FailedFileCounter_read; // Constructors and destructors public: Loading Loading @@ -199,6 +209,25 @@ public: //-------------------------------------------------------- virtual void read_attr_hardware(vector<long> &attr_list); /** * Attribute RegularFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_RegularFileCounter(Tango::Attribute &attr); virtual bool is_RegularFileCounter_allowed(Tango::AttReqType type); /** * Attribute FailedFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_FailedFileCounter(Tango::Attribute &attr); virtual bool is_FailedFileCounter_allowed(Tango::AttReqType type); //-------------------------------------------------------- /** Loading Loading @@ -226,10 +255,28 @@ public: */ virtual void off(); virtual bool is_Off_allowed(const CORBA::Any &any); /** * Command ResetCounter related method * Description: * */ virtual void reset_counter(); virtual bool is_ResetCounter_allowed(const CORBA::Any &any); /*----- PROTECTED REGION ID(DataImporter::Additional Method prototypes) ENABLED START -----*/ //------------------------------------------------------------------------------ // [Public] Counters methods //------------------------------------------------------------------------------ virtual void incrementRegularCounter(); virtual void incrementFailedCounter(); virtual void decrementFailedCounter(); protected: //------------------------------------------------------------------------------ // [Protected] Utilities methods //------------------------------------------------------------------------------ Loading src/DataImporter.xmi +25 −0 Original line number Diff line number Diff line Loading @@ -183,6 +183,31 @@ <excludedStates>OFF</excludedStates> <excludedStates>FAULT</excludedStates> </commands> <commands name="ResetCounter" description="" execMethod="reset_counter" displayLevel="OPERATOR" polledPeriod="0"> <argin description=""> <type xsi:type="pogoDsl:VoidType"/> </argin> <argout description=""> <type xsi:type="pogoDsl:VoidType"/> </argout> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </commands> <attributes name="RegularFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> <attributes name="FailedFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> <states name="ON" description="Data exporter is in ON state (searching new file to transfer)"> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </states> Loading Loading
src/Client.cpp +5 −4 Original line number Diff line number Diff line #include <Client.h> #include <DataImporter.h> #include <boost/lexical_cast.hpp> #include <boost/bind.hpp> Loading @@ -10,8 +11,8 @@ namespace DataImporter_ns //============================================================================== // Client::Client() //============================================================================== Client::Client(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_sp) : Tango::LogAdapter(deviceImpl_p), m_deviceImpl_p(deviceImpl_p), Client::Client(DataImporter* dataImporter_p, Configuration::SP configuration_sp) : Tango::LogAdapter(dataImporter_p), m_dataImporter_p(dataImporter_p), m_configuration_sp(configuration_sp), m_resolver(m_ioService), m_resetConnectionTimer(m_ioService), m_listsUpdateTimer(m_ioService) { Loading @@ -19,7 +20,7 @@ Client::Client(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_ GOOGLE_PROTOBUF_VERIFY_VERSION; m_dBManager_sp = DBManager::create(deviceImpl_p, configuration_sp); m_dBManager_sp = DBManager::create(dataImporter_p, configuration_sp); m_state = Tango::OFF; m_status="Disconnected"; Loading Loading @@ -55,7 +56,7 @@ void Client::start() m_dBManager_sp->connectAll(); m_protocolManager_sp = ProtocolManager::create(m_deviceImpl_p, m_protocolManager_sp = ProtocolManager::create(m_dataImporter_p, m_configuration_sp, m_dBManager_sp); m_ioService.reset(); Loading
src/Client.h +4 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ namespace DataImporter_ns { class DataImporter; class Client : public Tango::LogAdapter { public: Loading @@ -32,7 +34,7 @@ protected: //------------------------------------------------------------------------------ // [Protected] Constructor destructor //------------------------------------------------------------------------------ Client(Tango::DeviceImpl*, Configuration::SP); Client(DataImporter*, Configuration::SP); virtual ~Client(); Loading Loading @@ -143,7 +145,7 @@ protected: // [Protected] Class variables //------------------------------------------------------------------------------ //Tango server class pointer Tango::DeviceImpl* m_deviceImpl_p; DataImporter* m_dataImporter_p; //Configuration shared pointer Configuration::SP m_configuration_sp; Loading
src/DataImporter.cpp +108 −2 Original line number Diff line number Diff line Loading @@ -63,11 +63,14 @@ // Status | Inherited (no method) // On | on // Off | off // ResetCounter | reset_counter //================================================================ //================================================================ // Attributes managed is: // Attributes managed are: //================================================================ // RegularFileCounter | Tango::DevULong Scalar // FailedFileCounter | Tango::DevULong Scalar //================================================================ namespace DataImporter_ns Loading Loading @@ -126,6 +129,8 @@ void DataImporter::delete_device() // Delete device allocated objects /*----- PROTECTED REGION END -----*/ // DataImporter::delete_device delete[] attr_RegularFileCounter_read; delete[] attr_FailedFileCounter_read; } //-------------------------------------------------------- Loading @@ -148,6 +153,8 @@ void DataImporter::init_device() // Get the device properties from database get_device_property(); attr_RegularFileCounter_read = new Tango::DevULong[1]; attr_FailedFileCounter_read = new Tango::DevULong[1]; /*----- PROTECTED REGION ID(DataImporter::init_device) ENABLED START -----*/ Loading Loading @@ -608,7 +615,7 @@ void DataImporter::get_device_property() //-------------------------------------------------------- void DataImporter::always_executed_hook() { INFO_STREAM << "DataImporter::always_executed_hook() " << device_name << endl; DEBUG_STREAM << "DataImporter::always_executed_hook() " << device_name << endl; /*----- PROTECTED REGION ID(DataImporter::always_executed_hook) ENABLED START -----*/ if(get_state() != Tango::FAULT) Loading Loading @@ -640,6 +647,46 @@ void DataImporter::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) /*----- PROTECTED REGION END -----*/ // DataImporter::read_attr_hardware } //-------------------------------------------------------- /** * Read attribute RegularFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void DataImporter::read_RegularFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "DataImporter::read_RegularFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(DataImporter::read_RegularFileCounter) ENABLED START -----*/ boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); attr.set_value(attr_RegularFileCounter_read); /*----- PROTECTED REGION END -----*/ // DataImporter::read_RegularFileCounter } //-------------------------------------------------------- /** * Read attribute FailedFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void DataImporter::read_FailedFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "DataImporter::read_FailedFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(DataImporter::read_FailedFileCounter) ENABLED START -----*/ boost::mutex::scoped_lock failedCounterLock(m_failedCounterMutex); attr.set_value(attr_FailedFileCounter_read); /*----- PROTECTED REGION END -----*/ // DataImporter::read_FailedFileCounter } //-------------------------------------------------------- /** Loading Loading @@ -722,9 +769,68 @@ void DataImporter::off() /*----- PROTECTED REGION END -----*/ // DataImporter::off } //-------------------------------------------------------- /** * Command ResetCounter related method * Description: * */ //-------------------------------------------------------- void DataImporter::reset_counter() { DEBUG_STREAM << "DataImporter::ResetCounter() - " << device_name << endl; /*----- PROTECTED REGION ID(DataImporter::reset_counter) ENABLED START -----*/ boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); *attr_RegularFileCounter_read = 0; boost::mutex::scoped_lock failedCounterLock(m_failedCounterMutex); *attr_FailedFileCounter_read = 0; /*----- PROTECTED REGION END -----*/ // DataImporter::reset_counter } /*----- PROTECTED REGION ID(DataImporter::namespace_ending) ENABLED START -----*/ //============================================================================== // DataImporter::incrementRegularCounter() //============================================================================== void DataImporter::incrementRegularCounter() { DEBUG_STREAM << "DataImporter::incrementRegularCounter() - " << device_name << endl; boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); ++*attr_RegularFileCounter_read; } //============================================================================== // DataImporter::incrementFailedCounter() //============================================================================== void DataImporter::incrementFailedCounter() { DEBUG_STREAM << "DataImporter::incrementFailedCounter() - " << device_name << endl; boost::mutex::scoped_lock failedCounterLock(m_failedCounterMutex); ++*attr_FailedFileCounter_read; } //============================================================================== // DataImporter::decrementFailedCounter() //============================================================================== void DataImporter::decrementFailedCounter() { DEBUG_STREAM << "DataImporter::decrementFailedCounter() - " << device_name << endl; boost::mutex::scoped_lock failedCounterLock(m_failedCounterMutex); if(*attr_FailedFileCounter_read > 0) --*attr_FailedFileCounter_read; } //============================================================================== // DataImporter::checkIfFileExists() //============================================================================== Loading
src/DataImporter.h +47 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,12 @@ class DataImporter : public TANGO_BASE_CLASS //Client class shared pointer Client::SP m_client_sp; //Regular file counter synchronization boost::mutex m_regularCounterMutex; //Failed file counter synchronization boost::mutex m_failedCounterMutex; //Max port number allowed value for data import database static const unsigned int MAX_PORT_NUMBER = 65535; Loading Loading @@ -138,6 +144,10 @@ public: // AuxDatabaseFailedTable: File transfer auxiliary database failed transfer table string auxDatabaseFailedTable; // Attribute data members public: Tango::DevULong *attr_RegularFileCounter_read; Tango::DevULong *attr_FailedFileCounter_read; // Constructors and destructors public: Loading Loading @@ -199,6 +209,25 @@ public: //-------------------------------------------------------- virtual void read_attr_hardware(vector<long> &attr_list); /** * Attribute RegularFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_RegularFileCounter(Tango::Attribute &attr); virtual bool is_RegularFileCounter_allowed(Tango::AttReqType type); /** * Attribute FailedFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_FailedFileCounter(Tango::Attribute &attr); virtual bool is_FailedFileCounter_allowed(Tango::AttReqType type); //-------------------------------------------------------- /** Loading Loading @@ -226,10 +255,28 @@ public: */ virtual void off(); virtual bool is_Off_allowed(const CORBA::Any &any); /** * Command ResetCounter related method * Description: * */ virtual void reset_counter(); virtual bool is_ResetCounter_allowed(const CORBA::Any &any); /*----- PROTECTED REGION ID(DataImporter::Additional Method prototypes) ENABLED START -----*/ //------------------------------------------------------------------------------ // [Public] Counters methods //------------------------------------------------------------------------------ virtual void incrementRegularCounter(); virtual void incrementFailedCounter(); virtual void decrementFailedCounter(); protected: //------------------------------------------------------------------------------ // [Protected] Utilities methods //------------------------------------------------------------------------------ Loading
src/DataImporter.xmi +25 −0 Original line number Diff line number Diff line Loading @@ -183,6 +183,31 @@ <excludedStates>OFF</excludedStates> <excludedStates>FAULT</excludedStates> </commands> <commands name="ResetCounter" description="" execMethod="reset_counter" displayLevel="OPERATOR" polledPeriod="0"> <argin description=""> <type xsi:type="pogoDsl:VoidType"/> </argin> <argout description=""> <type xsi:type="pogoDsl:VoidType"/> </argout> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </commands> <attributes name="RegularFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> <attributes name="FailedFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> <states name="ON" description="Data exporter is in ON state (searching new file to transfer)"> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </states> Loading