ITS
RepetitionPacketEntry.cpp
Go to the documentation of this file.
2 
4 {
5  m_timer = new QTimer(this);
6  m_elapsed = new QElapsedTimer();
7 }
8 
10 {
11  m_gnDR = gnDR;
12  if(m_gnDR.repetitionInterval == NULL)
13  m_gnDR.repetitionInterval = (quint16*) calloc(1, sizeof(quint16));
14  if(m_gnDR.maximumRepetitionTime == NULL)
15  m_gnDR.maximumRepetitionTime = (quint16*) calloc(1, sizeof(quint16));
16  m_timer = new QTimer(this);
17  m_elapsed = new QElapsedTimer();
18 }
19 
21 {
22  m_gnDR = other.m_gnDR;
23  m_timer = other.m_timer;
24  m_elapsed = other.m_elapsed;
25 }
26 
28 {
29  bool b = true;
30  if(m_gnDR.payload.toHex() != other.m_gnDR.payload.toHex())
31  b = false;
33  b = false;
35  b = false;
37  b = false;
39  b = false;
41  {
43  b = false;
44  for(int i=0; i < 6; i++)
46  b = false;
47  }
48  return b;
49 }
50 
52 {
53  m_gnDR = other.m_gnDR;
54 
55  return *this;
56 }
57 
59 {
60  m_timer->setInterval(*m_gnDR.repetitionInterval);
61  m_timer->setSingleShot(false);
62  connect(m_timer, SIGNAL(timeout()), this, SLOT(repeat()));
63  m_elapsed->start();
64  m_timer->start();
65 }
66 
68 {
69  if(m_elapsed->elapsed() >= *m_gnDR.maximumRepetitionTime)
70  {
71  emit isOver();
72  kill();
73  }
74  else if(m_timer->isActive())
75  emit sendPacket(m_gnDR);
76 }
77 
79 {
80  m_timer->stop();
81  this->deleteLater();
82 }
gnDataRequest_t structure is the GN data request definition.
Definition: GNDataRequest.h:46
quint16 * repetitionInterval
Definition: GNDataRequest.h:56
quint16 * maximumRepetitionTime
Definition: GNDataRequest.h:57
void isOver()
isOver Signal used when entry is over.
QElapsedTimer * m_elapsed
RepetitionPacketEntry & operator=(const RepetitionPacketEntry &other)
operator= RepetitionPacketEntry affectation operator.
gnDataRequest_t m_gnDR
void repeat()
repeat Slot used to repeat packet.
RepetitionPacketEntry()
RepetitionPacketEntry Default constructor.
destinationAddress_t destinationAddress
Definition: GNDataRequest.h:53
quint8 packetTransportSubType
Definition: GNDataRequest.h:50
QTimer * m_timer
quint16 stationType_StationCountryCode
Definition: GnAddr.h:24
gnDataRequest_t gnDR() const
gnDR Entry GN Data Request getter.
void execute()
execute Slot used to execute timers and add entries.
sniff_gnAddr_t gnAddr
Definition: GNDataRequest.h:38
quint16 destinationPort
Definition: GNDataRequest.h:51
bool operator==(const RepetitionPacketEntry &other)
operator== RepetitionPacketEntry comparison operator.
Repetition of the RepetitionPacketBuffer.
CommonHeader::e_headerType packetTransportType
Definition: GNDataRequest.h:49
e_destinationAddress_PR_present present
Definition: GNDataRequest.h:32
union destinationAddress_s::@2 choice
The choice union is composed by a GN_ADDR or a destination area.
QByteArray payload
Definition: GNDataRequest.h:60
void sendPacket(gnDataRequest_t packet)
sendPacket Signal used to send packet.
void kill()
kill Slot used to kill entry.
quint8 mid[6]
Definition: GnAddr.h:25