ITS
DestinationArea.cpp
Go to the documentation of this file.
1 #include "DestinationArea.h"
2 
4 {
7  m_distanceA=0;
8  m_distanceB=0;
9  m_angle=0;
10  m_reserved = 0;
11 }
12 
13 DestinationArea::DestinationArea(qint32 geoAreaPosLatitude, qint32 geoAreaPosLongitude, quint16 distanceA, quint16 distanceB, quint16 angle)
14 {
19  m_angle = angle;
20  m_reserved = 0;
21 }
22 
24 {
27  this->m_distanceA = other.m_distanceA;
28  this->m_distanceB = other.m_distanceB;
29  this->m_angle = other.m_angle;
30  this->m_reserved = other.m_reserved;
31 }
32 
34 {
37  m_distanceA = (da.distanceA);
38  m_distanceB = (da.distanceB);
39  m_angle = (da.angle);
40 }
41 
43 {
44 }
45 
46 quint64 DestinationArea::extract(uchar* packet)
47 {
48  quint64 offset = 0;
49 
50  offset += get_INT32(packet + offset, &m_geoAreaPosLatitude);
51  offset += get_INT32(packet + offset, &m_geoAreaPosLongitude);
52  offset += get_UINT16(packet + offset, &m_distanceA);
53  offset += get_UINT16(packet + offset, &m_distanceB);
54  offset += get_UINT16(packet + offset, &m_angle);
55  offset += get_UINT16(packet + offset, &m_reserved);
56 
57  return offset;
58 }
59 
61 {
62  QByteArray hex;
63  QDataStream ds(&hex, QIODevice::WriteOnly);
64 
67  ds << m_distanceA;
68  ds << m_distanceB;
69  ds << m_angle;
70  ds << m_reserved;
71 
72  return hex;
73 }
qint32 m_geoAreaPosLatitude
quint64 get_INT32(u_char *field, qint32 *int32)
get_INT32 Extract an integer encoded in 32 bits from a byte array.
Definition: apiNetwork.cpp:29
quint16 distanceB() const
geoAreaPosLatitude Distance B field getter.
The sniff_destinationArea_t is a C version of the class.
Destination area structure.
qint32 geoAreaPosLatitude() const
geoAreaPosLatitude Geo area position latitude field getter.
quint16 angle() const
geoAreaPosLatitude Angle field getter.
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 DestinationArea.
qint32 geoAreaPosLongitude() const
geoAreaPosLatitude Geo area position longitude field getter.
quint64 extract(uchar *packet)
extract Extract DestinationArea from byte array.
qint32 m_geoAreaPosLongitude
DestinationArea()
DestinationArea DestinationArea constructor.
quint16 distanceA() const
geoAreaPosLatitude Distance A field getter.