1 #include "ParameterApplication.h" 25 cfg_opt_t causeCode_opts[] =
27 CFG_INT(
"causeCodeType", NULL, CFGF_IGNORE_UNKNOWN),
29 CFG_INT(
"subCauseCodeType", NULL, CFGF_IGNORE_UNKNOWN),
34 cfg_opt_t closedLanes_opts[] =
36 CFG_BOOL_LIST(
"drivingLaneStatus", NULL, CFGF_NONE),
38 CFG_INT(
"hardShoulderStatus", -1, CFGF_IGNORE_UNKNOWN),
43 cfg_opt_t dangerousGoodExtended_opt[] =
45 CFG_INT_LIST(
"companyName", NULL, CFGF_IGNORE_UNKNOWN),
47 CFG_INT(
"dangerousGoodsType", -1, CFGF_NONE),
49 CFG_BOOL(
"elevatedTemperature", cfg_false, CFGF_NONE),
51 CFG_INT_LIST(
"emergencyActionCode", NULL, CFGF_IGNORE_UNKNOWN),
53 CFG_BOOL(
"limitedQuantity", cfg_false, CFGF_NONE),
55 CFG_INT_LIST(
"phoneNumber", NULL, CFGF_IGNORE_UNKNOWN),
57 CFG_BOOL(
"tunnelsRestricted", cfg_false, CFGF_NONE),
59 CFG_INT(
"unNumber", -1, CFGF_NONE),
64 cfg_opt_t ptActivation_opts[] =
66 CFG_INT_LIST(
"ptActivationData", NULL, CFGF_NONE),
68 CFG_INT(
"ptActivationType", NULL, CFGF_NONE),
73 cfg_opt_t vehicleIdentification_opt[] =
75 CFG_INT_LIST(
"vDS", NULL, CFGF_IGNORE_UNKNOWN),
77 CFG_INT_LIST(
"wMInumber", NULL, CFGF_IGNORE_UNKNOWN),
82 cfg_opt_t protectedCommunicationZone_opt[] =
84 CFG_INT(
"protectedZoneType", 0, CFGF_NONE),
86 CFG_INT(
"expiryTime", 0, CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
88 CFG_INT(
"protectedZoneLatitude", 0, CFGF_NONE),
90 CFG_INT(
"protectedZoneLongitude", 0, CFGF_NONE),
92 CFG_INT(
"protectedZoneRadius", 0, CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
94 CFG_INT(
"protectedZoneID", 0, CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
99 cfg_opt_t protectedCommunicationZonesRSU_opt[] =
101 CFG_SEC(
"protectedCommunicationZone", protectedCommunicationZone_opt, CFGF_MULTI),
108 CFG_SEC(
"causeCodeEmergency", causeCode_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
110 CFG_SEC(
"causeCodeSafety", causeCode_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
112 CFG_SEC(
"causeCodeStationary", causeCode_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
114 CFG_SEC(
"closedLanes", closedLanes_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
118 CFG_SEC(
"dangerousGoodsExtended", dangerousGoodExtended_opt, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
120 CFG_BOOL(
"embarkationStatus", cfg_false, CFGF_NONE),
122 CFG_BOOL_LIST(
"emergencyPriority",
"", CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
124 CFG_BOOL(
"itsGnIsMobile", cfg_false, CFGF_NONE),
126 CFG_SEC(
"protectedCommunicationZonesRSU", protectedCommunicationZonesRSU_opt, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
128 CFG_SEC(
"ptActivation", ptActivation_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
130 CFG_INT(
"roadworksSubCauseCode", -1, CFGF_IGNORE_UNKNOWN),
132 CFG_INT(
"speedLimit", -1, CFGF_IGNORE_UNKNOWN),
134 CFG_BOOL_LIST(
"specialTransportType",
"", CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
136 CFG_INT(
"stationarySince", -1, CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
138 CFG_INT(
"stationID", 0, CFGF_NONE),
142 CFG_INT(
"trafficRule", -1, CFGF_IGNORE_UNKNOWN),
144 CFG_SEC(
"vehicleIdentification", vehicleIdentification_opt, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
152 cfg_t *cfg_closedLanes;
153 cfg_t *cfg_causeCodeEmergency;
154 cfg_t *cfg_causeCodeSafety;
155 cfg_t *cfg_causeCodeStationary;
156 cfg_t *cfg_dangerousGoodExtended;
157 cfg_t *cfg_ptActivation;
158 cfg_t *cfg_protectedCommunicationZone[16];
159 cfg_t *cfg_protectedCommunicationZonesRSU;
160 cfg_t *cfg_vehicleIdentification;
162 cfg = cfg_init(opts, CFGF_NONE);
180 cfg_add_searchpath(cfg,
"/etc/its/config");
181 if(cfg_parse(cfg,
"appli.conf") == CFG_PARSE_ERROR)
182 printf(
"PARSE_ERROR\n");
184 cfg_closedLanes = cfg_getsec(cfg,
"closedLanes");
186 cfg_dangerousGoodExtended = cfg_getsec(cfg,
"dangerousGoodsExtended");
188 cfg_ptActivation = cfg_getsec(cfg,
"ptActivation");
190 cfg_causeCodeEmergency = cfg_getsec(cfg,
"causeCodeEmergency");
192 cfg_causeCodeSafety = cfg_getsec(cfg,
"causeCodeSafety");
194 cfg_causeCodeStationary = cfg_getsec(cfg,
"causeCodeStationary");
196 cfg_vehicleIdentification = cfg_getsec(cfg,
"vehicleIdentification");
198 cfg_protectedCommunicationZonesRSU = cfg_getsec(cfg,
"protectedCommunicationZonesRSU");
200 if(cfg_protectedCommunicationZonesRSU)
201 for(i = 0 ; i < cfg_size(cfg_protectedCommunicationZonesRSU,
"protectedCommunicationZone") ; i++)
202 cfg_protectedCommunicationZone[i] = cfg_getnsec(cfg_protectedCommunicationZonesRSU,
"protectedCommunicationZone", i);
204 if(cfg_causeCodeEmergency)
213 if(cfg_causeCodeSafety)
222 if(cfg_causeCodeStationary)
235 if(cfg_getint(cfg_closedLanes,
"hardShoulderStatus") == -1)
248 if(cfg_dangerousGoodExtended)
252 if(cfg_size(cfg_dangerousGoodExtended,
"companyName") != 0)
266 if(cfg_size(cfg_dangerousGoodExtended,
"emergencyActionCode") != 0)
279 if(cfg_size(cfg_dangerousGoodExtended,
"phoneNumber") != 0)
298 if(cfg_size(cfg,
"emergencyPriority"))
308 if(cfg_size(cfg,
"protectedCommunicationZonesRSU"))
315 for(i = 0 ; i < cfg_size(cfg_protectedCommunicationZonesRSU,
"protectedCommunicationZone") ; i++)
318 p->
protectedZoneType = cfg_getint(cfg_protectedCommunicationZone[i],
"protectedZoneType");
319 if(cfg_size(cfg_protectedCommunicationZone[i],
"expiryTime"))
326 if(cfg_size(cfg_protectedCommunicationZone[i],
"protectedZoneRadius"))
329 *p->
protectedZoneRadius = cfg_getint(cfg_protectedCommunicationZone[i],
"protectedZoneRadius");
331 if(cfg_size(cfg_protectedCommunicationZone[i],
"protectedZoneID"))
334 *p->
protectedZoneID = cfg_getint(cfg_protectedCommunicationZone[i],
"protectedZoneID");
355 if(cfg_getint(cfg,
"roadworksSubCauseCode") == -1)
364 if(cfg_getint(cfg,
"speedLimit") == -1)
373 if(cfg_getint(cfg,
"stationarySince") == -1)
388 if(cfg_getint(cfg,
"trafficRule") == -1)
397 if(cfg_vehicleIdentification)
400 if(cfg_size(cfg_vehicleIdentification,
"vDS") != 0)
411 if(cfg_size(cfg_vehicleIdentification,
"wMInumber") != 0)
432 printf(
"-----------------------------------------------------------------\n\t\tReadAppliUpperTester\n\n");
455 printf(
"dangerousGoodsExtended\n{\n");
458 printf(
"\tcompanyName = {");
471 printf(
"\temergencyActionCode = {");
482 printf(
"\tphoneNumber = {");
496 printf(
"embarkationStatus = ");
m_embarkationStatus?printf(
"true\n\n"):printf(
"false\n\n");
499 printf(
"emergencyPriority = %s\n\n",
printBitString(*m_emergencyPriority).toStdString().c_str());
528 printf(
"vehicleIdentification\n{\n");
540 printf(
"\twMInumber = {");
#define ASN_SEQUENCE_ADD(headptr, ptr)
Longitude_t protectedZoneLongitude
ProtectedZoneID_t * protectedZoneID
void read()
read Configuration file reading.
PtActivation_t * m_ptActivation
VehicleIdentification_t * m_vehicleIdentification
int validate_unsigned_int(cfg_t *cfg, cfg_opt_t *opt)
validate_unsigned_int Check if an option is an unsigned int
CauseCode_t * m_causeCodeEmergency
long RoadworksSubCauseCode_t
StationType_t m_stationType
long HardShoulderStatus_t
SpecialTransportType_t m_specialTransportType
IA5String_t * phoneNumber
BOOLEAN_t elevatedTemperature
QString printBitString(BIT_STRING_t b)
printBitString Print a BIT_STRING into a QString.
RoadworksSubCauseCode_t * m_roadworksSubCauseCode
int asn_long2INTEGER(INTEGER_t *i, long l)
ProtectedCommunicationZonesRSU_t * m_protectedCommunicationZones
ParameterApplication()
ParameterApplication ParameterApplication default constructor.
BOOLEAN_t tunnelsRestricted
long ProtectedZoneRadius_t
CauseCode_t * m_causeCodeStationary
void readDebug()
readDebug Configuration printing.
BOOLEAN_t limitedQuantity
HardShoulderStatus_t * hardShoulderStatus
CauseCodeType_t causeCode
BIT_STRING_t makeBitString(int nbits, cfg_t *cfg, const char *opt_name)
makeBitString Generate a BIT_STRING from configuration.
ProtectedZoneRadius_t * protectedZoneRadius
EmergencyPriority_t * m_emergencyPriority
CauseCode_t * m_causeCodeSafety
PtActivationType_t ptActivationType
ProtectedZoneType_t protectedZoneType
DangerousGoodsExtended_t * m_dangerousGoodsExtended
ParameterApplication & operator=(const ParameterApplication &other)
operator= Affectation operator.
UTF8String_t * companyName
PtActivationData_t ptActivationData
DangerousGoodsBasic_t m_dangerousGoodsBasic
SpeedLimit_t * m_speedLimit
TrafficRule_t * m_trafficRule
StationarySince_t * m_stationarySince
EmbarkationStatus_t m_embarkationStatus
DangerousGoodsBasic_t dangerousGoodsType
DrivingLaneStatus_t drivingLaneStatus
Latitude_t protectedZoneLatitude
VehicleRole_t m_vehicleRole
TimestampIts_t * expiryTime
SubCauseCodeType_t subCauseCode
ClosedLanes_t * m_closedLanes
~ParameterApplication()
~ParameterApplication ParameterApplication destructor.
IA5String_t * emergencyActionCode