00001 00026 #ifndef OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_CONFIG_H 00027 #define OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_CONFIG_H 00028 00029 #include <string> 00030 00031 #include "odva_ethernetip/eip_types.h" 00032 #include "odva_ethernetip/serialization/reader.h" 00033 #include "odva_ethernetip/serialization/writer.h" 00034 #include "odva_ethernetip/serialization/serializable.h" 00035 00036 using std::string; 00037 using eip::serialization::Serializable; 00038 using eip::serialization::Reader; 00039 using eip::serialization::Writer; 00040 00041 namespace omron_os32c_driver { 00042 00047 class MeasurementReportConfig : public Serializable 00048 { 00049 public: 00050 EIP_UINT sequence_num; 00051 EIP_UDINT trigger; 00052 EIP_UINT range_report_format; 00053 EIP_UINT reflectivity_report_format; 00054 EIP_BYTE beam_selection_mask[88]; 00055 00056 MeasurementReportConfig() : sequence_num(1), trigger(3), 00057 range_report_format(1), reflectivity_report_format(2) 00058 { 00059 memset(beam_selection_mask, 0, sizeof(beam_selection_mask)); 00060 } 00061 00065 virtual size_t getLength() const 00066 { 00067 return 110; 00068 } 00069 00076 virtual Writer& serialize(Writer& writer) const 00077 { 00078 EIP_UINT reserved = 0; 00079 writer.write(sequence_num); 00080 writer.write(trigger); 00081 writer.write(range_report_format); 00082 writer.write(reflectivity_report_format); 00083 writer.write(reserved); 00084 writer.write(reserved); 00085 writer.write(reserved); 00086 writer.write(reserved); 00087 writer.write(reserved); 00088 writer.write(reserved); 00089 writer.writeBytes(beam_selection_mask, sizeof(beam_selection_mask)); 00090 return writer; 00091 } 00092 00096 virtual Reader& deserialize(Reader& reader, size_t length) 00097 { 00098 return deserialize(reader); 00099 } 00100 00107 virtual Reader& deserialize(Reader& reader) 00108 { 00109 reader.read(sequence_num); 00110 reader.read(trigger); 00111 reader.read(range_report_format); 00112 reader.read(reflectivity_report_format); 00113 reader.skip(12); 00114 reader.readBytes(beam_selection_mask, sizeof(beam_selection_mask)); 00115 return reader; 00116 } 00117 }; 00118 00119 } // namespace omron_os32c_driver 00120 00121 #endif // OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_CONFIG_H