00001 00037 #ifndef LibMultiSense_SysDeviceModesMessage 00038 #define LibMultiSense_SysDeviceModesMessage 00039 00040 #include "details/utility/Portability.hh" 00041 00042 namespace crl { 00043 namespace multisense { 00044 namespace details { 00045 namespace wire { 00046 00047 class DeviceMode { 00048 public: 00049 uint32_t width; 00050 uint32_t height; 00051 uint32_t supportedDataSources; 00052 uint32_t disparities; 00053 00054 DeviceMode(uint32_t w=0, 00055 uint32_t h=0, 00056 uint32_t s=0, 00057 uint32_t d=0) : 00058 width(w), 00059 height(h), 00060 supportedDataSources(s), 00061 disparities(d) {}; 00062 }; 00063 00064 class SysDeviceModes { 00065 public: 00066 static CRL_CONSTEXPR IdType ID = ID_DATA_SYS_DEVICE_MODES; 00067 static CRL_CONSTEXPR VersionType VERSION = 2; 00068 00069 // 00070 // Available formats 00071 00072 std::vector<DeviceMode> modes; 00073 00074 // 00075 // Constructors 00076 00077 SysDeviceModes(utility::BufferStreamReader& r, 00078 VersionType v) {serialize(r,v);}; 00079 SysDeviceModes() {}; 00080 00081 // 00082 // Serialization routine 00083 00084 template<class Archive> 00085 void serialize(Archive& message, 00086 const VersionType version) 00087 { 00088 uint32_t length = modes.size(); 00089 message & length; 00090 modes.resize(length); 00091 00092 // 00093 // Serialize by hand here to maintain backwards compatibility with 00094 // pre-v2.3 firmware. 00095 00096 for(uint32_t i=0; i<length; i++) { 00097 00098 DeviceMode& m = modes[i]; 00099 00100 message & m.width; 00101 message & m.height; 00102 message & m.supportedDataSources; 00103 message & m.disparities; // was 'flags' in pre v2.3 00104 } 00105 } 00106 }; 00107 00108 }}}}; // namespaces 00109 00110 #endif