Protocols: Fix includes to use the explicit path of the header files
[remote/remote-mci.git] / protocols / host_server / MsgHostRequest.cc
blob14217800b54db6bda665d38349d6a655c1482dd0
1 #include "protocols/host_server/MsgHostRequest.h"
3 namespace remote { namespace protocols { namespace host_server {
5 MsgHostRequest::MsgHostRequest(MsgMoteAddresses& addresses, MsgPayload& message)
6 : addresses(&addresses),
7 message(&message),
8 deleteMsg(false)
9 {}
11 MsgHostRequest::MsgHostRequest(uint8_t*& buffer, uint32_t& buflen)
13 buffer=this->read(buffer,buflen);
14 deleteMsg = true;
17 MsgHostRequest::~MsgHostRequest()
19 if (deleteMsg)
21 delete this->addresses;
22 delete this->message;
26 uint32_t MsgHostRequest::getLength()
28 return addresses->getLength() + message->getLength();
31 uint8_t* MsgHostRequest::write(uint8_t* buffer, uint32_t& buflen)
33 buffer = addresses->write(buffer,buflen);
34 buffer = message->write(buffer,buflen);
35 return buffer;
38 uint8_t* MsgHostRequest::read(uint8_t* buffer, uint32_t& buflen)
40 addresses = new MsgMoteAddresses(buffer,buflen);
41 message = new MsgPayload(buffer,buflen);
42 return buffer;
45 void MsgHostRequest::print(FILE* s)
49 MsgMoteAddresses& MsgHostRequest::getMoteAddresses()
51 return *addresses;
54 MsgPayload& MsgHostRequest::getMessage()
56 return *message;
59 }}}