ITS
caBasicService.h
Go to the documentation of this file.
1 
7 #ifndef caBasicService_H
8 #define caBasicService_H
9 
10 #include <QObject>
11 #include <QUdpSocket>
12 #include <QTime>
13 #include <QThread>
14 #include <QList>
15 #include <QElapsedTimer>
16 
17 #include <CAM.h>
18 #include <apiCAM.h>
19 
20 #include <caReceptionManagement.h>
21 
22 #include <api.h>
23 #include <constantes.h>
24 
25 #include <facilitiesApi.h>
26 
27 #include <CAM.h>
28 #include <Geonet.h>
29 
30 #define DEFAULT_N_GEN_CAM 3
31 #define MAX_REFERENCEPOSITION 40
32 
33 class caBasicService : public QThread
34 {
35  Q_OBJECT
36 public:
45  caBasicService(GeoNet* geonet, FakeGPSProvider* paramGPS, ParameterConfiguration* paramConf,
46  FakeApplicationProvider* paramAppli, FakeCANProvider* paramCAN);
47 
48  /* Getters */
53  quint16 T_GenCam_DCC() const{return m_T_GenCam_DCC;}
58  quint16 T_GenCam() const{return m_T_GenCam;}
63  quint16 N_GenCam() const{return m_N_GenCam;}
68  quint16 T_CheckGenCam() const{return m_T_CheckGenCam;}
73  CAM_t currentCAM() const{return m_currentCAM;}
78  CAM_t previousCAM() const{return m_previousCAM;}
83  QTime previousTime() const{return m_previousTime;}
88  QTime lastLF() const{return m_lastLF;}
93  quint64 timestamp() const{return m_paramGPS->timestamp();}
94 
95  /* Setters */
100  void setT_GenCam_DCC(quint16 t){m_T_GenCam_DCC = t;}
105  void setT_GenCam(quint16 t){m_T_GenCam = t;}
110  void setN_GenCam(quint16 n){m_N_GenCam = n;}
115  void setT_CheckGenCam(quint16 t){m_T_CheckGenCam = t;}
130  void setPreviousTime(QTime p){m_previousTime = p;}
135  void setLastLF(QTime l){m_lastLF = l;}
136 
141  bool checkCamGeneration();
162  void PassCamToNetworkAndTransportLayer(char *cam, int camLength);
230 
231  //void checkToSendCAM();
232 
243  PathPoint_t getPathPoint(int i);
248  void checkPathPoint(int i);
249 
253  void utInitialize();
254 
255 public slots:
259  void execute();
263  void checkToSendCAM();
264 
265 private:
266  quint16 m_T_GenCam_DCC;
267  quint16 m_T_GenCam;
268  quint16 m_N_GenCam;
272  QUdpSocket *udpSocket;
274  QTime m_lastLF;
276  QElapsedTimer m_elapsed;
277  bool m_quick;
280  QTimer m_timer;
289  QList<ReferencePosition_t> m_listReferencePosition;
290  QList<GenerationDeltaTime_t> m_listGenerationDeltaTime;
293  void reset();
294 };
295 
296 #endif // caBasicService_H
PathPoint_t m_listPathPoint[MAX_REFERENCEPOSITION]
PathHistory_t getPathHistory()
getPathHistory PathHistory getter.
quint16 N_GenCam() const
N_GenCam N_GenCam getter.
Usefull functions and declarations.
bool checkForOptionalContainers()
checkForOptionalContainers Check if there need optional data.
void setLastLF(QTime l)
setLastLF Set the time where the last CAM had a LowFrequencyContainer.
QTime previousTime() const
previousTime Time of the previous CAM getter.
void execute()
execute Slot used for the first loop.
CAM_t currentCAM() const
currentCAM Current CAM getter.
quint16 m_T_GenCam_DCC
Definition: CAM.h:23
FakeGPSProvider * m_paramGPS
void PassCamToNetworkAndTransportLayer(char *cam, int camLength)
PassCamToNetworkAndTransportLayer Pass the encoded CAM to the N&T layer.
CAM_t previousCAM() const
previousCAM Previous CAM getter
SpecialVehicleContainer_t collectOptionalData_SpecialVehicleContainer(VehicleRole_t v)
collectOptionalData_SpecialVehicleContainer Collect optional data for the SpecialVehicleContainer.
quint16 T_GenCam_DCC() const
T_GenCam_DCC T_GenCam_DCC getter.
QElapsedTimer m_elapsed
QList< GenerationDeltaTime_t > m_listGenerationDeltaTime
bool checkCamGeneration()
checkCamGeneration Check if a CAM needs to be generated.
FakeCANProvider * m_paramCAN
quint64 timestamp()
timestamp Timestamp getter.
RoadWorksContainerBasic_t collectOptionalData_RoadWorksContainerbasic()
collectOptionalData_RoadWorksContainerbasic Collect optional data for the RoadWorksContainerBasic.
FakeApplicationProvider * m_paramAppli
EmergencyContainer_t collectOptionalData_EmergencyContainer()
collectOptionalData_EmergencyContainer Collect optional data for the EmergencyContainer.
N&T layer.
BasicVehicleContainerLowFrequency_t collectOptionalData_BasicVehicleContainerLowFrequency()
collectOptionalData_BasicVehicleContainerLowFrequency Collect optional data for the BasicVehicleConta...
bool needSpecialVehicleContainer(VehicleRole_t role)
needSpecialVehicleContainer Check if there need SpecialVehicleContainer.
SpecialTransportContainer_t collectOptionalData_SpecialTransportContainer()
collectOptionalData_SpecialTransportContainer Collect optional data for the SpecialTransportContainer...
quint16 T_CheckGenCam() const
T_CheckGenCam T_CheckCamm getter.
CAM_t collectMandatoryData()
collectMandatoryData Collect the CAM mandatory data.
QUdpSocket * udpSocket
void checkToSendCAM()
checkToSendCAM Slot used when there need to check if we need to send CAM.
void setCurrentCAM(CAM_t c)
setCurrentCAM Set the current CAM.
ParameterConfiguration * m_paramConf
BasicContainer_t collectMandatoryData_BasicContainer()
collectMandatoryData_BasicContainer Collect mandatory data for the BasicContainer.
void setT_GenCam_DCC(quint16 t)
setT_GenCam_DCC Set the T_GenCam_DCC.
void checkPathPoint(int i)
checkPathPoint Check a PathPoint.
CAM reception management.
QTime lastLF() const
lastLF Last time where a CAM had a LowFrequencyContainer.
QList< ReferencePosition_t > m_listReferencePosition
Constantes used everywhere.
long VehicleRole_t
Definition: VehicleRole.h:41
quint64 timestamp() const
timestamp Current timestamp getter.
void setPreviousTime(QTime p)
setPreviousTime Set the time where the previous CAM was sent.
ItsPduHeader_t header
void setT_CheckGenCam(quint16 t)
setT_CheckGenCam Set the T_CheckGenCam.
SafetyCarContainer_t collectOptionalData_SafetyCarContainer()
collectOptionalData_SafetyCarContainer Collect optional data for the SafetyCarContainer.
void setT_GenCam(quint16 t)
setT_GenCam Set the T_GenCam.
quint16 m_T_CheckGenCam
API used by the Facilities layer.
PathPoint_t getPathPoint(int i)
getPathPoint PathPoint getter.
BasicVehicleContainerHighFrequency_t collectMandatoryData_BasicVehicleContainerHighFrequency()
collectMandatoryData_BasicVehicleContainerHighFrequency Collect mandatory data for the BasicVehicleCo...
RescueContainer_t collectOptionalData_RescueContainer()
collectOptionalData_RescueContainer Collect optional data for the RescueContainer.
PublicTransportContainer_t collectOptionalData_PublicTransportContainer()
collectOptionalData_PublicTransportContainer Collect optional data for the PublicTransportContainer.
caBasicService(GeoNet *geonet, FakeGPSProvider *paramGPS, ParameterConfiguration *paramConf, FakeApplicationProvider *paramAppli, FakeCANProvider *paramCAN)
caBasicService caBasicService constructor.
void checkAndCollectDataForOptionalContainers(CAM_t *cam)
checkAndCollectDataForOptionalContainers Check and collect data for optional containers.
DangerousGoodsContainer_t collectOptionalData_DangerousGoodsContainer()
collectOptionalData_DangerousGoodsContainer Collect optional data for the DangerousGoodsContainer.
void setN_GenCam(quint16 n)
setN_GenCam Set the N_GenCam
quint16 T_GenCam() const
T_GenCam T_GenCam getter.
CAM_t setCAM(CAM_t c)
setCAM CAM copy.
Definition: Geonet.h:42
void utInitialize()
utInitialize Initialize the CA Basic Service.
RSUContainerHighFrequency_t collectMandatoryData_RSUContainerHighFrequency()
collectMandatoryData_RSUContainerHighFrequency Collect mandatory data for the RSUContainerHighFrequen...
#define MAX_REFERENCEPOSITION
void setPreviousCAM(CAM_t c)
setPreviousCAM Set the previous CAM.