ITS
CBFPacketBuffer.h
Go to the documentation of this file.
1 
7 #ifndef CBFPacketBuffer_H
8 #define CBFPacketBuffer_H
9 
10 #include <QObject>
11 #include <QVector>
12 #include <QThread>
13 #include <apiNetwork.h>
14 #include <LifeTime.h>
15 #include <LocationTableEntry.h>
16 #include <CBFPacketEntry.h>
17 
18 class CBFPacketBuffer : public QObject
19 {
20  Q_OBJECT
21 public:
22  /* Constructors */
27 
33  CBFPacketBuffer(ParameterNetwork* paramNetwork, QHash<QByteArray, LocationTableEntry>* locT, GnAddr* gnaddr, FakeGPSProvider* paramGPS, HistoryPacketBuffer* HPB, quint16* SN, QHash<QByteArray, int> *CBFPBCounter);
34 
39  CBFPacketBuffer(const CBFPacketBuffer& other);
40 
50  int addPacket(BasicHeader bh, CommonHeader ch, GBCPacket packet, QByteArray payload, int timeToBuffer);
60  int addPacket(BasicHeader bh, CommonHeader ch, GUCPacket packet, QByteArray payload, int timeToBuffer);
70  int addPacket(BasicHeader bh, CommonHeader ch, LSReplyPacket packet, QByteArray payload, int timeToBuffer);
76  bool isDuplicateTimestamp(GBCPacket packet);
82  bool isDuplicateTimestamp(GUCPacket packet);
94  bool erase(GBCPacket packet);
100  bool erase(GUCPacket packet);
106  bool erase(LSReplyPacket packet);
107 
114  bool update(GBCPacket packet, int timeToBuffer);
121  bool update(GUCPacket packet, int timeToBuffer);
128  bool update(LSReplyPacket packet, int timeToBuffer);
129 
130  static int nbCBFPacketQueued;
135  void clear();
136 
137  QMutex* m_mutex;
139 signals:
143  void lpvSent();
147  void killAll();
148 
149 public slots:
154  void sendPacket(GBCPacket packet);
159  void sendPacket(GUCPacket packet);
164  void sendPacket(LSReplyPacket packet);
169  void stopPacket(GBCPacket packet);
174  void stopPacket(GUCPacket packet);
179  void stopPacket(LSReplyPacket packet);
180 
181 private:
182  QVector<CBFPacketEntry*> m_CBFPacketBuffer;
184  QHash<QByteArray, LocationTableEntry>* m_locationTable;
189  quint16* sequenceNumber;
190  QHash<QByteArray, int> *m_CBFPBCounter;
191 };
192 
193 #endif // _CBFPacketBuffer_H_
Location table entry definition.
quint16 * sequenceNumber
void clear()
clear Clear the buffer.
HistoryPacketBuffer * m_HPB
void stopPacket(GBCPacket packet)
stopPacket Slot used to stop the packet (GBC case).
Entry of the CBFPacketBuffer.
static int nbCBFPacketQueued
QVector< CBFPacketEntry * > m_CBFPacketBuffer
bool update(GBCPacket packet, int timeToBuffer)
update Update the packet of the buffer.
bool erase(GBCPacket packet)
erase Remove packet from the buffer.
FakeGPSProvider * m_paramGPS
void killAll()
killAll Signal used to kill all the buffer entries.
QHash< QByteArray, int > * m_CBFPBCounter
void sendPacket(GBCPacket packet)
sendPacket Slot used to send packet (GBC case).
int addPacket(BasicHeader bh, CommonHeader ch, GBCPacket packet, QByteArray payload, int timeToBuffer)
addPacket Add packet to the buffer.
bool isDuplicateTimestamp(GBCPacket packet)
isDuplicateTimestamp Check is the packet is duplicate.
Definition: GnAddr.h:28
QHash< QByteArray, LocationTableEntry > * m_locationTable
Life time definition.
ParameterNetwork * m_paramNetwork
CBFPacketBuffer()
CBFPacketBuffer Default constructor.
void lpvSent()
lpvSent Signal sent to advertised of an LPV sending.