20 #ifndef SGCTP_CDATA_HPP
21 #define SGCTP_CDATA_HPP
64 static const uint32_t UNDEFINED_UINT32 = 0x80000000;
66 static const uint32_t OVERFLOW_UINT32 = 0x7FFFFFFF;
74 static const uint8_t MAX_ID_LENGTH = 127;
76 static const uint8_t MAX_ID_SIZE = 128;
78 static const uint16_t MAX_DATA_SIZE = 32767;
82 return !__isnanl( _fdValue );
85 inline static bool isValid(
double _fdValue ) {
86 return !__isinfl( _fdValue );
93 static string stringSourceType(
int _iSourceType );
95 static double epoch();
102 static double toEpoch(
double _fdTime,
103 double _fdEpochReference = 0 );
109 static void toIso8601(
char *_pcIso8601,
116 static double fromIso8601(
const char *_pcIso8601 );
125 char pcID[MAX_ID_SIZE];
206 void reset(
bool _bDataFree =
true );
208 void setID(
const char *_pcID );
210 uint16_t setData(
const unsigned char *_pucData,
211 uint16_t _ui16tDataSize );
216 void setTime(
double _fdEpoch );
218 void setLatitude(
double _fdLatitude );
220 void setLongitude(
double _fdLongitude );
222 void setElevation(
double _fdElevation );
224 void setBearing(
double _fdBearing );
226 void setGndSpeed(
double _fdGndSpeed );
228 void setVrtSpeed(
double _fdVrtSpeed );
230 void setBearingDt(
double _fdBearingDt );
232 void setGndSpeedDt(
double _fdGndSpeedDt );
234 void setVrtSpeedDt(
double _fdVrtSpeedDt );
236 void setHeading(
double _fdHeading );
238 void setAppSpeed(
double _fdApparentSpeed );
242 ( _eSourceType != SOURCE_UNDEFINED )
247 void setLatitudeError(
double _fdLatitudeError );
249 void setLongitudeError(
double _fdLongitudeError );
251 void setElevationError(
double _fdElevationError );
253 void setBearingError(
double _fdBearingError );
255 void setGndSpeedError(
double _fdGndSpeedError );
257 void setVrtSpeedError(
double _fdVrtSpeedError );
259 void setBearingDtError(
double _fdBearingDtError );
261 void setGndSpeedDtError(
double _fdGndSpeedDtError );
263 void setVrtSpeedDtError(
double _fdVrtSpeedDtError );
265 void setHeadingError(
double _fdHeadingError );
267 void setAppSpeedError(
double _fdApparentSpeedError );
281 void getData(
unsigned char *_pucData,
282 uint16_t *_pui16tDataSize )
const;
291 return ui16tDataSize;
294 double getTime()
const;
296 double getLatitude()
const;
298 double getLongitude()
const;
300 double getElevation()
const;
302 double getBearing()
const;
304 double getGndSpeed()
const;
306 double getVrtSpeed()
const;
308 double getBearingDt()
const;
310 double getGndSpeedDt()
const;
312 double getVrtSpeedDt()
const;
314 double getHeading()
const;
316 double getAppSpeed()
const;
323 double getLatitudeError()
const;
325 double getLongitudeError()
const;
327 double getElevationError()
const;
329 double getBearingError()
const;
331 double getGndSpeedError()
const;
333 double getVrtSpeedError()
const;
335 double getBearingDtError()
const;
337 double getGndSpeedDtError()
const;
339 double getVrtSpeedDtError()
const;
341 double getHeadingError()
const;
343 double getAppSpeedError()
const;
352 uint16_t allocData( uint16_t _ui16tDataSize );
358 void copy(
const CData &_roData );
363 bool sync(
const CData &_roData );
369 #endif // SGCTP_CDATA_HPP
static const double OVERFLOW_VALUE
Overflow value.
uint32_t ui32tHeadingError
Heading error.
const uint16_t getDataSize() const
Return the data size.
uint32_t ui32tElevationError
Elevation error.
static bool isDefined(double _fdValue)
Return whether the given value is defined.
uint32_t ui32tSourceType
Source type.
ESourceType getSourceType() const
Return the source type.
uint32_t ui32tBearingError
Bearing error.
uint32_t ui32tVrtSpeed
Vertical speed.
uint32_t ui32tGndSpeed
Ground speed.
uint16_t ui16tDataSize
Data size.
ESourceType
Data source types.
uint32_t ui32tElevation
Elevation.
uint32_t ui32tLatitudeError
Latitude error.
void setSourceType(ESourceType _eSourceType)
Set the source type.
uint32_t ui32tGndSpeedError
Ground speed error.
unsigned char * pucData
Data (max. 32767 symbols)
uint32_t ui32tBearingDtError
Bearing variation over time (rate of turn) error.
uint32_t ui32tLatitude
Latitude.
uint32_t ui32tHeading
Heading.
uint32_t ui32tLongitudeError
Longitude error.
uint32_t ui32tVrtSpeedDt
Vertical speed variation over time (acceleration)
uint32_t ui32tAppSpeedError
Apparent speed error.
const char * getID() const
Return the ID string.
static const double UNDEFINED_VALUE
Undefined value.
uint32_t ui32tLongitude
Longitude.
uint32_t ui32tBearingDt
Bearing variation over time (rate of turn)
uint32_t ui32tBearing
Bearing.
static bool isValid(double _fdValue)
Return whether the given value is valid (does not overflow)
uint32_t ui32tGndSpeedDt
Ground speed variation over time (acceleration)
uint32_t ui32tVrtSpeedError
Vertical speed error.
uint32_t ui32tGndSpeedDtError
Ground speed variation over time (acceleration) error.
const unsigned char * getData() const
Return the data.
uint32_t ui32tVrtSpeedDtError
Vertical speed variation over time (acceleration) error.
uint32_t ui32tAppSpeed
Apparent speed.