00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 #ifndef __JAUS_CORE_MANAGEMENT_REPORT_STATUS__H 00041 #define __JAUS_CORE_MANAGEMENT_REPORT_STATUS__H 00042 00043 #include "jaus/core/corecodes.h" 00044 #include "jaus/core/message.h" 00045 00046 namespace JAUS 00047 { 00054 class ReportStatus : public Message 00055 { 00056 public: 00057 enum Status 00058 { 00059 Init = 0, 00060 Ready, 00061 Standby, 00062 Shutdown, 00063 Failure, 00064 Emergency 00065 }; 00066 ReportStatus(const Address& dest = Address(), 00067 const Address& src = Address()) : Message(REPORT_STATUS, dest, src) 00068 { 00069 mStatus = Shutdown; 00070 mReserved = 0; 00071 } 00072 ReportStatus(const ReportStatus& message) : Message(REPORT_STATUS) 00073 { 00074 *this = message; 00075 } 00076 ~ReportStatus() 00077 { 00078 } 00079 void SetStatus(const Byte status) { mStatus = status; } 00080 Byte GetStatus() const { return mStatus; } 00081 virtual bool IsCommand() const { return false; } 00082 virtual int WriteMessageBody(Packet& packet) const 00083 { 00084 int expected = BYTE_SIZE + UINT_SIZE; 00085 int written = packet.Write(mStatus); 00086 written += packet.Write(mReserved); 00087 return expected == written ? written : -1; 00088 } 00089 virtual int ReadMessageBody(const Packet& packet) 00090 { 00091 int expected = BYTE_SIZE + UINT_SIZE; 00092 int read = packet.Read(mStatus); 00093 read += packet.Read(mReserved); 00094 return expected == read ? read : -1; 00095 } 00096 virtual Message* Clone() const { return new ReportStatus(*this); } 00097 virtual UInt GetPresenceVector() const { return 0; } 00098 virtual UInt GetPresenceVectorSize() const { return 0; } 00099 virtual UInt GetPresenceVectorMask() const { return 0; } 00100 virtual UShort GetMessageCodeOfResponse() const { return 0; } 00101 virtual std::string GetMessageName() const { return "Report Status"; } 00102 virtual void ClearMessageBody() 00103 { 00104 mStatus = Shutdown; 00105 mReserved = 0; 00106 } 00107 virtual bool IsLargeDataSet(const unsigned int maxPayloadSize) const { return false; } 00108 ReportStatus& operator=(const ReportStatus& message) 00109 { 00110 CopyHeaderData(&message); 00111 mStatus = message.mStatus; 00112 mReserved = message.mReserved; 00113 return *this; 00114 } 00115 protected: 00116 Byte mStatus; 00117 UInt mReserved; 00118 }; 00119 } 00120 00121 #endif 00122 /* End of File */