GetDiagnosticSetting.cpp
Go to the documentation of this file.00001
00002
00003 #include <fesa-core/Server/GetDiagnosticSetting.h>
00004
00005 #include <fesa-core/Server/RequestEvent.h>
00006 #include <fesa-core/DataStore/GlobalDevice.h>
00007 #include <fesa-core/Diagnostic/DiagnosticUtils.h>
00008 #include <fesa-core/Diagnostic/Diagnostics.h>
00009
00010 #include <cmw-rda/Data.h>
00011 #include <cmw-log/Logger.h>
00012
00013
00014 namespace
00015 {
00016
00017 const std::string serverActionTopic = fesa::DiagnosticUtils::getActionProfilingStr;
00018
00019 }
00020
00021
00022 namespace fesa
00023 {
00024
00025 GetDiagnosticSetting::GetDiagnosticSetting(ServerActionConfig& actionConfig, const AbstractServiceLocator* serviceLocator, const std::map<std::string, const AbstractServiceLocator*> serviceLocatorRelatedClasses) :
00026 AbstractServerAction(actionConfig, serviceLocator, serviceLocatorRelatedClasses)
00027 {
00028 }
00029
00030
00031 GetDiagnosticSetting::~GetDiagnosticSetting()
00032 {
00033 }
00034
00035
00036 bool
00037 GetDiagnosticSetting::needFilter()
00038 {
00039 return false;
00040 }
00041
00042
00043 void
00044 GetDiagnosticSetting::execute(RequestEvent* event, AbstractDevice& device, const rdaData& filter,
00045 rdaData& data, IOType ioType, RequestType requestType)
00046 {
00047 const boost::shared_ptr<Diagnostics>& diagnostics = AbstractEquipment::getInstance()->getDiagnostics();
00048 DiagnosticUtils::DiagnosticMessage diagMsg;
00049 diagMsg.side = DiagnosticUtils::framework;
00050 diagMsg.source = DiagnosticUtils::server;
00051 diagMsg.name = getName();
00052 diagMsg.action = DiagnosticUtils::start;
00053 diagnostics->log(serverActionTopic, diagMsg);
00054 GlobalDevice& globalDevice = static_cast<GlobalDevice&>(device);
00055 MultiplexingContext* context = event->getMultiplexingContext();
00056
00057 data.insert("enableDiagMode", globalDevice.enableDiagMode.get(context));
00058 const std::string hostName = globalDevice.hostName.get(context);
00059 data.insert("hostName", hostName.c_str());
00060 data.insert("portNumber", static_cast<long int>(globalDevice.portNumber.get(context)));
00061 data.insert("requestConfig", false);
00062 data.insert("requestState", false);
00063 data.insert("fwkTopic", static_cast<long int>(globalDevice.fwkTopic.get(context)));
00064 data.insert("customTopic", static_cast<long int>(globalDevice.customTopic.get(context)));
00065 data.insert("traceDevices", globalDevice.traceDevices.get(context));
00066 data.insert("bypassActions", globalDevice.bypassActions.get(context));
00067 diagMsg.action = DiagnosticUtils::stop;
00068 diagnostics->log(serverActionTopic, diagMsg);
00069 }
00070
00071
00072 void
00073 GetDiagnosticSetting::performCommit(MultiplexingContext& context, AbstractDevice* transactionDevice)
00074 {
00075 }
00076
00077
00078 void
00079 GetDiagnosticSetting::performRollback(MultiplexingContext& context, AbstractDevice* transactionDevice)
00080 {
00081 }
00082
00083 }