ITS
TSBPacket.cpp
Go to the documentation of this file.
1 #include "TSBPacket.h"
2 
4 {
5  m_reserved = 0;
6 }
7 
8 TSBPacket::TSBPacket(quint16 sequenceNumber, LongPositionVector lpv)
9 {
11  m_reserved = 0;
12  m_soPv = lpv;
13 }
14 
16 {
17  this->m_sequenceNumber = other.m_sequenceNumber;
18  this->m_reserved = other.m_reserved;
19  this->m_soPv = other.soPv();
20 }
21 
23 {
24 }
25 
26 quint64 TSBPacket::extract(uchar* packet)
27 {
28  quint64 offset = 0;
29 
30  offset += get_UINT16(packet + offset, &m_sequenceNumber);
31  offset += get_UINT16(packet + offset, &m_reserved);
32  offset += m_soPv.extract(packet + offset);
33 
34  return offset;
35 }
36 
37 QByteArray TSBPacket::toHex()
38 {
39  QByteArray hex;
40  QDataStream ds(&hex, QIODevice::WriteOnly);
41 
42  ds << m_sequenceNumber;
43  ds << m_reserved;
44  ds.writeRawData(m_soPv.toHex().data(), LongPositionVector::helper_size);
45 
46  return hex;
47 }
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GBCPacket.
Definition: TSBPacket.cpp:37
TSBPacket()
TSBPacket TSBPacket constructor.
Definition: TSBPacket.cpp:3
LongPositionVector m_soPv
Definition: TSBPacket.h:83
quint64 extract(uchar *packet)
extract Extract GBC from packet.
Definition: TSBPacket.cpp:26
LongPositionVector soPv() const
soPv TSB SO PV getter.
Definition: TSBPacket.h:73
TSB packet structure.
quint64 extract(uchar *packet)
extract Fill the LongPositionVector with values contained in the packet
quint16 m_reserved
Definition: TSBPacket.h:82
quint16 sequenceNumber() const
sequenceNumber TSB sequence number getter.
Definition: TSBPacket.h:68
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.
~TSBPacket()
~TSBPacket The TSBPacket destructor.
Definition: TSBPacket.cpp:22
quint16 m_sequenceNumber
Definition: TSBPacket.h:81