ITS
GUCPacket.cpp
Go to the documentation of this file.
1 #include "GUCPacket.h"
2 
4 {
5  m_reserved = 0;
6 }
7 
9 {
11  m_reserved = 0;
12  m_soPv = lpv;
13  m_dePv = spv;
14 }
15 
17 {
18  this->m_sequenceNumber = other.m_sequenceNumber;
19  this->m_reserved = other.m_reserved;
20  this->m_soPv = other.soPv();
21  this->m_dePv = other.dePv();
22 }
23 
24 
26 {
27 }
28 
29 quint64 GUCPacket::extract(uchar* packet)
30 {
31  quint64 offset = 0;
32 
33  offset += get_UINT16(packet + offset, &m_sequenceNumber);
34  offset += get_UINT16(packet + offset, &m_reserved);
35  offset += m_soPv.extract(packet + offset);
36  offset += m_dePv.extract(packet + offset);
37 
38  return offset;
39 }
40 
41 QByteArray GUCPacket::toHex()
42 {
43  QByteArray hex;
44  QDataStream ds(&hex, QIODevice::WriteOnly);
45 
46  ds << m_sequenceNumber;
47  ds << m_reserved;
48  ds.writeRawData(m_soPv.toHex().data(), LongPositionVector::helper_size);
49  ds.writeRawData(m_dePv.toHex().data(), ShortPositionVector::helper_size);
50 
51  return hex;
52 }
53 
quint64 extract(uchar *packet)
extract Fill the ShortPositionVector with values contained in the packet
quint64 extract(uchar *packet)
extract Extract GUCPacket from packet.
Definition: GUCPacket.cpp:29
~GUCPacket()
~GUCPacket GUCPacket destructor.
Definition: GUCPacket.cpp:25
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the ShortPositionVector.
quint64 extract(uchar *packet)
extract Fill the LongPositionVector with values contained in the packet
ShortPositionVector m_dePv
Definition: GUCPacket.h:103
quint16 m_reserved
Definition: GUCPacket.h:101
GUC packet structure.
ShortPositionVector dePv() const
dePv GUC DE PV getter.
Definition: GUCPacket.h:82
quint64 get_UINT16(u_char *field, quint16 *uint16)
get_INT64 Extract an integer encoded in 64 bits from a byte array.
Definition: apiNetwork.cpp:69
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the LongPositionVector.
GUCPacket()
GUCPacket GUCPacket constructor.
Definition: GUCPacket.cpp:3
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GBCPacket.
Definition: GUCPacket.cpp:41
quint16 m_sequenceNumber
Definition: GUCPacket.h:100
quint16 sequenceNumber() const
sequenceNumber GUC sequence number getter.
Definition: GUCPacket.h:72
LongPositionVector m_soPv
Definition: GUCPacket.h:102
LongPositionVector soPv() const
soPv GUC SO PV getter.
Definition: GUCPacket.h:77