00001 00040 #ifndef LibMultiSense_SysFlashResponseMessage 00041 #define LibMultiSense_SysFlashResponseMessage 00042 00043 #include "details/utility/Portability.hh" 00044 00045 namespace crl { 00046 namespace multisense { 00047 namespace details { 00048 namespace wire { 00049 00050 class SysFlashResponse { 00051 public: 00052 static CRL_CONSTEXPR IdType ID = ID_DATA_SYS_FLASH_RESPONSE; 00053 static CRL_CONSTEXPR VersionType VERSION = 1; 00054 00055 // 00056 // Parameters representing the desired flash operation 00057 00058 static CRL_CONSTEXPR uint32_t STATUS_IDLE = 0;// no operation in progress or requested 00059 static CRL_CONSTEXPR uint32_t STATUS_SUCCESS = 1;// requested operation succeeded/started 00060 static CRL_CONSTEXPR uint32_t STATUS_FAILURE = 2;// requested operation failed 00061 static CRL_CONSTEXPR uint32_t STATUS_ERASE_IN_PROGRESS = 3;// operation not possible 00062 00063 uint32_t status; 00064 00065 // 00066 // Only for ERASE_IN_PROGRESS status 00067 00068 int32_t erase_progress; 00069 00070 // 00071 // Constructors 00072 00073 SysFlashResponse(utility::BufferStreamReader&r, VersionType v) {serialize(r,v);}; 00074 SysFlashResponse() : status(STATUS_IDLE), erase_progress(0) {}; 00075 00076 // 00077 // Serialization routine 00078 00079 template<class Archive> 00080 void serialize(Archive& message, 00081 const VersionType version) 00082 { 00083 message & status; 00084 message & erase_progress; 00085 00086 switch(status) { 00087 case STATUS_IDLE: 00088 case STATUS_SUCCESS: 00089 case STATUS_FAILURE: 00090 case STATUS_ERASE_IN_PROGRESS: 00091 break; 00092 default: 00093 CRL_EXCEPTION("unknown status (%d)", (int)status); 00094 } 00095 } 00096 }; 00097 00098 }}}}; // namespaces 00099 00100 #endif