00001 00026 #ifndef ODVA_ETHERNETIP_RR_DATA_RESPONSE_H 00027 #define ODVA_ETHERNETIP_RR_DATA_RESPONSE_H 00028 00029 #include <string> 00030 #include <boost/shared_ptr.hpp> 00031 #include <boost/make_shared.hpp> 00032 #include <boost/asio.hpp> 00033 00034 #include "odva_ethernetip/eip_types.h" 00035 #include "odva_ethernetip/cpf_item.h" 00036 #include "odva_ethernetip/serialization/serializable.h" 00037 #include "odva_ethernetip/serialization/reader.h" 00038 #include "odva_ethernetip/serialization/writer.h" 00039 #include "odva_ethernetip/serialization/copy_serializable.h" 00040 #include "odva_ethernetip/rr_data.h" 00041 #include "odva_ethernetip/message_router_response.h" 00042 00043 using boost::shared_ptr; 00044 using boost::make_shared; 00045 00046 namespace eip { 00047 00048 using serialization::Serializable; 00049 using serialization::Reader; 00050 using serialization::Writer; 00051 using serialization::copy_serializable; 00052 00056 class RRDataResponse : public RRData 00057 { 00058 public: 00059 00064 EIP_USINT getServiceCode() const 00065 { 00066 return response_data_.service; 00067 } 00068 00073 EIP_USINT getGeneralStatus() const 00074 { 00075 return response_data_.general_status; 00076 } 00077 00083 shared_ptr<Serializable> getAdditionalStatus() 00084 { 00085 return response_data_.getAdditionalStatus(); 00086 } 00087 00093 shared_ptr<Serializable> getResponseData() 00094 { 00095 return response_data_.getResponseData(); 00096 } 00097 00103 void getAdditionalStatusAs(Serializable& result) 00104 { 00105 copy_serializable(result, *response_data_.getAdditionalStatus()); 00106 } 00107 00113 void getResponseDataAs(Serializable& result) 00114 { 00115 copy_serializable(result, *response_data_.getResponseData()); 00116 } 00117 00118 protected: 00122 virtual shared_ptr<Serializable> getData() const 00123 { 00124 throw std::logic_error("Not implemented"); 00125 } 00126 00130 virtual void setData(CPFItem& item) 00131 { 00132 item.getDataAs(response_data_); 00133 } 00134 00135 private: 00136 MessageRouterResponse response_data_; 00137 }; 00138 00139 } // namespace eip 00140 00141 #endif // ODVA_ETHERNETIP_RR_DATA_RESPONSE_H