24 #define PACKETLOG XSENSLOG 26 #define PACKETLOG(...) (void)0 33 #define FORMAT_DOUBLE \ 34 ((m_fixedData->m_formatList[index].m_outputSettings & \ 35 XOS_Dataformat_Mask) | \ 36 XOS_Dataformat_Double) 38 (m_fixedData->m_infoList[index].a >= \ 39 m_fixedData->m_infoList[index].m_doubleBoundary) 40 #define CHECKIFDOUBLE(a) \ 41 ISDOUBLE(a) ? FORMAT_DOUBLE \ 42 : m_fixedData->m_formatList[index].m_outputSettings 61 PACKETLOG(
"%s creating default %p\n", __FUNCTION__,
this);
83 "%s creating %p with %d items and xbus option %d\n", __FUNCTION__,
this,
100 PACKETLOG(
"%s creating %p from %p\n", __FUNCTION__,
this, &other);
102 PACKETLOG(
"%s creating %p from %p done\n", __FUNCTION__,
this, &other);
110 PACKETLOG(
"%s copying from %p to %p\n", __FUNCTION__, &pack,
this);
111 if (
this == &pack)
return *
this;
130 PACKETLOG(
"%s copying from %p to %p done\n", __FUNCTION__, &pack,
this);
139 PACKETLOG(
"%s destroying %p\n", __FUNCTION__,
this);
142 PACKETLOG(
"%s destroyed %p\n", __FUNCTION__,
this);
175 m_toa = timeofarrival;
185 m_rtc = realtimeclock;
219 if (originalSize ==
m_msg.getDataSize())
return m_msg;
222 m.resizeData(originalSize);
223 m.setDataBuffer(
m_msg.getDataBuffer(), originalSize);
224 m.recomputeChecksum();
260 return m_msg.getDataShort(
279 if (!dev.isValid())
return 0;
419 m_msg.insertData(2, 0);
420 m_msg.setDataShort(stamp, 0);
430 m_msg.deleteData(2, 0);
561 totalOffset + 9 + 3 * ds;
563 totalOffset + 9 + 7 * ds;
565 totalOffset + 9 + 10 * ds;
567 totalOffset + 10 + 10 * ds;
569 totalOffset + 12 + 10 * ds;
572 totalOffset += 13 + 13 * ds;
697 for (
int j = 0; j < tCount; j++)
713 totalOffset += 3 * ds;
724 totalOffset += 3 * ds;
735 totalOffset += 3 * ds;
767 totalOffset += 3 * ds;
772 totalOffset += 4 * ds;
777 totalOffset += 9 * ds;
819 totalOffset += 3 * ds;
831 totalOffset += 3 * ds;
978 m_msg.resizeData(
m_msg.getDataSize() + 3 * 2);
1015 m_msg.resizeData(
m_msg.getDataSize() + 3 * 2);
1052 m_msg.resizeData(
m_msg.getDataSize() + 3 * 2);
1068 return m_msg.getDataShort(
1089 for (
int i =
c; i <= channel;
1147 m_msg.resizeData(
m_msg.getDataSize() + 3 * 3 * 2 + 2);
1200 bareln[i] =
m_msg.getDataLong(
1243 m_msg.resizeData(
m_msg.getDataSize() + (2 + 1) + (40 + 1));
1352 m_msg.resizeData(
m_msg.getDataSize() + (2 + 1));
1387 m_msg.getDataFPValue(
1401 m_msg.getDataFPValue(
1403 &
buffer.m_orientationIncrement[0],
1405 m_msg.getDataFPValue(
1408 m_msg.getDataFPValue(
1416 buffer.m_firstFrameNumber = 0;
1417 buffer.m_lastFrameNumber = 0;
1418 buffer.m_currentBias.zero();
1423 buffer.m_orientationIncrement = XsQuaternion::identity();
1424 buffer.m_velocityIncrement.zero();
1425 buffer.m_magnetoMeter.zero();
1457 m_msg.resizeData(
m_msg.getDataSize() + 13 + 13 * ds);
1489 data.m_firstFrameNumber,
1492 data.m_lastFrameNumber,
1494 m_msg.setDataFPValue(
1497 m_msg.setDataFPValue(
1499 data.m_orientationIncrement.data(),
1501 m_msg.setDataFPValue(
1505 (
data.m_aidingData ==
true) ? 1 : 0,
1510 m_msg.setDataFPValue(
1523 return m_msg.getDataFPValue(
1554 for (
int i =
c; i <= channel;
1564 m_msg.setDataFPValue(
1585 m_msg.getDataFPValue(
1615 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
1619 m_msg.setDataFPValue(
1631 m_msg.getDataFPValue(
1661 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
1665 m_msg.setDataFPValue(
1677 m_msg.getDataFPValue(
1707 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
1711 m_msg.setDataFPValue(
1727 double* bare = &
buffer.m_acc[0];
1730 memset(bare, 0, 3 *
sizeof(
double));
1732 m_msg.getDataFPValue(
1739 memset(bare, 0, 3 *
sizeof(
double));
1741 m_msg.getDataFPValue(
1748 memset(bare, 0, 3 *
sizeof(
double));
1750 m_msg.getDataFPValue(
1793 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
1803 double* bare = (
double*)&
data;
1805 m_msg.setDataFPValue(
1810 m_msg.setDataFPValue(
1815 m_msg.setDataFPValue(
1828 m_msg.getDataFPValue(
1861 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
1864 double* bare = (
double*)&
data;
1865 m_msg.setDataFPValue(
1873 m_msg.setDataFPValue(
1886 m_msg.getDataFPValue(
1916 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
1920 m_msg.setDataFPValue(
1936 for (
int32_t i = 0; i < 3; ++i)
1937 for (
int32_t j = 0; j < 3; ++j, k += ds)
1939 j, i,
m_msg.getDataFPValue(
1971 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
1976 for (
int32_t i = 0; i < 3; ++i)
1977 for (
int32_t j = 0; j < 3; ++j, k += ds)
1978 m_msg.setDataFPValue(
2074 m_msg.getDataFPValue(
2103 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
2107 m_msg.setDataFPValue(
2119 m_msg.getDataFPValue(
2151 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
2155 m_msg.setDataFPValue(
2165 assert(outIsDetailed != 0);
2171 *outIsDetailed =
false;
2176 *outIsDetailed =
true;
2270 bareByte[i] =
m_msg.getDataByte(
2333 m_msg.getDataFPValue(
2362 m_msg.resizeData(
m_msg.getDataSize() + numValues * ds);
2366 m_msg.setDataFPValue(
XsOutputMode
Bit values for legacy output mode.
uint16_t m_rawData
Offset of raw data.
bool containsMtwSdiData(int32_t index=0) const
Check if data item contains strapdown integration data.
#define XS_EXTRA_TEMPERATURE_CHANNELS
bool setMtwSdiData(const MtwSdiData &data, int32_t index=0)
Add/update strapdown integration data for the item.
uint16_t m_offset
Offset of first data byte (whatever it is)
uint16_t itemCount(void) const
Returns the number of devices whose data is contained in the object.
XsSize dataSize(int32_t index=0) const
Returns the size of the data.
MtwSdiData mtwSdiData(int32_t index=0) const
Return the strapdown integration (SDI) data component of a data item.
GLuint GLuint GLsizei count
bool containsOrientation(int32_t index=0) const
Check if data item contains Orientation Data of any kind.
XsDataFormat * m_formatList
A list of the formats of the data items.
XsVector freeAcceleration(int32_t index=0) const
Return the Acc-G component of the packet.
XsScrData rawData(int32_t index=0) const
Return the Raw Data component of a data item.
XsTimeStamp rtc(void) const
Returns the Real Time Clock value as stored in the object.
uint16_t rawTemperature(int32_t index=0, int channel=0) const
Return the Raw Temperature component of a data item.
uint16_t m_gpsPvtLatitude
Offset of raw GPS latitude data.
PacketFixedData * m_fixedData
Fixed packet data.
bool containsOrientationMatrix(int32_t index=0) const
Check if data item contains Matrix Orientation data.
uint16_t m_gpsPvtGpsData
Offset of raw GPS data.
unsigned __int16 uint16_t
#define XS_MAX_TEMPERATURE_CHANNELS
struct XsPressure XsPressure
uint16_t m_wClientId
Offset of MTw SDI client ID data.
uint16_t m_gpsPvtVeld
Offset of raw GPS dowanward velocity data.
uint16_t m_utcMonth
Offset of month part of UTC time.
void setMessage(const XsMessage &message)
Set the source message to msg.
bool setRawMagneticField(const XsUShortVector &vec, int32_t index=0)
Add/update Raw Magnetometer data for the item.
uint16_t m_gpsPvtLongitude
Offset of raw GPS longitude data.
XsUtcTime utcTime(int32_t index=0) const
Return the UTC Time component of the packet.
uint16_t m_wAidingData
Offset of MTw SDI aiding data.
bool setTriggerIndication(int channelID, const XsTimeStamp &t)
Add/update trigger indication time for the item to the given line.
uint16_t m_wTimeSync
Offset of MTw SDI time sync data.
int temperatureChannelCount(int32_t index=0) const
Returns the number of temperature channels.
XsMessage m_msg
The message.
uint16_t m_rawAcc
Offset of raw acceleration data.
bool containsOrientationEuler(int32_t index=0) const
Check if data item contains Euler Orientation data.
bool containsRawData(int32_t index=0) const
Check if data item contains Raw Data.
uint16_t m_wFirstFrameNumber
Offset of MTw SDI first frame number in interval data.
bool setRawTemperature(uint16_t temp, int32_t index=0, int channel=0)
Add/update Raw Temperature data for the item.
A vector containing 3 short values.
uint16_t m_velNEDorNWU
Offset of velocity data.
uint16_t m_gpsPvtPressure
Offset of pressure data.
uint16_t m_gpsPvtHeight
Offset of raw GPS height data.
uint16_t m_utcTime
Offset of UTC time data.
Class to store strapdown integration data.
uint16_t m_gpsPvtVacc
Offset of raw GPS vertical accuracy estimate data.
bool setDataFormat(const XsDataFormat &format, int32_t index=0)
Sets the data format of the device with the given index to format.
uint16_t m_rawTemp[XS_MAX_TEMPERATURE_CHANNELS]
Offset of raw temperature data.
uint16_t m_calMag
Offset of calibrated magnetometer data.
bool setGpsPvtData(const XsGpsPvtData &data, int32_t index=0)
Add/update Gps PVT Data for the item.
uint16_t m_calAcc
Offset of calibrated acceleration data.
int32_t findDeviceId(XsDeviceId dev) const
Returns the index of the fixed data with id dev.
bool setOrientationQuaternion(const XsQuaternion &data, int32_t index=0)
Add/update Quaternion Orientation data for the item.
int rawTemperatureChannelCount(int32_t index=0) const
Returns the number of available Raw Temperature channels.
for(ctr=DCTSIZE;ctr > 0;ctr--)
uint16_t m_utcValid
Offset of validity part of UTC time.
size_t XsSize
XsSize must be unsigned number!
uint16_t m_oriQuat
Offset of orientation in quaternion format.
XsUShortVector rawGyroscopeData(int32_t index=0) const
Return the Raw Gyroscope component of a data item.
uint16_t m_mtwSdiData
Offset of MTw SDI data.
bool setAnalogIn2Data(const XsAnalogInData &data, int32_t index=0)
Add/update AnalogIn 2 for the item.
XsEuler orientationEuler(int32_t index=0) const
Return the Orientation component of a data item as Euler angles.
uint16_t m_status
Offset of status data.
bool setTemperature(const double &temp, int32_t index=0, int channel=0)
Add/update Calibrated Accelerometer data for the item.
uint16_t m_utcSecond
Offset of second part of UTC time.
uint16_t m_gpsPvtPressureAge
Offset of pressure age.
uint16_t m_oriEul
Offset of orientation in euler format.
uint16_t m_rawGyr
Offset of raw gyroscope data.
uint16_t m_wCurrentBias
Offset of MTw SDI gyroscope bias data.
uint16_t m_itemCount
The number of data items in the message.
bool containsFreeAcceleration(int32_t index=0) const
Check if data item contains XKF-3 Acc-G data.
double temperature(int32_t index=0, int channel=0) const
Return the Temperature component of a data item.
uint16_t m_gpsPvtItow
Offset of raw GPS ITOW (Integer Time Of Week) data.
struct XsUtcTime XsUtcTime
uint16_t m_doubleBoundary
Boundary where the original data format is ignored and values are stored in double precision...
XsUShortVector rawAcceleration(int32_t index=0) const
The Raw Accelerometer component of a data item.
uint16_t m_gpsPvtGpsAge
Offset of raw GPS age.
XsVector positionLLA(int32_t index=0) const
Return the Position Lat Lon Alt component of a data item.
LegacyDataPacket()
Construct a new LegacyDataPacket without data. The LegacyDataPacket will be invalid.
XsDataFormat dataFormat(int32_t index=0) const
Returns the data format of the device with the given index.
uint16_t m_gpsPvtData
Offset of GPS & pressure data.
uint16_t m_calGyr
Offset of calibrated gyroscope data.
bool setRawGyroscopeData(const XsUShortVector &vec, int32_t index=0)
Add/update Raw Gyroscope data for the item.
bool containsTriggerIndication(int channelID=0) const
Check if data item contains indication time on the given line.
XsAnalogInData analogIn2Data(int32_t index=0) const
Return the AnalogIn 2 component of a data item.
bool containsCalibratedData(int32_t index=0) const
Check if data item contains Calibrated Data.
bool containsCalibratedAcceleration(int32_t index=0) const
Check if data item contains Calibrated Accelerometer data.
uint16_t m_utcHour
Offset of hour part of UTC time.
Contains offset information about data in the packet.
XsVector calibratedGyroscopeData(int32_t index=0) const
Return the Calibrated Gyroscope component of a data item.
int64_t largePacketCounter(void) const
Return the 64-bit sample counter associated with this packet.
uint16_t m_analogIn1
Offset of analog in channel 1 data.
Structure for storing a single message.
XsGpsPvtData gpsPvtData(int32_t index=0) const
Return the Gps PVT data component of a data item.
bool setAnalogIn1Data(const XsAnalogInData &data, int32_t index=0)
Add/update AnalogIn 1 for the item.
uint16_t m_wVelocityIncrement
Offset of MTw SDI velocity increment data.
bool containsCalibratedMagneticField(int32_t index=0) const
Check if data item contains Calibrated Magnetometer data.
uint16_t m_oriMat
Offset of orientation in matrix format.
uint16_t m_gpsPvtSacc
Offset of raw GPS speed accuracy estimate data.
bool setFreeAcceleration(const XsVector &g, int32_t index=0)
Add/update XKF-3 Acc-G data for the item.
bool setPacketCounter(const uint16_t counter, int32_t index=0)
Add/update Sample Counter for all items.
PacketInfo * m_infoList
Contains information about data in the packet and the format of that data.
uint16_t m_wRssi
Offset of MTw SDI RSSI data.
void setDeviceId(XsDeviceId deviceId, int32_t index)
Sets the device ID of the device with the given index to deviceid.
bool setUtcTime(const XsUtcTime &data, int32_t index=0)
Add/update UTC Time for all items.
uint16_t m_rawMag
Offset of raw magnetometer data.
bool containsUtcTime(int32_t index=0) const
Check if data item contains UTC Time.
XsDeviceId deviceId(int32_t index) const
Returns the device ID of the device with the given index.
bool setVelocity(const XsVector &data, int32_t index=0)
Add/update Velocity for the item.
struct XsTimeStamp XsTimeStamp
uint16_t m_acc_g
Offset of acceleration in global frame.
bool setPositionLLA(const XsVector &data, int32_t index=0)
Add/update Position Lat Lon Alt for the item.
Class for managing timestamps in a unified way.
uint16_t m_lastFoundIndex
Index of last found deviceId, speeds up searches.
XsTimeStamp triggerIndication(int channelID) const
Return the synhcronization time recorded by the station.
void setItemCount(uint16_t count)
Set the number of devices whose data is contained in this object to count.
uint16_t m_temp[XS_MAX_TEMPERATURE_CHANNELS]
Offset of calibrated temperature data.
bool containsCalibratedGyroscopeData(int32_t index=0) const
Check if data item contains Calibrated Gyroscope data.
bool setPressure(const XsPressure &data, int32_t index=0)
Add/update pressure data for the item.
#define XS_DATA_ITEM_NOT_AVAILABLE
Indicates that a data item is not available in the packet.
XsQuaternion orientationQuaternion(int32_t index=0) const
Return the Orientation component of a data item as a Quaternion.
XsMessage originalMessage(void) const
Returns the original message as it was received, without computed and added data (except for SDI inte...
const LegacyDataPacket & operator=(const LegacyDataPacket &pack)
Assignment operator, copies the contents of pack into this.
bool containsRawTemperature(int32_t index=0, int channel=0) const
Check if data item contains Raw Temperature data.
uint16_t m_utcNano
Offset of nanosecond part of UTC time.
uint16_t m_wLastFrameNumber
Offset of MTw SDI last frame number in interval data.
Data from analog inputs from sensors.
uint16_t m_utcYear
Offset of year part of UTC time.
bool setStatus(const uint32_t data, int32_t index=0)
Add/update Status information for the item.
bool containsPacketCounter(int32_t index=0) const
Check if data item contains Sample Counter.
Contains an MTData XsMessage and supports functions for extracting contained data.
void setXbusSystem(bool xbus, bool convert=false)
Sets the xbus flag.
XsOutputSettings
Bit values for output settings.
bool containsRawMagneticField(int32_t index=0) const
Check if data item contains Raw Magnetometer data.
XsMessage message(void) const
Returns a copy of the XsMessage contained by the object, including computed and added data...
XsAnalogInData analogIn1Data(int32_t index=0) const
Return the AnalogIn 1 component of a data item.
uint16_t m_gpsPvtVele
Offset of raw GPS eastward velocity data.
uint16_t m_wBaroMeter
Offset of MTw SDI barometer data.
uint16_t m_detailedStatus
Offset of detailed status data.
bool setRawData(const XsScrData &data, int32_t index=0)
Add/update Raw Data for the item.
A structure for storing UTC Time values.
PacketInfo packetInfo(int32_t index) const
Returns the packet info for the index'th device in the packet.
uint16_t m_size
Total size of the data.
A structure containing fixed packet data, which should not change during a measurement for the same d...
bool containsPositionLLA(int32_t index=0) const
Check if data item contains Position Lat Lon Alt.
uint16_t m_gpsPvtVeln
Offset of raw GPS northward velocity data.
bool containsPressure(int32_t index=0) const
Return true if the packet contains pressure data.
XsTimeStamp m_triggerIn1
Trigger indication on line 1.
uint16_t packetCounter(int32_t index=0) const
Return the Sample Counter component of the packet.
XSTYPES_DLL_API int32_t XsMath_doubleToLong(double d)
uint32_t status(int32_t index, bool *outIsDetailed) const
Return the Status component of a data item.
void updateInfoList()
Update the internal info list by analyzing the known XsDataFormat for each device.
void setLargePacketCounter(int64_t sc)
Set the 64-bit sample counter associated with this packet.
bool containsOrientationQuaternion(int32_t index=0) const
Check if data item contains Quaternion Orientation data.
bool containsAnalogIn1Data(int32_t index=0) const
Check if data item contains AnalogIn 1.
uint16_t frameCounter() const
Return the frame counter (previously: sample counter) of the packet.
uint16_t m_gpsPvtHacc
Offset of raw GPS horizontal accuracy estimate data.
XsTimeStamp m_packetId
64 bit sample counter
XsUShortVector rawMagneticField(int32_t index=0) const
Return the Raw Magnetometer component of a data item.
void setTimeOfArrival(XsTimeStamp timeOfArrival)
Set the Time Of Arrival value to timeofarrival.
bool setRawAcceleration(const XsUShortVector &vec, int32_t index=0)
Add/update Raw Accelerometer data for the item.
uint16_t m_analogIn2
Offset of analog in channel 2 data.
XsVector calibratedAcceleration(int32_t index=0) const
Return the Calibrated Accelerometer component of a data item.
uint16_t XsMtTimeStamp
An MT timestamp (sample count)
GLenum GLsizei GLenum format
uint16_t m_utcMinute
Offset of minute part of UTC time.
XsDeviceId m_lastFoundId
Last found deviceId, speeds up searches.
bool setOrientationMatrix(const XsMatrix &data, int32_t index=0)
Add/update Matrix Orientation data for the item.
Container for raw sensor measurement data.
uint16_t m_calData
Offset of calibrated data.
XsCalibratedData calibratedData(int32_t index=0) const
Return the Calibrated Data component of a data item.
uint16_t getFPValueSize(int32_t index) const
Returns the floating/fixed point value size in bytes.
uint16_t m_wOrientationIncrement
Offset of MTw SDI orientation increment data.
bool containsAnalogIn2Data(int32_t index=0) const
Check if data item contains AnalogIn 2.
XsPressure pressure(int32_t index=0) const
Return the pressure data component of a data item.
void setRtc(XsTimeStamp rtc)
Set the Real Time Clock value to realtimeclock.
bool setCalibratedMagneticField(const XsVector &vec, int32_t index=0)
Add/update Calibrated Magnetometer data for the item.
bool containsVelocity(int32_t index=0) const
Check if data item contains Velocity.
bool containsStatus(int32_t index=0) const
Check if data item contains Status.
XsMatrix orientationMatrix(int32_t index=0) const
Return the Orientation component of a data item as an Orientation Matrix.
uint16_t m_wMagnetoMeter
Offset of MTw SDI magnetometer data.
bool containsDetailedStatus(int32_t index=0) const
Check if data item contains detailed Status information.
uint16_t m_posLLA
Offset of Latitude-Longitude-Altitude position data.
bool setCalibratedData(const XsCalibratedData &data, int32_t index=0)
Add/update Calibrated Data for the item.
uint16_t m_sc
Offset of sample counter.
XsTimeStamp m_rtc
Sample time in ms, based on the sample counter.
bool containsRawGyroscopeData(int32_t index=0) const
Check if data item contains Raw Gyroscope data.
unsigned __int32 uint32_t
~LegacyDataPacket()
Destructor.
XsVector calibratedMagneticField(int32_t index=0) const
Return the Calibrated Magnetometer component of a data item.
#define swapEndian16(src)
GLsizei GLsizei GLenum GLenum const GLvoid * data
bool containsTemperature(int32_t index=0, int channel=0) const
Check if data item contains Temperature data.
XsTimeStamp m_triggerIn2
Trigger indication on line 2.
bool setCalibratedAcceleration(const XsVector &vec, int32_t index=0)
Add/update Calibrated Accelerometer data for the item.
bool containsGpsPvtData(int32_t index=0) const
Check if data item contains Gps PVT Data.
XsVector velocity(int32_t index=0) const
Return the Velocity component of a data item.
bool isXbusSystem(void) const
Returns whether the xbus flag is set or not.
bool setCalibratedGyroscopeData(const XsVector &vec, int32_t index=0)
Add/update Calibrated Gyroscope data for the item.
bool setOrientationEuler(const XsEuler &data, int32_t index=0)
Add/update Euler Orientation data for the item.
XsTimeStamp m_toa
Time of arrival.
bool m_xm
Indicates that xbus-formatting is used.
XsTimeStamp timeOfArrival(void) const
Returns the Time Of Arrival value as stored in the object.
bool containsRawAcceleration(int32_t index=0) const
Check if data item contains Raw Accelerometer data.
Data from the GPS unit of a legacy MTi-G.
uint16_t m_utcDay
Offset of day part of UTC time.
XsDeviceId * m_idList
A list of the device-ids in this packet.