ITS
|
Usefull functions and declarations. More...
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <BIT_STRING.h>
#include <QDataStream>
#include <QIODevice>
#include <constantes.h>
#include <confuse.h>
#include <QObject>
#include <QFile>
Go to the source code of this file.
Macros | |
#define | EARTH_RADIUS 6378137 |
#define | LAT2METER 111132 |
#define | NEW_LINE 16 |
#define | OCTET 4 |
#define | zeroPtOneMicroDegreeToMeter 0.0111178 |
#define | DEFAULT_VALUE_POSITION 0 |
#define | GPS_CONF_LATITUDE "Latitude" |
#define | GPS_CONF_LONGITUDE "Longitude" |
#define | GPS_CONF_ALTITUDE "Altitude" |
#define | GPS_CONF_HEADING "Heading" |
#define | GPS_CONF_SEMI_MAJOR_CONFIDENCE "Semi major confidence" |
#define | GPS_CONF_SEMI_MINOR_CONFIDENCE "Semi minor confidence" |
#define | GPS_CONF_SEMI_MAJOR_ORIENTATION "Semi major orientation" |
#define | GPS_CONF_SPEED "Speed" |
#define | GPS_CONF_TIMESTAMP "Timestamp" |
#define | SWAP16(nb) (nb = (nb << 8) | (nb >> 8)) |
#define | SWAP32(nb) |
#define | SWAP64(nb) |
Functions | |
void | format (unsigned char *msg, unsigned long v, int l) |
format Format a number in byte array. More... | |
unsigned long long int | split (const unsigned char *msg, int begin, int end) |
split Extract number from byte array. More... | |
void | split (const unsigned char *msg, int begin, int end, char *out) |
split Extract sub byte array from byte array More... | |
void | print_hexa (const unsigned char *msg, int l, FILE *stream=stdout) |
print_hexa Print a byte array. More... | |
QString | printBitString (BIT_STRING_t b) |
printBitString Print a BIT_STRING into a QString. More... | |
int | validate_unsigned_int (cfg_t *cfg, cfg_opt_t *opt) |
validate_unsigned_int Check if an option is an unsigned int More... | |
BIT_STRING_t | makeBitString (int nbits, cfg_t *cfg, const char *opt_name) |
makeBitString Generate a BIT_STRING from configuration. More... | |
quint64 | circAtLat (long l) |
circAtLat Compute the circumference at a latitude. More... | |
unsigned int | diameter (long begin, long end, quint64 circ) |
diameter Compute the distance between two point on the same latitude. More... | |
double | dist (qint32 x1, qint32 y1, qint32 x2, qint32 y2) |
dist This function calculate the euclidian distance between two points ([x1, y1], [x2, y2]). More... | |
double | f (long x, long y, double lengthA, double lengthB, e_shape shape) |
f Compute the f function. More... | |
int | g (double dist_r, double dist_f, double dist_fr, int angleThreshold) |
g Compute the g function. More... | |
Usefull functions and declarations.
Definition in file api.h.
#define EARTH_RADIUS 6378137 |
Definition at line 22 of file api.h.
Referenced by circAtLat().
#define GPS_CONF_SEMI_MAJOR_ORIENTATION "Semi major orientation" |
#define LAT2METER 111132 |
Definition at line 23 of file api.h.
Referenced by GeoNet::advancedForwarding(), GeoNet::contentionBasedForwardingAlgorithm(), GeoNet::gacPacketProcessing(), GeoNet::gbcPacketProcessing(), denMessageTableForwarding::inRelevanceArea(), GeoNet::sendGAC(), and GeoNet::simpleForwardingAlgorithm().
#define NEW_LINE 16 |
Definition at line 25 of file api.h.
Referenced by print_hexa().
#define OCTET 4 |
Definition at line 26 of file api.h.
Referenced by print_hexa().
#define SWAP16 | ( | nb | ) | (nb = (nb << 8) | (nb >> 8)) |
Definition at line 41 of file api.h.
Referenced by CommonHeader::CommonHeader().
#define SWAP32 | ( | nb | ) |
#define SWAP64 | ( | nb | ) |
quint64 circAtLat | ( | long | l | ) |
circAtLat Compute the circumference at a latitude.
l | The latitude. |
Definition at line 211 of file api.cpp.
References EARTH_RADIUS.
Referenced by GeoNet::advancedForwarding(), GeoNet::contentionBasedForwardingAlgorithm(), GeoNet::gacPacketProcessing(), GeoNet::gbcPacketProcessing(), denMessageTableForwarding::inRelevanceArea(), GeoNet::sendGAC(), and GeoNet::simpleForwardingAlgorithm().
unsigned int diameter | ( | long | begin, |
long | end, | ||
quint64 | circ | ||
) |
diameter Compute the distance between two point on the same latitude.
begin | The first point. |
end | The seconde point. |
circ | The circumference at the latitude. |
Definition at line 220 of file api.cpp.
Referenced by GeoNet::advancedForwarding(), GeoNet::contentionBasedForwardingAlgorithm(), GeoNet::gacPacketProcessing(), GeoNet::gbcPacketProcessing(), denMessageTableForwarding::inRelevanceArea(), GeoNet::sendGAC(), and GeoNet::simpleForwardingAlgorithm().
double dist | ( | qint32 | x1, |
qint32 | y1, | ||
qint32 | x2, | ||
qint32 | y2 | ||
) |
dist This function calculate the euclidian distance between two points ([x1, y1], [x2, y2]).
x1 | X1 is the latitude of the first point. |
y1 | Y1 is the longitude of the first point. |
x2 | X2 is the latitude of the second point. |
y2 | Y2 is the longitude of the second point. |
Definition at line 228 of file api.cpp.
Referenced by GeoNet::advancedForwarding(), GeoNet::CBFUnicast(), caBasicService::checkCamGeneration(), GeoNet::contentionBasedForwardingAlgorithm(), and GeoNet::greedy().
double f | ( | long | x, |
long | y, | ||
double | lengthA, | ||
double | lengthB, | ||
e_shape | shape | ||
) |
f Compute the f function.
x | The x position of the point. |
y | The y position of the point. |
lengthA | The length of the semi minor axis. |
lengthB | The length of the semi major axis. |
shape | The shape of the area. |
Definition at line 236 of file api.cpp.
References shape_circle, shape_ellipse, shape_none, and shape_rectangle.
Referenced by GeoNet::advancedForwarding(), ber_tlv_tag_fwrite(), GeoNet::contentionBasedForwardingAlgorithm(), GeoNet::gacPacketProcessing(), GeoNet::gbcPacketProcessing(), denMessageTableForwarding::inRelevanceArea(), GeoNet::sendGAC(), AppDenmResultData::setFailureNotification(), and GeoNet::simpleForwardingAlgorithm().
void format | ( | unsigned char * | msg, |
unsigned long | v, | ||
int | l | ||
) |
format Format a number in byte array.
msg | The byte array. |
v | The number to format. |
l | The intended byte number. |
Definition at line 35 of file api.cpp.
Referenced by SecurityProfile_CAM::secureHeader(), and GeoNet::send().
int g | ( | double | dist_r, |
double | dist_f, | ||
double | dist_fr, | ||
int | angleThreshold | ||
) |
g Compute the g function.
dist_r | Distance to the router. |
dist_f | Distance to the forwarder. |
dist_fr | FSR. |
angleThreshold | ANGLE_TH. |
Definition at line 272 of file api.cpp.
References itsGnDefaultMaxCommunicationRange.
Referenced by GeoNet::advancedForwarding(), constr_GenerationDeltaTime(), cpy_GenerationDeltaTime(), make_GenerationDeltaTime(), and setGenerationDeltaTime().
BIT_STRING_t makeBitString | ( | int | nbits, |
cfg_t * | cfg, | ||
const char * | opt_name | ||
) |
makeBitString Generate a BIT_STRING from configuration.
nbits | Number of bits needed. |
cfg | The configuration. |
opt_name | The option name. |
Definition at line 198 of file api.cpp.
References BIT_STRING_s::bits_unused, BIT_STRING_s::buf, and BIT_STRING_s::size.
Referenced by ParameterCAN::read(), ParameterApplication::read(), and ParameterConfiguration::read().
void print_hexa | ( | const unsigned char * | msg, |
int | l, | ||
FILE * | stream = stdout |
||
) |
print_hexa Print a byte array.
msg | The byte array |
l | The byte array length |
stdout | The output stream. |
Definition at line 89 of file api.cpp.
References NEW_LINE, and OCTET.
Referenced by denTriggeringManagement::AppDENM_cancellation(), denReceptionManagement::AppDENM_negation(), denTriggeringManagement::AppDENM_trigger(), caReceptionManagement::decodeCam(), and UpperTester::readPendingDatagrams().
QString printBitString | ( | BIT_STRING_t | b | ) |
printBitString Print a BIT_STRING into a QString.
b | The BIT_STRING to print. |
Definition at line 175 of file api.cpp.
References BIT_STRING_s::bits_unused, BIT_STRING_s::buf, and BIT_STRING_s::size.
Referenced by ParameterCAN::readDebug(), ParameterApplication::readDebug(), and ParameterConfiguration::readDebug().
unsigned long long int split | ( | const unsigned char * | msg, |
int | begin, | ||
int | end | ||
) |
split Extract number from byte array.
msg | The byte array. |
begin | Start bit. |
end | End bit |
Definition at line 47 of file api.cpp.
Referenced by Facilities::getNetworkAndTransportLayerIndication().
void split | ( | const unsigned char * | msg, |
int | begin, | ||
int | end, | ||
char * | out | ||
) |
int validate_unsigned_int | ( | cfg_t * | cfg, |
cfg_opt_t * | opt | ||
) |
validate_unsigned_int Check if an option is an unsigned int
cfg | Configuration file. |
opt | Parameter list. |
Definition at line 186 of file api.cpp.
Referenced by ParameterUpperTester::read(), ParameterGPS::read(), ParameterCAN::read(), ParameterApplication::read(), and ParameterConfiguration::read().