ITS
denMessageTableSource.cpp
Go to the documentation of this file.
2 
4 {
5  memset(&m_denm, 0, sizeof m_denm);
6  memset(&m_timestamp, 0, sizeof m_timestamp);
8  m_T_O_Validity = -1;
10  m_T_Repetition = -1;
11  m_thread = new QThread;
12  QObject::connect(m_thread, SIGNAL(started()), this, SLOT(execute()));
13 }
14 
16 {
17  setDENM(messageTable.denm());
18  setStatus(messageTable.status());
19  setTimestamp(messageTable.timestamp());
20  setT_O_Validity(messageTable.T_O_Validity());
22  setT_Repetition(messageTable.T_Repetition());
23  setTrafficClass(messageTable.trafficClass());
24  setActionID(messageTable.actionID());
25  m_thread = messageTable.m_thread;
26 }
27 
29 {
30  qDebug() << "V" << m_T_O_Validity << "RD" << m_T_RepetitionDuration << "R" << m_T_Repetition;
34 
35  QObject::connect(m_validity, SIGNAL(T_O_ValiditySignal()), this, SLOT(endOfT_O_Validity()));
36  QObject::connect(m_repetitionDuration, SIGNAL(T_RepetitionDurationSignal()), this, SLOT(endOfT_RepetitionDuration()));
37  QObject::connect(m_repetition, SIGNAL(T_RepetitionSignal()), this, SLOT(endOfT_Repetition()));
38 
39  if(m_validity->timer() > -1)
40  {
42  QTimer::singleShot(m_validity->timer(), m_validity, SLOT(endOfT_O_Validity()));
43  qDebug() << "singleshot V" << m_validity->timer();
44  }
45  if(m_repetitionDuration->timer() > -1)
46  {
49  qDebug() << "singleshot RD" << m_repetitionDuration->timer();
50  }
51  if(m_repetition->timer() > -1)
52  {
54  QTimer::singleShot(m_repetition->timer(), m_repetition, SLOT(endOfT_Repetition()));
55  qDebug() << "singleshot R" << m_repetition->timer();
56  }
57 }
58 
60 {
61  this->m_destination = other.destinationArea();
62  this->setDENM(other.denm());
63  this->setStatus(other.status());
64  this->setTimestamp(other.timestamp());
65  this->setT_O_Validity(other.T_O_Validity());
67  this->setT_Repetition(other.T_Repetition());
68  this->setTrafficClass(other.trafficClass());
69  this->setActionID(other.actionID());
70  this->m_validity = other.m_validity;
72  this->m_repetition = other.m_repetition;
73 
74  return *this;
75 }
76 
78 {
79  setT_O_Validity(-1);
81  setT_Repetition(-1);
85 }
86 
88 {
89  /* 1) Stop timer T_Repetition if exists. */
90  printf("Repetition Termination in DMTS::endOfTOV\n");
93 
94  /* 2) Stop timer T_RepetitionDuration if exists. */
95  printf("RepetitionDuration Termination in DMTS::endOfTOV\n");
98 
99  /* 3) Discard the expired DENM entry from the originating ITS-S message table. */
100  printf("EMIT TOVSignal\n");
102 }
103 
105 {
106  /* 1) Stop timer T_Repetition. */
107  printf("Repetition Termination in DMTS::endOfRD\n");
108  m_repetition->setTimer(-1);
110 }
111 
113 {
114 
115  /* 1) Pass the DENM to ITS networking & transport layer. */
116  printf("EMIT TRSignal\n");
118 
119  if(m_repetition->timer() > -1)
120  {
121  /* 2) Restart timer T_Repetition. */
122  printf("Start Repetition timer\n");
123  qDebug() << m_repetition->timer();
126  printf("EndOfR\n");
127 // emit DENMrepeated();
128  }
129 
130 }
quint8 trafficClass() const
trafficClass DENM&#39;s traffic class getter.
DecentralizedEnvironmentalNotificationMessage_t denm
Definition: DENM.h:25
int status() const
status DENM&#39;s status getter.
void execute()
execute Execute the timers.
void setTimer(qint64 t)
setTimer Timer setter.
qint64 T_O_Validity() const
T_O_Validity T_O_Validity getter.
void setT_Repetition(qint32 t)
setT_Repetition T_Repetition setter.
void setT_RepetitionDuration(qint32 t)
setT_RepetitionDuration T_RepetitionDuration setter.
void setActionID(ActionID_t a)
setActionID DENM&#39;s ActionID setter.
qint32 T_RepetitionDuration() const
T_RepetitionDuration T_RepetitionDuration getter.
int asn_long2INTEGER(INTEGER_t *i, long l)
Definition: INTEGER.c:882
DestinationAreaData m_destination
void setStatus(int s)
setStatus DENM&#39;s status setter.
denMessageTableSourceThread * m_repetitionDuration
void setT_O_Validity(qint64 t)
setT_O_Validity T_O_Validity setter.
void endOfT_Repetition()
T_Repetition Slot used when T_Repetition expires.
denMessageTableSource()
denMessageTableSource denMessageTableSource constructor.
void T_O_ValiditySignal(ActionID_t)
T_O_ValiditySignal Signal used when T_O_Validity expires.
ActionID_t actionID() const
actionID DENM&#39;s ActionID getter.
void endOfT_RepetitionDuration()
endOfT_RepetitionDuration Slot used when T_RepetitionDuration expires.
void setTimestamp(TimestampIts_t t)
setTimestamp DENM&#39;s timestamp setter.
qint32 T_Repetition() const
T_Repetition T_Repetition getter.
denMessageTableSource & operator=(const denMessageTableSource &other)
operator= Affectation operator.
void endOfT_O_Validity()
endOfT_O_Validity Slot used when T_O_Validity expires.
qint64 timer() const
timer Timer getter.
DEN Message Table Source.
denMessageTableSourceThread * m_validity
DENM_t denm() const
denm DENM getter.
void T_RepetitionSignal(ActionID_t)
T_RepetitionSignal Signal used when T_Repetition expires.
DestinationAreaData destinationArea() const
destinationArea DENM&#39;s destination area getter.
denMessageTableSourceThread * m_repetition
TimestampIts_t timestamp() const
timestamp DENM&#39;s timestamp getter.
void setDENM(DENM_t d)
setDENM DENM setter.
void setTrafficClass(quint8 t)
setTrafficClass DENM&#39;s traffic class setter.
void stopTimer()
stopTimer Stop the timer.