00001 00026 #ifndef OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_HEADER_H 00027 #define OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_HEADER_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 MeasurementReportHeader : public Serializable 00048 { 00049 public: 00050 EIP_UDINT scan_count; 00051 EIP_UDINT scan_rate; 00052 EIP_UDINT scan_timestamp; 00053 EIP_UDINT scan_beam_period; 00054 EIP_UINT machine_state; 00055 EIP_UINT machine_stop_reasons; 00056 EIP_UINT active_zone_set; 00057 EIP_WORD zone_inputs; 00058 EIP_WORD detection_zone_status; 00059 EIP_WORD output_status; 00060 EIP_WORD input_status; 00061 EIP_UINT display_status; 00062 EIP_UINT non_safety_config_checksum; 00063 EIP_UINT safety_config_checksum; 00064 EIP_UINT range_report_format; 00065 EIP_UINT refletivity_report_format; 00066 EIP_UINT num_beams; 00067 00071 virtual size_t getLength() const 00072 { 00073 return 56; 00074 } 00075 00082 virtual Writer& serialize(Writer& writer) const 00083 { 00084 EIP_UINT reserved = 0; 00085 writer.write(scan_count); 00086 writer.write(scan_rate); 00087 writer.write(scan_timestamp); 00088 writer.write(scan_beam_period); 00089 writer.write(machine_state); 00090 writer.write(machine_stop_reasons); 00091 writer.write(active_zone_set); 00092 writer.write(zone_inputs); 00093 writer.write(detection_zone_status); 00094 writer.write(output_status); 00095 writer.write(input_status); 00096 writer.write(display_status); 00097 writer.write(non_safety_config_checksum); 00098 writer.write(safety_config_checksum); 00099 writer.write(reserved); 00100 writer.write(reserved); 00101 writer.write(reserved); 00102 writer.write(reserved); 00103 writer.write(reserved); 00104 writer.write(reserved); 00105 writer.write(range_report_format); 00106 writer.write(refletivity_report_format); 00107 writer.write(reserved); 00108 writer.write(num_beams); 00109 return writer; 00110 } 00111 00115 virtual Reader& deserialize(Reader& reader, size_t length) 00116 { 00117 deserialize(reader); 00118 return reader; 00119 } 00120 00127 virtual Reader& deserialize(Reader& reader) 00128 { 00129 reader.read(scan_count); 00130 reader.read(scan_rate); 00131 reader.read(scan_timestamp); 00132 reader.read(scan_beam_period); 00133 reader.read(machine_state); 00134 reader.read(machine_stop_reasons); 00135 reader.read(active_zone_set); 00136 reader.read(zone_inputs); 00137 reader.read(detection_zone_status); 00138 reader.read(output_status); 00139 reader.read(input_status); 00140 reader.read(display_status); 00141 reader.read(non_safety_config_checksum); 00142 reader.read(safety_config_checksum); 00143 reader.skip(6*sizeof(EIP_UINT)); 00144 reader.read(range_report_format); 00145 reader.read(refletivity_report_format); 00146 reader.skip(sizeof(EIP_UINT)); 00147 reader.read(num_beams); 00148 return reader; 00149 } 00150 }; 00151 00152 } // namespace omron_os32c_driver 00153 00154 #endif // OMRON_OS32C_DRIVER_MEASUREMENT_REPORT_HEADER_H