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 #include "jaus/mobility/drivers/querylocalwaypoint.h" 00041 00042 using namespace JAUS; 00043 00044 00053 QueryLocalWaypoint::QueryLocalWaypoint(const Address& dest, const Address& src) : Message(QUERY_LOCAL_WAYPOINT, dest, src) 00054 { 00055 mPresenceVector = 0; 00056 } 00057 00058 00064 QueryLocalWaypoint::QueryLocalWaypoint(const QueryLocalWaypoint& message) : Message(QUERY_LOCAL_WAYPOINT) 00065 { 00066 *this = message; 00067 } 00068 00069 00075 QueryLocalWaypoint::~QueryLocalWaypoint() 00076 { 00077 } 00078 00079 00091 int QueryLocalWaypoint::WriteMessageBody(Packet& packet) const 00092 { 00093 int expected = BYTE_SIZE; 00094 int written = 0; 00095 00096 written += packet.Write(mPresenceVector); 00097 00098 return expected == written ? written : -1; 00099 } 00100 00101 00113 int QueryLocalWaypoint::ReadMessageBody(const Packet& packet) 00114 { 00115 int expected = BYTE_SIZE; 00116 int read = 0; 00117 00118 read += packet.Read(mPresenceVector); 00119 00120 return expected == read ? read : -1; 00121 } 00122 00123 00129 void QueryLocalWaypoint::ClearMessageBody() 00130 { 00131 mPresenceVector = 0; 00132 } 00133 00134 00142 int QueryLocalWaypoint::RunTestCase() const 00143 { 00144 int result = 0; 00145 00146 Packet packet; 00147 QueryLocalWaypoint msg1, msg2; 00148 msg1.SetPresenceVector(0xFF & GetPresenceVectorMask()); 00149 00150 if( msg1.WriteMessageBody(packet) != -1 && 00151 msg2.ReadMessageBody(packet) != -1 && 00152 msg1.GetPresenceVector() == msg2.GetPresenceVector()) 00153 { 00154 result = 1; 00155 } 00156 00157 return result; 00158 } 00159 00160 00166 QueryLocalWaypoint& QueryLocalWaypoint::operator=(const QueryLocalWaypoint& message) 00167 { 00168 if(this != &message) 00169 { 00170 CopyHeaderData(&message); 00171 mPresenceVector = message.mPresenceVector; 00172 } 00173 return *this; 00174 } 00175 00176 00177 /* End of File */ 00178