12 for(
int i = 0; i < 12; i++)
15 randomHex.append(QString::number(n,16));
18 randomHex.append(
":");
21 sscanf(randomHex.toStdString().c_str(),
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%n",
53 foreach(QNetworkInterface netInterface, QNetworkInterface::allInterfaces())
56 if (!(netInterface.flags() & QNetworkInterface::IsLoopBack))
59 int rc = sscanf(netInterface.hardwareAddress().toStdString().c_str(),
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%n",
61 if(rc != 6 || netInterface.hardwareAddress().toStdString().size() > (
unsigned int)last)
62 fprintf(stderr,
"invalid mac address format %s", netInterface.hardwareAddress().toStdString().c_str());
63 printf(
"hardwareaddress : %s\n",netInterface.hardwareAddress().toStdString().c_str());
70 for(
int i = 0; i < 6; i++)
76 cfg_opt_t vehicleLength_opts[] =
82 cfg_opt_t trafficClass_opts[] =
84 CFG_INT(
"storeCarryForward", 0, CFGF_NONE),
85 CFG_INT(
"channelOffload", 0, CFGF_NONE),
92 CFG_STR(
"interface",
"eth0", CFGF_NONE),
93 CFG_INT(
"countryCode", 208, CFGF_NONE),
94 CFG_BOOL(
"itsGnGeoAreaLineForwarding", cfg_true, CFGF_NONE),
98 CFG_BOOL(
"itsGnSecurity", cfg_false, CFGF_NONE),
100 CFG_BOOL_LIST(
"energyStorageType",
"{false, false, false, false, false, false, false}", CFGF_NONE),
106 CFG_INT_LIST(
"positionOfPillars",
"{30}", CFGF_NONE),
110 CFG_SEC(
"trafficClass",trafficClass_opts, CFGF_NO_TITLE_DUPES),
112 CFG_SEC(
"vehicleLength", vehicleLength_opts, CFGF_NO_TITLE_DUPES),
117 CFG_INT(
"maxRepetitionAdvancedContention", 3, CFGF_NONE),
123 for(
int i = 0 ; i < 3 ; i++)
126 cfg_t *cfg_vehicleLength;
127 cfg_t *cfg_trafficClass;
129 cfg = cfg_init(opts, CFGF_NONE);
131 cfg_vehicleLength = cfg_getsec(cfg,
"vehicleLength");
132 cfg_trafficClass = cfg_getsec(cfg,
"trafficClass");
157 cfg_add_searchpath(cfg,
"/etc/its/config");
158 if(cfg_parse(cfg,
"system.conf") == CFG_PARSE_ERROR)
159 printf(
"PARSE_ERROR\n");
176 for(uint i=0; i < cfg_size(cfg,
"positionOfPillars"); i++)
178 *
m_posPillar[i] = cfg_getnint(cfg,
"positionOfPillars", i);
184 for(uint i=0; i<cfg_size(cfg,
"positionOfPillars"); i++)
194 quint8 SCF_tmp = cfg_getint(cfg_trafficClass,
"storeCarryForward");
195 quint8 channelOffload_tmp = cfg_getint(cfg_trafficClass,
"channelOffload");
196 quint8 TCID_tmp = cfg_getint(cfg_trafficClass,
"trafficClassID");
214 printf(
"-----------------------------------------------------------------\n\t\tReadConf\n\n");
215 printf(
"mac addr : ");
218 printf(
"%02x:",
m_mid[h]);
219 printf(
"%02x",
m_mid[h]);
221 printf(
"interface = %s\n\n",
m_interface.toStdString().c_str());
235 printf(
"positionOfPillars : {");
#define ASN_SEQUENCE_ADD(headptr, ptr)
PosFrontAx_t m_posFrontAx
PosLonCarr_t m_posLonCarrLeft
ParameterConfiguration & operator=(const ParameterConfiguration &other)
operator= ParameterConfiguration affectation operator.
int m_maxRepetitionAdvancedContention
bool itsGnGeoAreaLineForwarding() const
itsGnGeoAreaLineForwarding Is the GN geo area line forwarding used?
int validate_unsigned_int(cfg_t *cfg, cfg_opt_t *opt)
validate_unsigned_int Check if an option is an unsigned int
quint8 channelOffload() const
channelOffload Channel offload field getter.
PosLonCarr_t m_posLonCarrRight
asn_TYPE_descriptor_t asn_DEF_PositionOfPillars
Global configuration initializer.
quint8 TCID() const
TCID Traffic class ID field getter.
EnergyStorageType_t m_energyStorageType
quint8 m_itsGnLocalAddrConfMethod
PositionOfPillars_t positionOfPillars() const
positionOfPillars Position of the pillars getter.
#define itsGnLocalAddrConfMethod_managed
quint8 m_itsGnGeoBroadcastForwardingAlgorithm
void getMacAddr()
getMacAddr Get MacAddr if itsGnLocalAddrConfMethod = 1 to create GnAddr
VehicleWidth_t m_vehicleWidth
quint8 m_itsGnGeoUnicastForwardingAlgorithm
uchar * mid()
mid MID getter.
void read()
read Configuration file reading.
HeightLonCarr_t m_heightLonCarrRight
QString printBitString(BIT_STRING_t b)
printBitString Print a BIT_STRING into a QString.
#define itsGnLocalAddrConfMethod_auto
VehicleLengthValue_t vehicleLengthValue
HeightLonCarr_t m_heightLonCarrLeft
bool m_itsGnGeoAreaLineForwarding
void updateMID(uchar *mid)
updateMacAddr Get GnAddr from security layer if itsGnLocalGnAddrConfMethod = 2 or if DAD is invoked ...
void readDebug()
readDebug Configuration printing.
BIT_STRING_t makeBitString(int nbits, cfg_t *cfg, const char *opt_name)
makeBitString Generate a BIT_STRING from configuration.
TurningRadius_t m_turningRadius
ParameterConfiguration()
ParameterConfiguration Default constructor.
VehicleLengthConfidenceIndication_t vehicleLengthConfidenceIndication
WheelBaseVehicle_t m_wheelBaseVehicle
PositionOfPillars_t m_positionOfPillars
~ParameterConfiguration()
~ParameterConfiguration ParameterConfiguration destructor.
PosCentMass_t m_posCentMass
quint8 SCF() const
SCF Store-carry-forward field getter.
int asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr)
VehicleLength_t m_vehicleLength
VehicleMass_t m_vehicleMass
TrafficClass m_trafficClass
PosPillar_t ** m_posPillar
#define itsGnLocalAddrConfMethod_anonymous
#define itsGnLocalAddrConfMethod_default