QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GyroscopeDataMessagePrivate Class Reference
Inheritance diagram for GyroscopeDataMessagePrivate:
[legend]
Collaboration diagram for GyroscopeDataMessagePrivate:
[legend]

Public Member Functions

 GyroscopeDataMessagePrivate (GyroscopeDataMessage *const q)
 
virtual ~GyroscopeDataMessagePrivate ()
 
- Public Member Functions inherited from AbstractDataMessagePrivate
 AbstractDataMessagePrivate (AbstractDataMessage *const q)
 
virtual ~AbstractDataMessagePrivate ()
 
bool setFields (const DataDefinition *const defn, const QByteArray &record)
 

Public Attributes

DateTime timestamp
 The GyroscopeDataMessage FIT message's timestamp field. More...
 
quint16 timestampMs
 The GyroscopeDataMessage FIT message's timestampMs field. More...
 
quint16 sampleTimeOffset
 The GyroscopeDataMessage FIT message's sampleTimeOffset field. More...
 
quint16 gyroX
 The GyroscopeDataMessage FIT message's gyroX field. More...
 
quint16 gyroY
 The GyroscopeDataMessage FIT message's gyroY field. More...
 
quint16 gyroZ
 The GyroscopeDataMessage FIT message's gyroZ field. More...
 
float calibratedGyroX
 The GyroscopeDataMessage FIT message's calibratedGyroX field. More...
 
float calibratedGyroY
 The GyroscopeDataMessage FIT message's calibratedGyroY field. More...
 
float calibratedGyroZ
 The GyroscopeDataMessage FIT message's calibratedGyroZ field. More...
 
- Public Attributes inherited from AbstractDataMessagePrivate
MesgNum globalMessageNumber
 FIT Globla Message Number for this FIT Data Message.
 

Protected Member Functions

bool setField (const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
 
- Protected Member Functions inherited from AbstractDataMessagePrivate
bool verify (const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
 

Additional Inherited Members

- Protected Attributes inherited from AbstractDataMessagePrivate
AbstractDataMessage *const q_ptr
 Internal q-pointer.
 

Detailed Description

The GyroscopeDataMessagePrivate class provides private implementation for the GyroscopeDataMessage.

See also
GyroscopeDataMessage

Definition at line 38 of file gyroscopedatamessage_p.h.

Constructor & Destructor Documentation

◆ GyroscopeDataMessagePrivate()

GyroscopeDataMessagePrivate::GyroscopeDataMessagePrivate ( GyroscopeDataMessage *const  q)
explicit

Constructs a GyroscopeDataMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 301 of file gyroscopedatamessage.cpp.

303  , timestamp(static_cast<DateTime>(-1))
304  , timestampMs(0xFFFF)
305  , sampleTimeOffset(0xFFFF)
306  , gyroX(0xFFFF)
307  , gyroY(0xFFFF)
308  , gyroZ(0xFFFF)
309  , calibratedGyroX(static_cast<float>(-1))
310  , calibratedGyroY(static_cast<float>(-1))
311  , calibratedGyroZ(static_cast<float>(-1))
312 {
313  globalMessageNumber = MesgNum::GyroscopeData;
314 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
quint16 gyroX
The GyroscopeDataMessage FIT message's gyroX field.
quint16 gyroY
The GyroscopeDataMessage FIT message's gyroY field.
DateTime timestamp
The GyroscopeDataMessage FIT message's timestamp field.
float calibratedGyroX
The GyroscopeDataMessage FIT message's calibratedGyroX field.
float calibratedGyroY
The GyroscopeDataMessage FIT message's calibratedGyroY field.
quint16 sampleTimeOffset
The GyroscopeDataMessage FIT message's sampleTimeOffset field.
quint16 gyroZ
The GyroscopeDataMessage FIT message's gyroZ field.
quint16 timestampMs
The GyroscopeDataMessage FIT message's timestampMs field.
float calibratedGyroZ
The GyroscopeDataMessage FIT message's calibratedGyroZ field.
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~GyroscopeDataMessagePrivate()

GyroscopeDataMessagePrivate::~GyroscopeDataMessagePrivate ( )
virtual

Destroys the GyroscopeDataMessagePrivate object.

Definition at line 321 of file gyroscopedatamessage.cpp.

322 {
323 
324 }

Member Function Documentation

◆ setField()

bool GyroscopeDataMessagePrivate::setField ( const int  fieldId,
const QByteArray &  data,
const FitBaseType  baseType,
const bool  bigEndian 
)
overrideprotectedvirtual

Sets the value of the fieldId field.

Derived classes must implement this method to extract the baseType value from data, and assign the extracted value the fieldId field.

Parameters
fieldIdThe field number within the given FIT data message.
dataThe raw data to extract the field value from.
baseTypeThe FIT base type for the field.
bigEndianWhether or not multibyte values in record are big-endian.
Returns
true if the field was set, or safely ignored; false otherwise.

Implements AbstractDataMessagePrivate.

Definition at line 326 of file gyroscopedatamessage.cpp.

328 {
329  switch (fieldId) {
330  case 253: // See Profile.xlsx::Messages:gyroscope_data.timestamp
331  if (!verify(data, baseType, 4, FitBaseType::Uint32, "gyroscope_data.timestamp")) return false;
332  this->timestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
333  break;
334  case 0: // See Profile.xlsx::Messages:gyroscope_data.timestampMs
335  if (!verify(data, baseType, 2, FitBaseType::Uint16, "gyroscope_data.timestampMs")) return false;
336  this->timestampMs = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
337  break;
338  case 1: // See Profile.xlsx::Messages:gyroscope_data.sampleTimeOffset
339  if (!verify(data, baseType, 2, FitBaseType::Uint16, "gyroscope_data.sampleTimeOffset")) return false;
340  this->sampleTimeOffset = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
341  break;
342  case 2: // See Profile.xlsx::Messages:gyroscope_data.gyroX
343  if (!verify(data, baseType, 2, FitBaseType::Uint16, "gyroscope_data.gyroX")) return false;
344  this->gyroX = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
345  break;
346  case 3: // See Profile.xlsx::Messages:gyroscope_data.gyroY
347  if (!verify(data, baseType, 2, FitBaseType::Uint16, "gyroscope_data.gyroY")) return false;
348  this->gyroY = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
349  break;
350  case 4: // See Profile.xlsx::Messages:gyroscope_data.gyroZ
351  if (!verify(data, baseType, 2, FitBaseType::Uint16, "gyroscope_data.gyroZ")) return false;
352  this->gyroZ = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
353  break;
354  case 5: // See Profile.xlsx::Messages:gyroscope_data.calibratedGyroX
355  if (!verify(data, baseType, 4, FitBaseType::Float32, "gyroscope_data.calibratedGyroX")) return false;
356  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
357  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
358  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
359  static_assert(sizeof(localEndian) == 4, "src not expected size");
360  static_assert(sizeof(this->calibratedGyroX) == 4, "src and dst not the same size");
361  memcpy(&this->calibratedGyroX, &localEndian, data.size());
362  }
363  #else
364  this->calibratedGyroX = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
365  #endif
366  break;
367  case 6: // See Profile.xlsx::Messages:gyroscope_data.calibratedGyroY
368  if (!verify(data, baseType, 4, FitBaseType::Float32, "gyroscope_data.calibratedGyroY")) return false;
369  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
370  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
371  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
372  static_assert(sizeof(localEndian) == 4, "src not expected size");
373  static_assert(sizeof(this->calibratedGyroY) == 4, "src and dst not the same size");
374  memcpy(&this->calibratedGyroY, &localEndian, data.size());
375  }
376  #else
377  this->calibratedGyroY = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
378  #endif
379  break;
380  case 7: // See Profile.xlsx::Messages:gyroscope_data.calibratedGyroZ
381  if (!verify(data, baseType, 4, FitBaseType::Float32, "gyroscope_data.calibratedGyroZ")) return false;
382  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
383  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
384  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
385  static_assert(sizeof(localEndian) == 4, "src not expected size");
386  static_assert(sizeof(this->calibratedGyroZ) == 4, "src and dst not the same size");
387  memcpy(&this->calibratedGyroZ, &localEndian, data.size());
388  }
389  #else
390  this->calibratedGyroZ = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
391  #endif
392  break;
393  default:
394  qWarning() << "ignoring unknown gyroscope_data message field number" << fieldId << bigEndian;
395  // Fall through to return true, as its still 'safe' to continue parsing data messages.
396  }
397  return true;
398 }
bool verify(const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)

References AbstractDataMessagePrivate::verify().

Here is the call graph for this function:

Member Data Documentation

◆ calibratedGyroX

float GyroscopeDataMessagePrivate::calibratedGyroX

The GyroscopeDataMessage FIT message's calibratedGyroX field.

Calibrated gyro reading

Definition at line 93 of file gyroscopedatamessage_p.h.

◆ calibratedGyroY

float GyroscopeDataMessagePrivate::calibratedGyroY

The GyroscopeDataMessage FIT message's calibratedGyroY field.

Calibrated gyro reading

Definition at line 100 of file gyroscopedatamessage_p.h.

◆ calibratedGyroZ

float GyroscopeDataMessagePrivate::calibratedGyroZ

The GyroscopeDataMessage FIT message's calibratedGyroZ field.

Calibrated gyro reading

Definition at line 107 of file gyroscopedatamessage_p.h.

◆ gyroX

quint16 GyroscopeDataMessagePrivate::gyroX

The GyroscopeDataMessage FIT message's gyroX field.

These are the raw ADC reading. Maximum number of samples is 30 in each message. The samples may span across seconds. A conversion will need to be done on this data once read.

Definition at line 70 of file gyroscopedatamessage_p.h.

◆ gyroY

quint16 GyroscopeDataMessagePrivate::gyroY

The GyroscopeDataMessage FIT message's gyroY field.

These are the raw ADC reading. Maximum number of samples is 30 in each message. The samples may span across seconds. A conversion will need to be done on this data once read.

Definition at line 78 of file gyroscopedatamessage_p.h.

◆ gyroZ

quint16 GyroscopeDataMessagePrivate::gyroZ

The GyroscopeDataMessage FIT message's gyroZ field.

These are the raw ADC reading. Maximum number of samples is 30 in each message. The samples may span across seconds. A conversion will need to be done on this data once read.

Definition at line 86 of file gyroscopedatamessage_p.h.

◆ sampleTimeOffset

quint16 GyroscopeDataMessagePrivate::sampleTimeOffset

The GyroscopeDataMessage FIT message's sampleTimeOffset field.

Each time in the array describes the time at which the gyro sample with the corrosponding index was taken. Limited to 30 samples in each message. The samples may span across seconds. Array size must match the number of samples in gyro_x and gyro_y and gyro_z

Definition at line 62 of file gyroscopedatamessage_p.h.

◆ timestamp

DateTime GyroscopeDataMessagePrivate::timestamp

The GyroscopeDataMessage FIT message's timestamp field.

Whole second part of the timestamp

Definition at line 46 of file gyroscopedatamessage_p.h.

◆ timestampMs

quint16 GyroscopeDataMessagePrivate::timestampMs

The GyroscopeDataMessage FIT message's timestampMs field.

Millisecond part of the timestamp.

Definition at line 53 of file gyroscopedatamessage_p.h.


The documentation for this class was generated from the following files: