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_EXTRAS_VIDEO_REPORT_CAMERA_COUNT__H 00041 #define __JAUS_EXTRAS_VIDEO_REPORT_CAMERA_COUNT__H 00042 00043 #include "jaus/extras/extrascodes.h" 00044 #include "jaus/core/message.h" 00045 #include <cxutils/images/image.h> 00046 00047 namespace JAUS 00048 { 00056 class JAUS_EXTRAS_DLL ReportCameraCount : public Message 00057 { 00058 public: 00059 ReportCameraCount(const Address& dest = Address(), const Address& src = Address()) : Message(REPORT_CAMERA_COUNT, dest, src) 00060 { 00061 } 00062 ReportCameraCount(const ReportCameraCount& message) : Message(REPORT_CAMERA_COUNT) 00063 { 00064 *this = message; 00065 } 00066 ~ReportCameraCount() {} 00067 std::vector<Byte>* GetCameraList() { return &mList; } 00068 const std::vector<Byte>* GetCameraList() const { return &mList; } 00069 virtual bool IsCommand() const { return false; } 00070 virtual int WriteMessageBody(Packet& packet) const 00071 { 00072 int total = 0; 00073 int expected = (int)(BYTE_SIZE + BYTE_SIZE*mList.size()); 00074 total += packet.WriteByte((Byte)mList.size()); 00075 for(unsigned int i = 0; i < (unsigned int)mList.size(); i++) 00076 { 00077 total += packet.WriteByte(mList[i]); 00078 } 00079 return total == expected ? total : -1; 00080 } 00081 virtual int ReadMessageBody(const Packet& packet) 00082 { 00083 int total = 0; 00084 int expected = BYTE_SIZE; 00085 Byte count = 0, temp = 0; 00086 total += packet.Read(count); 00087 expected += count*BYTE_SIZE; 00088 for(Byte i = 0; i < count; i++) 00089 { 00090 total += packet.Read(temp); 00091 mList.push_back(temp); 00092 } 00093 return total == expected ? total : -1; 00094 } 00095 virtual Message* Clone() const { return new ReportCameraCount(*this); } 00096 virtual UInt GetPresenceVector() const { return 0; } 00097 virtual UInt GetPresenceVectorSize() const { return 0; } 00098 virtual UInt GetPresenceVectorMask() const { return 0; } 00099 virtual UShort GetMessageCodeOfResponse() const { return 0; } 00100 virtual std::string GetMessageName() const { return "Report Camera Count"; } 00101 virtual void ClearMessageBody() { mList.clear(); } 00102 virtual bool IsLargeDataSet(const unsigned int maxPayloadSize) const { return false; } 00103 ReportCameraCount& operator=(const ReportCameraCount& message) 00104 { 00105 CopyHeaderData(&message); 00106 mList = message.mList; 00107 return *this; 00108 } 00109 protected: 00110 std::vector<Byte> mList; 00111 }; 00112 } 00113 00114 #endif 00115 /* End of File */