#include <cluster/Packets/DeviceRequest.h>
Inheritance diagram for cluster::DeviceRequest:


Public Member Functions | |
| DeviceRequest () | |
| DeviceRequest (const vpr::GUID &plugin_guid, const std::string &device_name) | |
| Create a DeviceRequest packet to request a remote device. | |
| void | serialize () |
| Serializes member variables into a data stream. | |
| virtual void | parse (vpr::BufferObjectReader *reader) |
| Parses the data stream into the local member variables. | |
| virtual void | printData (int debug_level) |
| Print the data to the screen in a readable form. | |
| std::string | getDeviceName () |
| Return the name of the remote device being requested. | |
Static Public Member Functions | |
| static vpr::Uint16 | getPacketFactoryType () |
| Return the type of this packet. | |
Definition at line 53 of file DeviceRequest.h.
| cluster::DeviceRequest::DeviceRequest | ( | ) | [inline] |
| cluster::DeviceRequest::DeviceRequest | ( | const vpr::GUID & | plugin_guid, | |
| const std::string & | device_name | |||
| ) |
Create a DeviceRequest packet to request a remote device.
| plugin_guid | GUID of the ClusterPlugin that should handle this packet. | |
| device_name | Name of the remote device being requested. |
Definition at line 44 of file DeviceRequest.cpp.
References cluster::Packet::mHeader, cluster::Packet::mPluginId, cluster::Header::RIM_DEVICE_REQ, cluster::Header::RIM_PACKET, cluster::Header::RIM_PACKET_HEAD_SIZE, and serialize().
00045 { 00046 // Set the local member variables using the given values. 00047 mDeviceName = device_name; 00048 mPluginId = plugin_guid; 00049 00050 // Create a Header for this packet with the correect type and size. 00051 mHeader = new Header(Header::RIM_PACKET, 00052 Header::RIM_DEVICE_REQ, 00053 Header::RIM_PACKET_HEAD_SIZE 00054 + 16 /*Plugin GUID*/ 00055 + vpr::BufferObjectReader::STRING_LENGTH_SIZE 00056 + mDeviceName.size(), 00057 0/*Field not curently used*/); 00058 // Serialize the given data. 00059 serialize(); 00060 }
| void cluster::DeviceRequest::serialize | ( | ) |
Serializes member variables into a data stream.
Definition at line 62 of file DeviceRequest.cpp.
References cluster::Packet::mHeader, cluster::Packet::mPacketWriter, cluster::Packet::mPluginId, and cluster::Header::serializeHeader().
Referenced by DeviceRequest().
00063 { 00064 // Clear the data stream. 00065 mPacketWriter->getData()->clear(); 00066 mPacketWriter->setCurPos(0); 00067 00068 // Serialize the header. 00069 mHeader->serializeHeader(); 00070 00071 // Serialize plugin GUID. 00072 mPluginId.writeObject(mPacketWriter); 00073 00074 // Serialize the name of the requested device. 00075 mPacketWriter->writeString(mDeviceName); 00076 }
| void cluster::DeviceRequest::parse | ( | vpr::BufferObjectReader * | reader | ) | [virtual] |
Parses the data stream into the local member variables.
Implements cluster::Packet.
Definition at line 77 of file DeviceRequest.cpp.
References cluster::Packet::mPluginId.
00078 { 00079 // De-Serialize plugin GUID 00080 mPluginId.readObject(reader); 00081 00082 // De-Serialize the name of the requested device. 00083 mDeviceName = reader->readString(); 00084 }
| void cluster::DeviceRequest::printData | ( | int | debug_level | ) | [virtual] |
Print the data to the screen in a readable form.
Implements cluster::Packet.
Definition at line 86 of file DeviceRequest.cpp.
References gadgetDBG_RIM(), cluster::Packet::mPluginId, and cluster::Packet::printData().
00087 { 00088 vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level) 00089 << clrOutBOLD(clrYELLOW,"==== Device Request Packet Data ====\n") << vprDEBUG_FLUSH; 00090 00091 Packet::printData(debug_level); 00092 00093 vprDEBUG(gadgetDBG_RIM,debug_level) 00094 << clrOutBOLD(clrYELLOW, "Plugin GUID: ") << mPluginId.toString() 00095 << std::endl << vprDEBUG_FLUSH; 00096 vprDEBUG(gadgetDBG_RIM,debug_level) 00097 << clrOutBOLD(clrYELLOW, "Device Name: ") << mDeviceName 00098 << std::endl << vprDEBUG_FLUSH; 00099 00100 vprDEBUG_END(gadgetDBG_RIM,debug_level) 00101 << clrOutBOLD(clrYELLOW,"====================================\n") << vprDEBUG_FLUSH; 00102 }
| static vpr::Uint16 cluster::DeviceRequest::getPacketFactoryType | ( | ) | [inline, static] |
Return the type of this packet.
Definition at line 86 of file DeviceRequest.h.
References cluster::Header::RIM_DEVICE_REQ.
00087 { 00088 return(Header::RIM_DEVICE_REQ); 00089 }
| std::string cluster::DeviceRequest::getDeviceName | ( | ) | [inline] |
Return the name of the remote device being requested.
Definition at line 94 of file DeviceRequest.h.
1.5.1