Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00028
00029 #include <driver_svh/SVHSerialPacket.h>
00030
00031 namespace driver_svh {
00032
00033 icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHSerialPacket& data)
00034 {
00035 ab << data.index << data.address << static_cast<uint16_t>(data.data.size()) << data.data;
00036 return ab;
00037 }
00038
00039 icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHSerialPacket& data)
00040 {
00041
00042 uint16_t size ;
00043 ab >> data.index >> data.address >> size >> data.data;
00044 return ab;
00045 }
00046
00047 std::ostream& operator << (std::ostream& o, const SVHSerialPacket& sp)
00048 {
00049 o << "index: " << static_cast<int>(sp.index) << " address: " << "0x" << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(sp.address) << " Data: ";
00050 for (size_t i = 0; i < sp.data.size(); i++)
00051 {
00052 o << "0x" << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(sp.data[i]) << " ";
00053 }
00054
00055 std::cout << std::dec ;
00056 return o;
00057 }
00058
00059 }
00060