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

Public Member Functions

 JumpMessagePrivate (JumpMessage *const q)
 
virtual ~JumpMessagePrivate ()
 
- 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 JumpMessage FIT message's timestamp field.
 
float distance
 The JumpMessage FIT message's distance field.
 
float height
 The JumpMessage FIT message's height field.
 
quint8 rotations
 The JumpMessage FIT message's rotations field.
 
float hangTime
 The JumpMessage FIT message's hangTime field.
 
float score
 The JumpMessage FIT message's score field. More...
 
qint32 positionLat
 The JumpMessage FIT message's positionLat field.
 
qint32 positionLong
 The JumpMessage FIT message's positionLong field.
 
quint16 speed
 The JumpMessage FIT message's speed field.
 
quint32 enhancedSpeed
 The JumpMessage FIT message's enhancedSpeed field.
 
- 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 JumpMessagePrivate class provides private implementation for the JumpMessage.

See also
JumpMessage

Definition at line 38 of file jumpmessage_p.h.

Constructor & Destructor Documentation

◆ JumpMessagePrivate()

JumpMessagePrivate::JumpMessagePrivate ( JumpMessage *const  q)
explicit

Constructs a JumpMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 301 of file jumpmessage.cpp.

303  , timestamp(static_cast<DateTime>(-1))
304  , distance(static_cast<float>(-1))
305  , height(static_cast<float>(-1))
306  , rotations(0xFF)
307  , hangTime(static_cast<float>(-1))
308  , score(static_cast<float>(-1))
309  , positionLat(0x7FFFFFFF)
310  , positionLong(0x7FFFFFFF)
311  , speed(0xFFFF)
312  , enhancedSpeed(0xFFFFFFFF)
313 {
314  globalMessageNumber = MesgNum::Jump;
315 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
float score
The JumpMessage FIT message's score field.
Definition: jumpmessage_p.h:71
quint32 enhancedSpeed
The JumpMessage FIT message's enhancedSpeed field.
Definition: jumpmessage_p.h:91
float height
The JumpMessage FIT message's height field.
Definition: jumpmessage_p.h:54
quint8 rotations
The JumpMessage FIT message's rotations field.
Definition: jumpmessage_p.h:59
float distance
The JumpMessage FIT message's distance field.
Definition: jumpmessage_p.h:49
qint32 positionLong
The JumpMessage FIT message's positionLong field.
Definition: jumpmessage_p.h:81
float hangTime
The JumpMessage FIT message's hangTime field.
Definition: jumpmessage_p.h:64
quint16 speed
The JumpMessage FIT message's speed field.
Definition: jumpmessage_p.h:86
qint32 positionLat
The JumpMessage FIT message's positionLat field.
Definition: jumpmessage_p.h:76
DateTime timestamp
The JumpMessage FIT message's timestamp field.
Definition: jumpmessage_p.h:44
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~JumpMessagePrivate()

JumpMessagePrivate::~JumpMessagePrivate ( )
virtual

Destroys the JumpMessagePrivate object.

Definition at line 322 of file jumpmessage.cpp.

323 {
324 
325 }

Member Function Documentation

◆ setField()

bool JumpMessagePrivate::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 327 of file jumpmessage.cpp.

329 {
330  switch (fieldId) {
331  case 253: // See Profile.xlsx::Messages:jump.timestamp
332  if (!verify(data, baseType, 4, FitBaseType::Uint32, "jump.timestamp")) return false;
333  this->timestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
334  break;
335  case 0: // See Profile.xlsx::Messages:jump.distance
336  if (!verify(data, baseType, 4, FitBaseType::Float32, "jump.distance")) return false;
337  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
338  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
339  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
340  static_assert(sizeof(localEndian) == 4, "src not expected size");
341  static_assert(sizeof(this->distance) == 4, "src and dst not the same size");
342  memcpy(&this->distance, &localEndian, data.size());
343  }
344  #else
345  this->distance = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
346  #endif
347  break;
348  case 1: // See Profile.xlsx::Messages:jump.height
349  if (!verify(data, baseType, 4, FitBaseType::Float32, "jump.height")) return false;
350  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
351  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
352  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
353  static_assert(sizeof(localEndian) == 4, "src not expected size");
354  static_assert(sizeof(this->height) == 4, "src and dst not the same size");
355  memcpy(&this->height, &localEndian, data.size());
356  }
357  #else
358  this->height = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
359  #endif
360  break;
361  case 2: // See Profile.xlsx::Messages:jump.rotations
362  if (!verify(data, baseType, 1, FitBaseType::Uint8, "jump.rotations")) return false;
363  this->rotations = static_cast<quint8>(data.at(0));
364  break;
365  case 3: // See Profile.xlsx::Messages:jump.hangTime
366  if (!verify(data, baseType, 4, FitBaseType::Float32, "jump.hangTime")) return false;
367  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
368  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
369  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
370  static_assert(sizeof(localEndian) == 4, "src not expected size");
371  static_assert(sizeof(this->hangTime) == 4, "src and dst not the same size");
372  memcpy(&this->hangTime, &localEndian, data.size());
373  }
374  #else
375  this->hangTime = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
376  #endif
377  break;
378  case 4: // See Profile.xlsx::Messages:jump.score
379  if (!verify(data, baseType, 4, FitBaseType::Float32, "jump.score")) return false;
380  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
381  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
382  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
383  static_assert(sizeof(localEndian) == 4, "src not expected size");
384  static_assert(sizeof(this->score) == 4, "src and dst not the same size");
385  memcpy(&this->score, &localEndian, data.size());
386  }
387  #else
388  this->score = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
389  #endif
390  break;
391  case 5: // See Profile.xlsx::Messages:jump.positionLat
392  if (!verify(data, baseType, 4, FitBaseType::Sint32, "jump.positionLat")) return false;
393  this->positionLat = static_cast<qint32>(bigEndian ? qFromBigEndian< qint32>(data) : qFromLittleEndian< qint32>(data));
394  break;
395  case 6: // See Profile.xlsx::Messages:jump.positionLong
396  if (!verify(data, baseType, 4, FitBaseType::Sint32, "jump.positionLong")) return false;
397  this->positionLong = static_cast<qint32>(bigEndian ? qFromBigEndian< qint32>(data) : qFromLittleEndian< qint32>(data));
398  break;
399  case 7: // See Profile.xlsx::Messages:jump.speed
400  if (!verify(data, baseType, 2, FitBaseType::Uint16, "jump.speed")) return false;
401  this->speed = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
402  break;
403  case 8: // See Profile.xlsx::Messages:jump.enhancedSpeed
404  if (!verify(data, baseType, 4, FitBaseType::Uint32, "jump.enhancedSpeed")) return false;
405  this->enhancedSpeed = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
406  break;
407  default:
408  qWarning() << "ignoring unknown jump message field number" << fieldId << bigEndian;
409  // Fall through to return true, as its still 'safe' to continue parsing data messages.
410  }
411  return true;
412 }
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

◆ score

float JumpMessagePrivate::score

The JumpMessage FIT message's score field.

A score for a jump calculated based on hang time, rotations, and distance.

Definition at line 71 of file jumpmessage_p.h.


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