1 #include "ParameterApplication.h" 23 cfg_opt_t causeCode_opts[] =
25 CFG_INT(
"causeCodeType", NULL, CFGF_IGNORE_UNKNOWN),
27 CFG_INT(
"subCauseCodeType", NULL, CFGF_IGNORE_UNKNOWN),
32 cfg_opt_t closedLanes_opts[] =
34 CFG_BOOL_LIST(
"drivingLaneStatus", NULL, CFGF_NONE),
36 CFG_INT(
"hardShoulderStatus", -1, CFGF_IGNORE_UNKNOWN),
41 cfg_opt_t dangerousGoodExtended_opt[] =
43 CFG_INT_LIST(
"companyName", NULL, CFGF_IGNORE_UNKNOWN),
45 CFG_INT(
"dangerousGoodsType", -1, CFGF_NONE),
47 CFG_BOOL(
"elevatedTemperature", cfg_false, CFGF_NONE),
49 CFG_INT_LIST(
"emergencyActionCode", NULL, CFGF_IGNORE_UNKNOWN),
51 CFG_BOOL(
"limitedQuantity", cfg_false, CFGF_NONE),
53 CFG_INT_LIST(
"phoneNumber", NULL, CFGF_IGNORE_UNKNOWN),
55 CFG_BOOL(
"tunnelsRestricted", cfg_false, CFGF_NONE),
57 CFG_INT(
"unNumber", -1, CFGF_NONE),
62 cfg_opt_t ptActivation_opts[] =
64 CFG_INT_LIST(
"ptActivationData", NULL, CFGF_NONE),
66 CFG_INT(
"ptActivationType", NULL, CFGF_NONE),
71 cfg_opt_t vehicleIdentification_opt[] =
73 CFG_INT_LIST(
"vDS", NULL, CFGF_IGNORE_UNKNOWN),
75 CFG_INT_LIST(
"wMInumber", NULL, CFGF_IGNORE_UNKNOWN),
82 CFG_SEC(
"causeCodeEmergency", causeCode_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
84 CFG_SEC(
"causeCodeSafety", causeCode_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
86 CFG_SEC(
"causeCodeStationary", causeCode_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
88 CFG_SEC(
"closedLanes", closedLanes_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
92 CFG_SEC(
"dangerousGoodsExtended", dangerousGoodExtended_opt, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
94 CFG_BOOL(
"embarkationStatus", cfg_false, CFGF_NONE),
96 CFG_BOOL_LIST(
"emergencyPriority",
"", CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
98 CFG_BOOL(
"itsGnIsMobile", cfg_false, CFGF_NONE),
100 CFG_SEC(
"ptActivation", ptActivation_opts, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
102 CFG_INT(
"roadworksSubCauseCode", -1, CFGF_IGNORE_UNKNOWN),
104 CFG_INT(
"speedLimit", -1, CFGF_IGNORE_UNKNOWN),
106 CFG_BOOL_LIST(
"specialTransportType",
"", CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
108 CFG_INT(
"stationarySince", -1, CFGF_NODEFAULT | CFGF_IGNORE_UNKNOWN),
110 CFG_INT(
"stationID", 0, CFGF_NONE),
114 CFG_INT(
"trafficRule", -1, CFGF_IGNORE_UNKNOWN),
116 CFG_SEC(
"vehicleIdentification", vehicleIdentification_opt, CFGF_MULTI | CFGF_IGNORE_UNKNOWN),
124 cfg_t *cfg_closedLanes;
125 cfg_t *cfg_causeCodeEmergency;
126 cfg_t *cfg_causeCodeSafety;
127 cfg_t *cfg_causeCodeStationary;
128 cfg_t *cfg_dangerousGoodExtended;
129 cfg_t *cfg_ptActivation;
130 cfg_t *cfg_vehicleIdentification;
132 cfg = cfg_init(opts, CFGF_NONE);
175 cfg_add_searchpath(cfg,
"/etc/its/config");
176 if(cfg_parse(cfg,
"appli.conf") == CFG_PARSE_ERROR)
177 printf(
"PARSE_ERROR\n");
179 cfg_closedLanes = cfg_getsec(cfg,
"closedLanes");
181 cfg_dangerousGoodExtended = cfg_getsec(cfg,
"dangerousGoodsExtended");
183 cfg_ptActivation = cfg_getsec(cfg,
"ptActivation");
185 cfg_causeCodeEmergency = cfg_getsec(cfg,
"causeCodeEmergency");
187 cfg_causeCodeSafety = cfg_getsec(cfg,
"causeCodeSafety");
189 cfg_causeCodeStationary = cfg_getsec(cfg,
"causeCodeStationary");
191 cfg_vehicleIdentification = cfg_getsec(cfg,
"vehicleIdentification");
194 if(cfg_causeCodeEmergency)
203 if(cfg_causeCodeSafety)
212 if(cfg_causeCodeStationary)
225 if(cfg_getint(cfg_closedLanes,
"hardShoulderStatus") == -1)
238 if(cfg_dangerousGoodExtended)
242 if(cfg_size(cfg_dangerousGoodExtended,
"companyName") != 0)
256 if(cfg_size(cfg_dangerousGoodExtended,
"emergencyActionCode") != 0)
269 if(cfg_size(cfg_dangerousGoodExtended,
"phoneNumber") != 0)
288 if(cfg_size(cfg,
"emergencyPriority"))
310 if(cfg_getint(cfg,
"roadworksSubCauseCode") == -1)
319 if(cfg_getint(cfg,
"speedLimit") == -1)
328 if(cfg_getint(cfg,
"stationarySince") == -1)
343 if(cfg_getint(cfg,
"trafficRule") == -1)
353 if(cfg_vehicleIdentification)
356 if(cfg_size(cfg_vehicleIdentification,
"vDS") != 0)
367 if(cfg_size(cfg_vehicleIdentification,
"wMInumber") != 0)
388 printf(
"-----------------------------------------------------------------\n\t\tReadAppliUpperTester\n\n");
411 printf(
"dangerousGoodsExtended\n{\n");
414 printf(
"\tcompanyName = {");
427 printf(
"\temergencyActionCode = {");
438 printf(
"\tphoneNumber = {");
452 printf(
"embarkationStatus = ");
m_embarkationStatus?printf(
"true\n\n"):printf(
"false\n\n");
455 printf(
"emergencyPriority = %s\n\n",
printBitString(*m_emergencyPriority).toStdString().c_str());
484 printf(
"vehicleIdentification\n{\n");
496 printf(
"\twMInumber = {");
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
ParameterApplication()
ParameterApplication ParameterApplication default constructor.
BOOLEAN_t tunnelsRestricted
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.
EmergencyPriority_t * m_emergencyPriority
CauseCode_t * m_causeCodeSafety
PtActivationType_t ptActivationType
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
VehicleRole_t m_vehicleRole
SubCauseCodeType_t subCauseCode
ClosedLanes_t * m_closedLanes
~ParameterApplication()
~ParameterApplication ParameterApplication destructor.
IA5String_t * emergencyActionCode