ITS
PacketBuffersEntry.cpp
Go to the documentation of this file.
1 #include "PacketBuffersEntry.h"
2 
4 {
5 }
6 
8 {
9  m_bh = bh;
10  m_ch = ch;
11  m_payload = QByteArray();
12  m_beac = packet;
13  for(int i=0; i<6; i++)
14  {
15  m_destination[i] = 0;
16  m_forwarder[i] = 0;
17  }
18 }
19 
21 {
22  m_bh = bh;
23  m_ch = ch;
24  m_payload = QByteArray();
25  m_lsRequest = packet;
26  for(int i=0; i<6; i++)
27  {
28  m_destination[i] = 0;
29  m_forwarder[i] = 0;
30  }
31 }
32 
34 {
35  m_bh = bh;
36  m_ch = ch;
37  m_payload = QByteArray();
38  m_lsReply = packet;
39  for(int i=0; i<6; i++)
40  {
41  m_destination[i] = 0;
42  m_forwarder[i] = 0;
43  }
44 }
45 
46 PacketBuffersEntry::PacketBuffersEntry(BasicHeader bh, CommonHeader ch, GACPacket packet, QByteArray payload, uchar* destination, uchar* forwarder)
47 {
48  m_bh = bh;
49  m_ch = ch;
51  m_gac = packet;
52  for(int i=0; i<6; i++)
53  {
54  m_destination[i] = destination[i];
55  m_forwarder[i] = forwarder[i];
56  }
57 }
58 
59 PacketBuffersEntry::PacketBuffersEntry(BasicHeader bh, CommonHeader ch, GBCPacket packet, QByteArray payload, uchar* destination, uchar* forwarder)
60 {
61  m_bh = bh;
62  m_ch = ch;
64  m_gbc = packet;
65  for(int i=0; i<6; i++)
66  {
67  m_destination[i] = destination[i];
68  m_forwarder[i] = forwarder[i];
69  }
70 }
71 
73 {
74  m_bh = bh;
75  m_ch = ch;
77  m_guc = packet;
78  for(int i=0; i<6; i++)
79  {
80  m_destination[i] = 0;
81  m_forwarder[i] = 0;
82  }
83 }
84 
86 {
87  m_bh = bh;
88  m_ch = ch;
90  m_tsb = packet;
91  for(int i=0; i<6; i++)
92  {
93  m_destination[i] = 0;
94  m_forwarder[i] = 0;
95  }
96 }
97 
99 {
100  m_bh = bh;
101  m_ch = ch;
102  m_payload = payload;
103  m_shb = packet;
104  for(int i=0; i<6; i++)
105  {
106  m_destination[i] = 0;
107  m_forwarder[i] = 0;
108  }
109 }
110 
111 
113 {
114  m_bh = other.m_bh;
115  m_ch = other.m_ch;
116  m_payload = other.m_payload;
117  for(int i=0; i<6; i++)
118  {
119  m_destination[i] = other.m_destination[i];
120  m_forwarder[i] = other.m_forwarder[i];
121  }
122  switch(other.m_ch.headerType())
123  {
125  m_beac = other.m_beac;
126  break;
128  m_gac = other.m_gac;
129  break;
131  m_gbc = other.m_gbc;
132  break;
134  m_guc = other.m_guc;
135  break;
137  switch(other.m_ch.headerSubType())
138  {
140  m_shb = other.m_shb;
141  break;
143  m_tsb= other.m_tsb;
144  break;
145  default:
146  break;
147  }
148  break;
150  switch(other.m_ch.headerSubType())
151  {
153  m_lsRequest = other.m_lsRequest;
154  break;
156  m_lsReply= other.m_lsReply;
157  break;
158  default:
159  break;
160  }
161  break;
163  default:
164  break;
165  }
166 
167  for(int i=0; i<6; i++)
168  {
169  m_destination[i] = other.m_destination[i];
170  m_forwarder[i] = other.m_forwarder[i];
171  }
172 }
173 
175 {
176  if(m_ch.headerType() != other.m_ch.headerType() || m_ch.headerSubType() != other.m_ch.headerSubType())
177  return false;
178 
179  switch(other.m_ch.headerType())
180  {
183  break;
186  break;
189  break;
192  break;
194  switch(other.m_ch.headerSubType())
195  {
198  break;
201  break;
202  default:
203  return false;
204  }
205  break;
207  switch(other.m_ch.headerSubType())
208  {
211  break;
213  m_lsReply= other.m_lsReply;
214  break;
215  default:
216  break;
217  }
218  break;
220  default:
221  return false;
222  break;
223  }
224 
225  return true;
226 }
227 
229 {
230  m_bh = other.m_bh;
231  m_ch = other.m_ch;
232  m_payload = other.m_payload;
233  for(int i=0; i<6; i++)
234  {
235  m_destination[i] = other.m_destination[i];
236  m_forwarder[i] = other.m_forwarder[i];
237  }
238  switch(other.m_ch.headerType())
239  {
241  m_beac = other.m_beac;
242  break;
244  m_gac = other.m_gac;
245  break;
247  m_gbc = other.m_gbc;
248  break;
250  m_guc = other.m_guc;
251  break;
253  switch(other.m_ch.headerSubType())
254  {
256  m_shb = other.m_shb;
257  break;
259  m_tsb= other.m_tsb;
260  break;
261  default:
262  break;
263  }
264  break;
266  switch(other.m_ch.headerSubType())
267  {
269  m_lsRequest = other.m_lsRequest;
270  break;
272  m_lsReply= other.m_lsReply;
273  break;
274  default:
275  break;
276  }
277  break;
279  default:
280  break;
281  }
282 
283  return *this;
284 }
285 
287 {
289  {
290  return m_beac;
291  }
292  else
293  return BeaconPacket();
294 }
295 
297 {
299  {
300  return m_lsRequest;
301  }
302  else
303  return LSRequestPacket();
304 }
305 
307 {
309  {
310  return m_lsReply;
311  }
312  else
313  return LSReplyPacket();
314 }
315 
317 {
319  {
320  return m_gac;
321  }
322  else
323  return GACPacket();
324 }
325 
327 {
329  {
330  return m_gbc;
331  }
332  else
333  return GBCPacket();
334 }
335 
337 {
339  {
340  return m_guc;
341  }
342  else
343  return GUCPacket();
344 }
345 
347 {
349  {
350  return m_shb;
351  }
352  else
353  return SHBPacket();
354 }
355 
357 {
359  {
360  return m_tsb;
361  }
362  else
363  return TSBPacket();
364 }
365 
PacketBuffersEntry()
PacketBuffersEntry PacketBuffersEntry constructor.
bool operator==(const PacketBuffersEntry &other)
operator== PacketBuffersEntry comparison operator.
LSReplyPacket lsReplyPacket()
beaconPacket LSReply entry creation.
QByteArray m_payload
BeaconPacket m_beac
LongPositionVector soPv() const
soPv TSB SO PV getter.
Definition: TSBPacket.h:73
LongPositionVector soPv() const
soPv SO PV getter.
Definition: GBCPacket.h:95
GUCPacket gucPacket()
beaconPacket GUC entry creation.
quint32 timestamp() const
timestamp Timestamp field getter
TSBPacket tsbPacket()
beaconPacket TSB entry creation.
quint16 sequenceNumber() const
sequenceNumber Sequence number getter.
Definition: GBCPacket.h:90
BasicHeader m_bh
GBCPacket m_gbc
GUCPacket m_guc
bool isDuplicatePacketDetectionTimestampSN(quint32 lastReceivedTimestamp, quint32 nowReceivedTimestamp, quint16 lastReceivedSN, quint16 nowReceivedSN)
isDuplicatePacketDetectionTimestamp Calculate if the packet is a duplicate using the timestamp and th...
Definition: apiNetwork.cpp:104
GBCPacket gbcPacket()
beaconPacket GBC entry creation.
GACPacket gacPacket()
beaconPacket GAC entry creation.
QByteArray payload() const
basicHeader Entry payload getter.
Generic buffer entry.
uchar * destination()
destination Entry destination getter.
uchar m_destination[6]
LSReplyPacket m_lsReply
quint8 headerType() const
headerType Header field getter.
Definition: CommonHeader.h:193
uchar * forwarder()
forwarder Entry forwarder getter.
uchar m_forwarder[6]
GACPacket m_gac
quint16 sequenceNumber() const
sequenceNumber TSB sequence number getter.
Definition: TSBPacket.h:68
CommonHeader m_ch
quint8 headerSubType() const
headerSubType Header sub-type field getter.
Definition: CommonHeader.h:198
SHBPacket m_shb
PacketBuffersEntry & operator=(const PacketBuffersEntry &other)
operator= PacketBuffersEntry affectation operator.
SHBPacket shbPacket()
beaconPacket SHB entry creation.
bool isDuplicatePacketDetectionTimestamp(quint32 lastReceivedTimestamp, quint32 nowReceivedTimestamp)
isDuplicatePacketDetectionTimestamp Calculate if the packet is a duplicate using the timestamp of the...
Definition: apiNetwork.cpp:95
LSRequestPacket m_lsRequest
TSBPacket m_tsb
quint16 sequenceNumber() const
sequenceNumber GUC sequence number getter.
Definition: GUCPacket.h:72
LongPositionVector soPv() const
soPv SHB SO PV getter.
Definition: SHBPacket.h:66
LongPositionVector soPv() const
soPv GUC SO PV getter.
Definition: GUCPacket.h:77
LSRequestPacket lsRequestPacket()
beaconPacket LSRequest entry creation.
BeaconPacket beaconPacket()
beaconPacket Beacon entry creation.
LongPositionVector soPv() const
soPv SO PV getter.
Definition: BeaconPacket.h:63