5 #include <QCoreApplication> 25 Q_DECLARE_METATYPE(
DENM_t*)
29 fprintf(stderr,
"Usage : %s <abcfCDgHnuh>\n" 30 "-a --application Activate the application management\n" 31 "-b --bluetooth Activate the Bluetooth communication\n" 32 "-c --can Use the CAN provider\n" 33 "-f --facilities Activate the facilities layer\n" 34 " -C --cam Activate CAM only\n" 35 " -D --denm Activate DENM only\n" 36 "-g --gps Use the GPS provider\n" 37 "-H --hybrid Activate the hybridization\n" 38 "-n --geonet Activate the GeoNetworking layer\n" 39 "-u --upperTester Activate the UpperTester\n" 40 "-h --help Print this message and quit\n", argv);
41 QFile file(
"/etc/its/security/FR01IDN00000001-AT16-verification.cert");
42 file.open(QIODevice::ReadOnly);
43 QByteArray content = file.readAll();
53 printf(
"\nFin volontaire\n\n");
57 int main(
int argc,
char *argv[])
60 QCoreApplication a(argc, argv);
62 setenv(
"TZ",
"UTC", 1);
65 qRegisterMetaType<gnDataRequest_t>(
"gnDataRequest_t");
66 qRegisterMetaType<GBCPacket>(
"GBCPacket");
67 qRegisterMetaType<GUCPacket>(
"GUCPacket");
68 qRegisterMetaType<ActionID_t>(
"ActionID_t");
69 qRegisterMetaType<DENM_t*>(
"DENM_t*");
72 bool applicationFlag =
false, bluetoothFlag =
false, canFlag =
false, facilitiesFlag =
false, geonetFlag =
false,
73 gpsFlag =
false, upperTesterFlag =
false, helpFlag =
false, camFlag =
false, denmFlag =
false, hybridFlag =
false;
75 static struct option long_options[] =
77 {
"application", no_argument, 0,
'a'},
78 {
"bluetooth", no_argument, 0,
'b'},
79 {
"can", no_argument, 0,
'c'},
80 {
"facilities", no_argument, 0,
'f'},
81 {
"cam", no_argument, 0,
'C'},
82 {
"denm", no_argument, 0,
'D'},
83 {
"gpsProvider", no_argument, 0,
'g'},
84 {
"hybrid", no_argument, 0,
'H'},
85 {
"geonet", no_argument, 0,
'n'},
86 {
"upperTester", no_argument, 0,
'u'},
87 {
"help", no_argument, 0,
'h'},
94 while((c = getopt_long(argc, argv,
"abcfCDgHnuh", long_options, &option_index)) != -1)
99 if (long_options[option_index].flag != 0)
101 printf (
"option %s", long_options[option_index].name);
103 printf (
" with arg %s", optarg);
108 applicationFlag =
true;
111 bluetoothFlag =
true;
117 facilitiesFlag =
true;
126 upperTesterFlag =
true;
135 facilitiesFlag =
true;
139 facilitiesFlag =
true;
162 QMutex* mutex =
new QMutex;
181 if(gpsFlag && !upperTesterFlag)
183 QThread* threadGPS =
new QThread;
185 gps->moveToThread(threadGPS);
186 QObject::connect(threadGPS, SIGNAL(started()), gps, SLOT(execute()));
192 if(canFlag && !upperTesterFlag)
197 if(applicationFlag && !upperTesterFlag)
203 QThread* threadManager =
new QThread;
204 man =
new Manager(mutex, gps, can, denm, application, paramUt);
205 man->moveToThread(threadManager);
206 QObject::connect(threadManager, SIGNAL(started()), man, SLOT(execute()));
207 threadManager->start();
209 QThread* threadGeonet =
new QThread;
210 gn =
new GeoNet(man, geonetFlag, hybridFlag, mutex);
211 gn->moveToThread(threadGeonet);
212 QObject::connect(threadGeonet, SIGNAL(started()), gn, SLOT(execute()));
213 threadGeonet->start();
217 QThread* threadApplication =
new QThread;
218 appManagement->moveToThread(threadApplication);
220 threadApplication->start();
224 printf(
"UT = %d\n", upperTesterFlag);
225 QThread* threadFacilities =
new QThread;
226 fac =
new Facilities(man, gn, camFlag, denmFlag, bluetoothFlag, upperTesterFlag, mutex);
227 fac->moveToThread(threadFacilities);
228 QObject::connect(threadFacilities, SIGNAL(started()), fac, SLOT(execute()));
229 threadFacilities->start();
234 ut =
new UpperTester(man, can, gps, gn, fac, mutex);
DENM configuration initializer.
asn_TYPE_descriptor_t asn_DEF_Certificate
int main(int argc, char *argv[])
int asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr)
quint64 decode_Certificate(uchar *field, Certificate_t *certificate)
decode_Certificate Decode a Certificate.
UpperTester configuration.
Manager of the Application layer.