ProxyReplyHandler.cpp

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #include <fesa-core/Proxy/ProxyReplyHandler.h>
00004 #include <fesa-core/Utilities/Lock.h>
00005 
00006 #include <cmw-rda/RDAService.h>
00007 #include <cmw-log/Logger.h>
00008 
00009 #include <iostream>
00010 
00011 namespace
00012 {
00013 
00014 CMW::Log::Logger& logger = CMW::Log::LoggerFactory::getLogger("FESA.FWK.fesa-core.Proxy.ProxyReplyHandler");
00015 
00016 }
00017 
00018 
00019 namespace fesa
00020 {
00021 
00022 ProxyReplyHandler::ProxyReplyHandler()
00023 {
00024     mtx_.lock();
00025 }
00026 
00027 ProxyReplyHandler::~ProxyReplyHandler()
00028 {
00029 
00030 }
00031 
00032 void ProxyReplyHandler::handleReply(const rdaRequest& request, const rdaData& value)
00033 {
00034     Lock lock(mtx_);
00036     value_ = value;
00037     deviceName_ = (request.getDeviceHandle())->getDeviceName();
00038     propertyName_ = request.getPropertyName();
00039     if (request.getCycleSelector())
00040         cycleSelectorName_ = request.getCycleSelector();
00041     cv_.signal();
00042 }
00043 
00044 void ProxyReplyHandler::handleError(const rdaRequest&, const rdaException& ex)
00045 {
00046     LOG_ERROR_IF(logger, ex.getMessage());
00047 }
00048 
00049 void ProxyReplyHandler::disconnected(const rdaRequest&)
00050 {
00051 }
00052 
00053 void ProxyReplyHandler::reconnected(const rdaRequest&)
00054 {
00055 }
00056 
00057 void ProxyReplyHandler::cancelled(const rdaRequest&)
00058 {
00059 }
00060 
00061 void ProxyReplyHandler::waitReply(std::string& deviceName, std::string& propertyName,
00062                                   std::string& cycleSelectorName, rdaData& data)
00063 {
00064     cv_.wait(mtx_);
00065     deviceName = deviceName_;
00066     propertyName = propertyName_;
00067     cycleSelectorName = cycleSelectorName_;
00068     data = value_;
00069 }
00070 } // fesa

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1