Skip to content
Snippets Groups Projects
Commit 6d5a2040 authored by m.marn's avatar m.marn
Browse files

Add initial version of the integration testing class

parent 468eb3d4
No related branches found
No related tags found
No related merge requests found
Showing
with 4296 additions and 13 deletions
<?xml version="1.0" encoding="UTF-8"?>
<SILECS-Design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" silecs-version="2.0.0" created="06/27/16" updated="06/27/16" xsi:noNamespaceSchemaLocation="/common/home/bel/schwinn/lnx/git/silecs-model/src/xml/DesignSchema.xsd">
<SILECS-Design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" silecs-version="3.0.0" created="06/27/16" updated="06/27/16" xsi:noNamespaceSchemaLocation="/home/cosylab/mmarn/lnx/workspace751/opensilecs/build/3.0.0/silecs-model/xml/DesignSchema.xsd">
<Information>
<Owner user-login="schwinn"/>
<Editor user-login="schwinn"/>
......@@ -292,10 +292,10 @@
</Configuration-Block>
<custom-types>
<enum name="TEST_ENUM">
<item access="RW" value="0" symbol="OK" />
<item access="RW" value="1" symbol="WARNING" />
<item access="RW" value="2" symbol="ERROR" />
<item access="RW" value="3" symbol="UNKNOWN" />
<item access="RW" value="0" symbol="OK"/>
<item access="RW" value="1" symbol="WARNING"/>
<item access="RW" value="2" symbol="ERROR"/>
<item access="RW" value="3" symbol="UNKNOWN"/>
</enum>
</custom-types>
</SILECS-Class>
......
......@@ -18,7 +18,7 @@ import unittest
import fesa.fesa_7_3_0.generateFesaDesign
fesa_version = "7.3.0"
fesa_version = "7.5.0"
import libxml2
import unittest
......@@ -57,13 +57,13 @@ class TestGenerateFesaDesign(unittest.TestCase):
def test_fillXML_EmptyTemplate(self):
fesaRoot = libxml2.parseFile("test/fesa/emptyTemplate.xml")
self.generator.fillXML(fesa_version, 'MyClass', fesaRoot, simpleSilecsDesignRoot, logTopics={'errorlog': True})
self.generator.fillXML(fesa_version, 'AllTypesFESA', fesaRoot, simpleSilecsDesignRoot, logTopics={'errorlog': True})
self.assertTrue(fesaRoot.xpathEval('/equipment-model/events') is not None)
self.assertTrue(fesaRoot.xpathEval('/equipment-model/scheduling-units') is not None)
def test_fillXML_GSITemplate(self):
fesaRoot = libxml2.parseFile("test/fesa/GSIClassTemplate.xml")
self.generator.fillXML(fesa_version, 'MyClass', fesaRoot, simpleSilecsDesignRoot, logTopics={'errorlog': True})
self.generator.fillXML(fesa_version, 'AllTypesFESA', fesaRoot, simpleSilecsDesignRoot, logTopics={'errorlog': True})
self.assertTrue(fesaRoot.xpathEval('/equipment-model/events') is not None)
self.assertTrue(fesaRoot.xpathEval('/equipment-model/scheduling-units') is not None)
......@@ -85,15 +85,15 @@ class TestGenerateFesaDesign(unittest.TestCase):
commandBlock = myRoot.xpathEval('/SILECS-Design/SILECS-Class/Command-Block')[0]
commandBlock.setProp("name", "Init")
self.assertRaises(Exception, lambda: self.generator.fillXML(fesa_version, 'MyClass', fesaRoot, myRoot, logTopics={'errorlog': True}))
self.assertRaises(Exception, lambda: self.generator.fillXML(fesa_version, 'AllTypesFESA', fesaRoot, myRoot, logTopics={'errorlog': True}))
commandBlock.setProp("name", "Reset")
self.assertRaises(Exception, lambda: self.generator.fillXML(fesa_version, 'MyClass', fesaRoot, myRoot, logTopics={'errorlog': True}))
self.assertRaises(Exception, lambda: self.generator.fillXML(fesa_version, 'AllTypesFESA', fesaRoot, myRoot, logTopics={'errorlog': True}))
def testFillXML_AllTypes(self):
fesaRoot = libxml2.parseFile("test/fesa/GSIClassTemplate.xml")
silecsRoot = libxml2.parseFile("test/AllTypesFESA.silecsdesign")
fesaRoot = self.generator.fillXML(fesa_version, 'MyClass', fesaRoot, silecsRoot, logTopics={'errorlog': True})
fesaRoot = self.generator.fillXML(fesa_version, 'AllTypesFESA', fesaRoot, silecsRoot, logTopics={'errorlog': True})
fesaNewDocPath = "test/generated_temp/AllTypesFESA.design"
fesaCompareDocPath = "test/generated_correct/AllTypesFESA.design"
with open(fesaNewDocPath, 'w') as fd:
......
<?xml version="1.0" encoding="UTF-8"?>
<equipment-model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../design-gsi.xsd">
<information>
<class-name>MyClass</class-name>
<class-name>AllTypesFESA</class-name>
<class-major-version>0</class-major-version>
<class-minor-version>1</class-minor-version>
<class-tiny-version>0</class-tiny-version>
<type>Final</type>
<description>An empty design with GSI-specific standard properties</description>
<fesa-version>7.3.0</fesa-version>
<fesa-version>7.5.0</fesa-version>
</information>
<ownership>
<responsible name="ACO"/>
......
.cproject
.project
.settings/
Makefile
Makefile.dep
Makefile.silecs
bin/
build/
generated/
precompiled/
**/*.o
**/*.backup
# Include SILECS makefile
include Makefile.silecs
# Additional compiler warning flags
override WARNFLAGS +=
# Additional compiler flags
COMPILER_FLAGS +=
LINKER_FLAGS +=
# Additional headers (Custom.h Specific.h ...) which need to be installed
EXTRA_HEADERS +=
# Usage
Before you compile and synchronize the class make sure to run `copyDesigns.sh` which will take the latest silecsdesign and fesa design files and copy them to this FESA class project. After that the procedure to work with the class is the same as always.
#!/bin/sh
SCRIPT_PATH=$(dirname $(readlink -f "$0"))
cp $SCRIPT_PATH/../../silecs-codegen/src/xml/test/generated_correct/AllTypesFESA.design src/
cp $SCRIPT_PATH/../../silecs-codegen/src/xml/test/AllTypesFESA.silecsdesign src/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* AllTypesFESA.h
*
* Generated by SILECS framework tools. Will be overwritten on regeneration.
*/
#ifndef AllTypesFESA_AllTypesFESA_H_
#define AllTypesFESA_AllTypesFESA_H_
#include <silecs-communication/interface/core/SilecsService.h>
#include <silecs-communication/interface/equipment/SilecsPLC.h>
#include <fesa-core/Synchronization/MultiplexingContext.h>
#include <AllTypesFESA/GeneratedCode/ServiceLocator.h>
namespace AllTypesFESA
{
/*---------------------------------------------------------------------------------------------------------
* SETUP
*---------------------------------------------------------------------------------------------------------
* Setup the SILECS service by calling the setup() method from the RTDeviceClass::specificInit()
* Stop and cleanup the SILECS service by calling the cleanup() method if needed (eg.: from ~RTDeviceClass())
*
* In order to make use of the different blocks, defined in the silecsdesign, please make use of the static, block related variables of the class, defined on the bottom of this file !
* --------------------------------------------------------------------------------------------------------
*/
/*---------------------------------------------------------------------------------------------------------
* COMMUNICATION
*---------------------------------------------------------------------------------------------------------
* General methods to synchronize the FESA fields and related PLC registers of the FESA server with or without
* PLC side synchronization (send/recv) if requested. Each action is done for one particular block.
* In case of BLOCK_MODE configuration (see SILECS doc.), the transaction is optimal with the following
* 'AllDevices' and 'PLCDevices' methods.
* Each method can be called in the appropriate server-action (set) and rt-action (get)
*
* getAllDevices : [receive all devices of all connected PLCs +] update FESA fields with related SILECS registers
* setAllDevices : update SILECS registers with related FESA fields [+ send block to all connected PLCs]
* getPLCDevices : [receive all devices of one PLC +] update FESA fields with related SILECS registers
* setPLCDevices : update SILECS registers with related FESA fields [+ send block to the PLC]
* getSomeDevices : [receive each device of the device-collection +] update FESA fields with related SILECS registers
* setSomeDevices : update SILECS registers with related FESA fields [+ send block to each device of the device-collection]
* getOneDevice : [receive block of one PLC device +] update FESA fields with related SILECS registers
* setOneDevice : update SILECS registers with related FESA fields [+ send block to the PLC device]
*
* --------------------------------------------------------------------------------------------------------
*/
class AbstractAllTypesFESA
{
public:
static inline Silecs::Service* theService() { return pService_; }
static inline Silecs::PLCHandler* thePLCHandler() { return pPLCHandler_; }
inline std::string& getBlockName() { return blockName_; }
static void setup(const ServiceLocator* serviceLocator);
static void cleanup();
static bool isInitialized(){ return AbstractAllTypesFESA::isInitialized_; }
static void updatePLCRegisters(Silecs::PLC* pPLC, const ServiceLocator* serviceLocator);
static void updateFesaFields(Silecs::PLC* pPLC, const ServiceLocator* serviceLocator);
AbstractAllTypesFESA(std::string blockName);
virtual ~AbstractAllTypesFESA();
void getAllDevices(const ServiceLocator* serviceLocator, const bool recvNow, MultiplexingContext* pContext);
void getPLCDevices(Silecs::PLC* pPLC, const ServiceLocator* serviceLocator, const bool recvNow, MultiplexingContext* pContext);
void getSomeDevices(std::vector<Device*> deviceCol, const bool recvNow, MultiplexingContext* pContext);
virtual void getOneDevice(Device* pDevice, const bool recvNow, MultiplexingContext* pContext);
void setAllDevices(const ServiceLocator* serviceLocator, const bool sendNow, MultiplexingContext* pContext);
void setPLCDevices(Silecs::PLC* pPLC, const ServiceLocator* serviceLocator, const bool sendNow, MultiplexingContext* pContext);
void setSomeDevices(std::vector<Device*> deviceCol, const bool sendNow, MultiplexingContext* pContext);
virtual void setOneDevice(Device* pDevice, const bool sendNow, MultiplexingContext* pContext);
protected:
static void checkInitialized();
static Silecs::Service* pService_;
static Silecs::PLCHandler* pPLCHandler_;
static bool isInitialized_;
// Name of the silecs-block which is addressed
std::string blockName_;
// not copyable object
AbstractAllTypesFESA(const AbstractAllTypesFESA&);
AbstractAllTypesFESA& operator=(const AbstractAllTypesFESA&);
};
class MyROBlock_Type : public AbstractAllTypesFESA
{
public:
MyROBlock_Type(std::string name);
~MyROBlock_Type();
void getOneDevice(Device* pDevice, const bool transmitNow, MultiplexingContext* pContext);
};
class MyRWBlock_Type : public AbstractAllTypesFESA
{
public:
MyRWBlock_Type(std::string name);
~MyRWBlock_Type();
void getOneDevice(Device* pDevice, const bool recvNow, MultiplexingContext* pContext);
void getOneDevice(Device* pDevice, MyRWBlockPropPropertyData& data, const bool recvNow);
void setOneDevice(Device* pDevice, const bool transmitNow, MultiplexingContext* pContext);
void setOneDevice(Device* pDevice, const MyRWBlockPropPropertyData& data, const bool transmitNow, MultiplexingContext* pContext);
};
class MyWOBlock_Type : public AbstractAllTypesFESA
{
public:
MyWOBlock_Type(std::string name);
~MyWOBlock_Type();
void setOneDevice(Device* pDevice, const bool transmitNow, MultiplexingContext* pContext);
void setOneDevice(Device* pDevice, const MyWOBlockPropPropertyData& data, const bool transmitNow, MultiplexingContext* pContext);
};
class MyCBlock_Type : public AbstractAllTypesFESA
{
public:
MyCBlock_Type(std::string name);
~MyCBlock_Type();
void setOneDevice(Device* pDevice, const bool transmitNow, MultiplexingContext* pContext);
void setOneDevice(Device* pDevice, const MyCBlockPropPropertyData& data, const bool transmitNow, MultiplexingContext* pContext);
};
/*---------------------------------------------------------------------------------------------------------
* INTERFACE
*---------------------------------------------------------------------------------------------------------
* This is the public interface used from the FESA code to access the PLC service.
*/
class AllTypesFESA
{
public:
static inline Silecs::Service* theService() { return AbstractAllTypesFESA::theService(); }
static inline Silecs::PLCHandler* thePLCHandler() { return AbstractAllTypesFESA::thePLCHandler(); }
static void setup(const ServiceLocator* serviceLocator) { AbstractAllTypesFESA::setup(serviceLocator); }
static void cleanup() { AbstractAllTypesFESA::cleanup(); }
static bool isInitialized(){ return AbstractAllTypesFESA::isInitialized(); }
static Silecs::PLC* getPLC(Device* pDevice)
{
return &AbstractAllTypesFESA::thePLCHandler()->getPLC(pDevice->plcHostName.get());
}
static MyROBlock_Type MyROBlock;
static MyRWBlock_Type MyRWBlock;
static MyWOBlock_Type MyWOBlock;
static MyCBlock_Type MyCBlock;
};
}
#endif /* AllTypesFESA_AllTypesFESA_H_ */
\ No newline at end of file
// FESA framework
// Use this code as a starting point to develop your own equipment class
#include <AllTypesFESA/RealTime/RTDeviceClass.h>
#include <AllTypesFESA/GeneratedCode/ServiceLocator.h>
#include <fesa-core/Core/AbstractEvent.h>
#include <cmw-log/Logger.h>
#include <string>
#include <vector>
namespace
{
cmw::log::Logger& logger = cmw::log::LoggerFactory::getLogger("FESA.USR.AllTypesFESA.RealTime.RTDeviceClass");
} // namespace
namespace AllTypesFESA
{
RTDeviceClass* RTDeviceClass::instance_ = NULL;
RTDeviceClass::RTDeviceClass () :
RTDeviceClassGen()
{
}
RTDeviceClass::~RTDeviceClass()
{
}
RTDeviceClass* RTDeviceClass::getInstance()
{
if (instance_ == NULL)
{
instance_ = new RTDeviceClass();
}
return instance_;
}
void RTDeviceClass::releaseInstance()
{
if (instance_ != NULL)
{
delete instance_;
instance_ = NULL;
}
}
// This method is called when the FESA class starts up.
// You can write code that initializes devices in the loop below.
void RTDeviceClass::specificInit()
{
const Devices& deviceCol = AllTypesFESAServiceLocator_->getDeviceCollection();
for (Devices::const_iterator it = deviceCol.begin(); it != deviceCol.end(); ++it)
{
try
{
Device* device = *it;
static_cast<void>(device); // This line prevents an "unused variable" warning, it can be removed safely.
// Write here some code to initialize devices
}
catch (const fesa::FesaException& exception)
{
LOG_ERROR_IF(logger, exception.getMessage());
// Re-throwing the exception prevents the process from starting up.
throw;
}
}
}
void RTDeviceClass::specificShutDown()
{
// This method is executed just before a normal shut down of the process.
}
} // AllTypesFESA
// FESA framework
// Use this code as a starting point to develop your own equipment class
#ifndef _AllTypesFESA_RT_DEVICE_CLASS_H_
#define _AllTypesFESA_RT_DEVICE_CLASS_H_
#include <AllTypesFESA/GeneratedCode/RTDeviceClassGen.h>
namespace AllTypesFESA
{
class RTDeviceClass: public RTDeviceClassGen
{
public:
static RTDeviceClass* getInstance();
static void releaseInstance();
void specificInit();
void specificShutDown();
private:
RTDeviceClass();
virtual ~RTDeviceClass();
static RTDeviceClass* instance_;
};
} // AllTypesFESA
#endif // _AllTypesFESA_RT_DEVICE_CLASS_H_
// FESA framework
// Use this code as a starting point to develop your own equipment class
#include <AllTypesFESA/GeneratedCode/ServiceLocator.h>
#include <AllTypesFESA/RealTime/StatusUpdateAction.h>
#include <cmw-log/Logger.h>
namespace
{
cmw::log::Logger& logger = cmw::log::LoggerFactory::getLogger("FESA.USR.AllTypesFESA.RealTime.StatusUpdateAction");
} // namespace
#define LOG_DIAG_IF(topic,message) \
{ \
DiagnosticsDefs::DiagnosticMessage diagMsg(DiagnosticsDefs::Side::user, DiagnosticsDefs::Source::rt); \
diagMsg.fesaClass = "AllTypesFESA"; \
diagMsg.name = "StatusUpdateAction"; \
diagMsg.action = DiagnosticsDefs::Action::undefined; \
diagMsg.msg = message; \
AllTypesFESAServiceLocator_->logDiagnosticMessage(topic, diagMsg); \
}
#define LOG_DIAG_DEVICE_IF(topic,message,device) \
{ \
if (device->isLoggable()) \
{ \
LOG_DIAG_IF(topic,message); \
} \
}
namespace AllTypesFESA
{
StatusUpdateAction::StatusUpdateAction(fesa::RTActionConfig& rtActionConfig, const fesa::AbstractServiceLocator* serviceLocator, const std::map<std::string, const fesa::AbstractServiceLocator*>& serviceLocatorRelatedClasses) :
StatusUpdateActionBase(rtActionConfig, serviceLocator, serviceLocatorRelatedClasses)
{
}
StatusUpdateAction::~StatusUpdateAction()
{
}
// This method is called whenever an event triggers this action; this is where custom code must be written.
// A real time action operates on a device collection, this is why a loop which iterates over the device collection
// of this real time action is there.
void StatusUpdateAction::execute(fesa::RTEvent* pEvt)
{
const fesa::MultiplexingContext* context = pEvt->getMultiplexingContext();
static_cast<void>(context); // This line prevents an "unused variable" warning, it can be removed safely.
const Devices& devices = getFilteredDeviceCollection(pEvt);
for (Devices::const_iterator it = devices.begin(); it != devices.end(); ++it)
{
try
{
Device* device = *it;
static_cast<void>(device); // This line prevents an "unused variable" warning, it can be removed safely.
// Write here some code to process devices
}
catch (const fesa::FesaException& exception)
{
LOG_ERROR_IF(logger, exception.getMessage());
}
}
}
} // AllTypesFESA
// FESA framework
// Use this code as a starting point to develop your own equipment class
#ifndef _AllTypesFESA_StatusUpdateAction_H_
#define _AllTypesFESA_StatusUpdateAction_H_
#include <AllTypesFESA/GeneratedCode/Device.h>
#include <AllTypesFESA/GeneratedCode/GenRTActions.h>
namespace AllTypesFESA
{
class StatusUpdateAction : public StatusUpdateActionBase
{
public:
StatusUpdateAction (fesa::RTActionConfig& rtActionConfig, const fesa::AbstractServiceLocator* serviceLocator, const std::map<std::string, const fesa::AbstractServiceLocator*>& serviceLocatorRelatedClasses);
virtual ~StatusUpdateAction();
void execute(fesa::RTEvent* pEvt);
};
} // AllTypesFESA
#endif // _AllTypesFESA_StatusUpdateAction_H_
// FESA framework
// Use this code as a starting point to develop your own equipment class
#include <AllTypesFESA/Server/GetMyCBlockProp.h>
#include <AllTypesFESA/GeneratedCode/ServiceLocator.h>
#include <cmw-log/Logger.h>
namespace
{
cmw::log::Logger& logger = cmw::log::LoggerFactory::getLogger("FESA.USR.AllTypesFESA.Server.GetMyCBlockProp");
} // namespace
#define LOG_DIAG_IF(topic,message) \
{ \
DiagnosticsDefs::DiagnosticMessage diagMsg(DiagnosticsDefs::Side::user, DiagnosticsDefs::Source::rt); \
diagMsg.fesaClass = "AllTypesFESA"; \
diagMsg.name = "GetMyCBlockProp"; \
diagMsg.action = DiagnosticsDefs::Action::undefined; \
diagMsg.msg = message; \
AllTypesFESAServiceLocator_->logDiagnosticMessage(topic, diagMsg); \
}
#define LOG_DIAG_DEVICE_IF(topic,message,device) \
{ \
if (device->isLoggable()) \
{ \
LOG_DIAG_IF(topic,message); \
} \
}
namespace AllTypesFESA
{
GetMyCBlockProp::GetMyCBlockProp(fesa::ServerActionConfig& actionConfig, const fesa::AbstractServiceLocator* serviceLocator, const std::map<std::string, const fesa::AbstractServiceLocator*>& serviceLocatorRelatedClasses):
GetMyCBlockPropBase(actionConfig, serviceLocator, serviceLocatorRelatedClasses)
{
}
GetMyCBlockProp::~GetMyCBlockProp()
{
}
/*!
* \brief This method is executed consecutively to a GET/SET action:
* \param pEvt requestEvent from which the multiplexingContext can be extracted
* \param pDev points to the Device or Global instance involved by this request
* \param data composite structure that aggregates one or several types data-entries corresponding to the property definition.
* This data object is the input (resp. output) which is passed when invoking a Get (resp. Set).
* \param filter input parameter meant to fine tune the treatment.
*/
void GetMyCBlockProp::execute(fesa::RequestEvent* pEvt, Device* pDev, MyCBlockPropPropertyData& data, const MyCBlockPropFilterData& filter)
{
}
// Use this member function to tell the framework whether the subscribed clients need to be updated or not. See the FESA wiki for more info
bool GetMyCBlockProp::hasDataChanged(const fesa::RequestEvent& event, fesa::AbstractDevice& abstractDevice, const MyCBlockPropFilterData& filter) const
{
//Device& device = static_cast<Device&>(abstractDevice);
return true;
}
// This method is called when a new subscription is requested. Returning false will abort the subscription.
bool GetMyCBlockProp::isFilterValid(const fesa::AbstractDevice& abstractDevice, const MyCBlockPropFilterData& filter) const
{
//Device& device = static_cast<Device&>(abstractDevice);
return true;
}
} // AllTypesFESA
// FESA framework
// Use this code as a starting point to develop your own equipment class
#ifndef _AllTypesFESA_GetMyCBlockProp_H_
#define _AllTypesFESA_GetMyCBlockProp_H_
#include <AllTypesFESA/GeneratedCode/GetSetDefaultServerAction.h>
#include <AllTypesFESA/GeneratedCode/PropertyData.h>
#include <AllTypesFESA/GeneratedCode/TypeDefinition.h>
#include <AllTypesFESA/GeneratedCode/Device.h>
namespace AllTypesFESA
{
class GetMyCBlockProp : public GetMyCBlockPropBase
{
public:
GetMyCBlockProp(fesa::ServerActionConfig& actionConfig, const fesa::AbstractServiceLocator* serviceLocator, const std::map<std::string, const fesa::AbstractServiceLocator*>& serviceLocatorRelatedClasses);
virtual ~GetMyCBlockProp();
void execute(fesa::RequestEvent* pEvt, Device* pDev, MyCBlockPropPropertyData& data, const MyCBlockPropFilterData& filter);
bool hasDataChanged(const fesa::RequestEvent& event, fesa::AbstractDevice& abstractDevice, const MyCBlockPropFilterData& filter) const;
bool isFilterValid(const fesa::AbstractDevice& abstractDevice, const MyCBlockPropFilterData& filter) const;
};
} // AllTypesFESA
#endif // _AllTypesFESA_GetMyCBlockProp_H_
// FESA framework
// Use this code as a starting point to develop your own equipment class
#include <AllTypesFESA/Server/GetMyROBlockProp.h>
#include <AllTypesFESA/GeneratedCode/ServiceLocator.h>
#include <cmw-log/Logger.h>
namespace
{
cmw::log::Logger& logger = cmw::log::LoggerFactory::getLogger("FESA.USR.AllTypesFESA.Server.GetMyROBlockProp");
} // namespace
#define LOG_DIAG_IF(topic,message) \
{ \
DiagnosticsDefs::DiagnosticMessage diagMsg(DiagnosticsDefs::Side::user, DiagnosticsDefs::Source::rt); \
diagMsg.fesaClass = "AllTypesFESA"; \
diagMsg.name = "GetMyROBlockProp"; \
diagMsg.action = DiagnosticsDefs::Action::undefined; \
diagMsg.msg = message; \
AllTypesFESAServiceLocator_->logDiagnosticMessage(topic, diagMsg); \
}
#define LOG_DIAG_DEVICE_IF(topic,message,device) \
{ \
if (device->isLoggable()) \
{ \
LOG_DIAG_IF(topic,message); \
} \
}
namespace AllTypesFESA
{
GetMyROBlockProp::GetMyROBlockProp(fesa::ServerActionConfig& actionConfig, const fesa::AbstractServiceLocator* serviceLocator, const std::map<std::string, const fesa::AbstractServiceLocator*>& serviceLocatorRelatedClasses):
GetMyROBlockPropBase(actionConfig, serviceLocator, serviceLocatorRelatedClasses)
{
}
GetMyROBlockProp::~GetMyROBlockProp()
{
}
/*!
* \brief This method is executed consecutively to a GET/SET action:
* \param pEvt requestEvent from which the multiplexingContext can be extracted
* \param pDev points to the Device or Global instance involved by this request
* \param data composite structure that aggregates one or several types data-entries corresponding to the property definition.
* This data object is the input (resp. output) which is passed when invoking a Get (resp. Set).
* \param filter input parameter meant to fine tune the treatment.
*/
void GetMyROBlockProp::execute(fesa::RequestEvent* pEvt, Device* pDev, MyROBlockPropPropertyData& data, const MyROBlockPropFilterData& filter)
{
}
// Use this member function to tell the framework whether the subscribed clients need to be updated or not. See the FESA wiki for more info
bool GetMyROBlockProp::hasDataChanged(const fesa::RequestEvent& event, fesa::AbstractDevice& abstractDevice, const MyROBlockPropFilterData& filter) const
{
//Device& device = static_cast<Device&>(abstractDevice);
return true;
}
// This method is called when a new subscription is requested. Returning false will abort the subscription.
bool GetMyROBlockProp::isFilterValid(const fesa::AbstractDevice& abstractDevice, const MyROBlockPropFilterData& filter) const
{
//Device& device = static_cast<Device&>(abstractDevice);
return true;
}
} // AllTypesFESA
// FESA framework
// Use this code as a starting point to develop your own equipment class
#ifndef _AllTypesFESA_GetMyROBlockProp_H_
#define _AllTypesFESA_GetMyROBlockProp_H_
#include <AllTypesFESA/GeneratedCode/GetSetDefaultServerAction.h>
#include <AllTypesFESA/GeneratedCode/PropertyData.h>
#include <AllTypesFESA/GeneratedCode/TypeDefinition.h>
#include <AllTypesFESA/GeneratedCode/Device.h>
namespace AllTypesFESA
{
class GetMyROBlockProp : public GetMyROBlockPropBase
{
public:
GetMyROBlockProp(fesa::ServerActionConfig& actionConfig, const fesa::AbstractServiceLocator* serviceLocator, const std::map<std::string, const fesa::AbstractServiceLocator*>& serviceLocatorRelatedClasses);
virtual ~GetMyROBlockProp();
void execute(fesa::RequestEvent* pEvt, Device* pDev, MyROBlockPropPropertyData& data, const MyROBlockPropFilterData& filter);
bool hasDataChanged(const fesa::RequestEvent& event, fesa::AbstractDevice& abstractDevice, const MyROBlockPropFilterData& filter) const;
bool isFilterValid(const fesa::AbstractDevice& abstractDevice, const MyROBlockPropFilterData& filter) const;
};
} // AllTypesFESA
#endif // _AllTypesFESA_GetMyROBlockProp_H_
// FESA framework
// Use this code as a starting point to develop your own equipment class
#include <AllTypesFESA/Server/GetMyRWBlockProp.h>
#include <AllTypesFESA/GeneratedCode/ServiceLocator.h>
#include <AllTypesFESA/Common/AllTypesFESA.h>
#include <cmw-log/Logger.h>
namespace
{
cmw::log::Logger& logger = cmw::log::LoggerFactory::getLogger("FESA.USR.AllTypesFESA.Server.GetMyRWBlockProp");
} // namespace
#define LOG_DIAG_IF(topic,message) \
{ \
DiagnosticsDefs::DiagnosticMessage diagMsg(DiagnosticsDefs::Side::user, DiagnosticsDefs::Source::rt); \
diagMsg.fesaClass = "AllTypesFESA"; \
diagMsg.name = "GetMyRWBlockProp"; \
diagMsg.action = DiagnosticsDefs::Action::undefined; \
diagMsg.msg = message; \
AllTypesFESAServiceLocator_->logDiagnosticMessage(topic, diagMsg); \
}
#define LOG_DIAG_DEVICE_IF(topic,message,device) \
{ \
if (device->isLoggable()) \
{ \
LOG_DIAG_IF(topic,message); \
} \
}
namespace AllTypesFESA
{
GetMyRWBlockProp::GetMyRWBlockProp(fesa::ServerActionConfig& actionConfig, const fesa::AbstractServiceLocator* serviceLocator, const std::map<std::string, const fesa::AbstractServiceLocator*>& serviceLocatorRelatedClasses):
GetMyRWBlockPropBase(actionConfig, serviceLocator, serviceLocatorRelatedClasses)
{
}
GetMyRWBlockProp::~GetMyRWBlockProp()
{
}
/*!
* \brief This method is executed consecutively to a GET/SET action:
* \param pEvt requestEvent from which the multiplexingContext can be extracted
* \param pDev points to the Device or Global instance involved by this request
* \param data composite structure that aggregates one or several types data-entries corresponding to the property definition.
* This data object is the input (resp. output) which is passed when invoking a Get (resp. Set).
* \param filter input parameter meant to fine tune the treatment.
*/
void GetMyRWBlockProp::execute(fesa::RequestEvent* pEvt, Device* pDev, MyRWBlockPropPropertyData& data, const MyRWBlockPropFilterData& filter)
{
AllTypesFESA::MyRWBlock.getOneDevice(pDev, data, true);
}
// Use this member function to tell the framework whether the subscribed clients need to be updated or not. See the FESA wiki for more info
bool GetMyRWBlockProp::hasDataChanged(const fesa::RequestEvent& event, fesa::AbstractDevice& abstractDevice, const MyRWBlockPropFilterData& filter) const
{
//Device& device = static_cast<Device&>(abstractDevice);
return true;
}
// This method is called when a new subscription is requested. Returning false will abort the subscription.
bool GetMyRWBlockProp::isFilterValid(const fesa::AbstractDevice& abstractDevice, const MyRWBlockPropFilterData& filter) const
{
//Device& device = static_cast<Device&>(abstractDevice);
return true;
}
} // AllTypesFESA
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment