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

Public Member Functions

 WeightScaleMessagePrivate (WeightScaleMessage *const q)
 
virtual ~WeightScaleMessagePrivate ()
 
- 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 WeightScaleMessage FIT message's timestamp field.
 
Weight weight
 The WeightScaleMessage FIT message's weight field.
 
quint16 percentFat
 The WeightScaleMessage FIT message's percentFat field.
 
quint16 percentHydration
 The WeightScaleMessage FIT message's percentHydration field.
 
quint16 visceralFatMass
 The WeightScaleMessage FIT message's visceralFatMass field.
 
quint16 boneMass
 The WeightScaleMessage FIT message's boneMass field.
 
quint16 muscleMass
 The WeightScaleMessage FIT message's muscleMass field.
 
quint16 basalMet
 The WeightScaleMessage FIT message's basalMet field.
 
quint8 physiqueRating
 The WeightScaleMessage FIT message's physiqueRating field.
 
quint16 activeMet
 The WeightScaleMessage FIT message's activeMet field. More...
 
quint8 metabolicAge
 The WeightScaleMessage FIT message's metabolicAge field.
 
quint8 visceralFatRating
 The WeightScaleMessage FIT message's visceralFatRating field.
 
MessageIndex userProfileIndex
 The WeightScaleMessage FIT message's userProfileIndex 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 WeightScaleMessagePrivate class provides private implementation for the WeightScaleMessage.

See also
WeightScaleMessage

Definition at line 38 of file weightscalemessage_p.h.

Constructor & Destructor Documentation

◆ WeightScaleMessagePrivate()

WeightScaleMessagePrivate::WeightScaleMessagePrivate ( WeightScaleMessage *const  q)
explicit

Constructs a WeightScaleMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 367 of file weightscalemessage.cpp.

369  , timestamp(static_cast<DateTime>(-1))
370  , weight(static_cast<Weight>(-1))
371  , percentFat(0xFFFF)
372  , percentHydration(0xFFFF)
373  , visceralFatMass(0xFFFF)
374  , boneMass(0xFFFF)
375  , muscleMass(0xFFFF)
376  , basalMet(0xFFFF)
377  , physiqueRating(0xFF)
378  , activeMet(0xFFFF)
379  , metabolicAge(0xFF)
380  , visceralFatRating(0xFF)
381  , userProfileIndex(static_cast<MessageIndex>(-1))
382 {
383  globalMessageNumber = MesgNum::WeightScale;
384 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
quint16 percentFat
The WeightScaleMessage FIT message's percentFat field.
quint8 visceralFatRating
The WeightScaleMessage FIT message's visceralFatRating field.
MessageIndex userProfileIndex
The WeightScaleMessage FIT message's userProfileIndex field.
quint8 metabolicAge
The WeightScaleMessage FIT message's metabolicAge field.
quint8 physiqueRating
The WeightScaleMessage FIT message's physiqueRating field.
DateTime timestamp
The WeightScaleMessage FIT message's timestamp field.
quint16 muscleMass
The WeightScaleMessage FIT message's muscleMass field.
quint16 boneMass
The WeightScaleMessage FIT message's boneMass field.
quint16 activeMet
The WeightScaleMessage FIT message's activeMet field.
quint16 visceralFatMass
The WeightScaleMessage FIT message's visceralFatMass field.
quint16 percentHydration
The WeightScaleMessage FIT message's percentHydration field.
quint16 basalMet
The WeightScaleMessage FIT message's basalMet field.
Weight weight
The WeightScaleMessage FIT message's weight field.
Weight
Garmin FIT Weight type.
Definition: types.h:2188
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~WeightScaleMessagePrivate()

WeightScaleMessagePrivate::~WeightScaleMessagePrivate ( )
virtual

Destroys the WeightScaleMessagePrivate object.

Definition at line 391 of file weightscalemessage.cpp.

392 {
393 
394 }

Member Function Documentation

◆ setField()

bool WeightScaleMessagePrivate::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 396 of file weightscalemessage.cpp.

398 {
399  switch (fieldId) {
400  case 253: // See Profile.xlsx::Messages:weight_scale.timestamp
401  if (!verify(data, baseType, 4, FitBaseType::Uint32, "weight_scale.timestamp")) return false;
402  this->timestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
403  break;
404  case 0: // See Profile.xlsx::Messages:weight_scale.weight
405  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.weight")) return false;
406  this->weight = static_cast<Weight>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
407  break;
408  case 1: // See Profile.xlsx::Messages:weight_scale.percentFat
409  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.percentFat")) return false;
410  this->percentFat = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
411  break;
412  case 2: // See Profile.xlsx::Messages:weight_scale.percentHydration
413  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.percentHydration")) return false;
414  this->percentHydration = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
415  break;
416  case 3: // See Profile.xlsx::Messages:weight_scale.visceralFatMass
417  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.visceralFatMass")) return false;
418  this->visceralFatMass = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
419  break;
420  case 4: // See Profile.xlsx::Messages:weight_scale.boneMass
421  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.boneMass")) return false;
422  this->boneMass = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
423  break;
424  case 5: // See Profile.xlsx::Messages:weight_scale.muscleMass
425  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.muscleMass")) return false;
426  this->muscleMass = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
427  break;
428  case 7: // See Profile.xlsx::Messages:weight_scale.basalMet
429  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.basalMet")) return false;
430  this->basalMet = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
431  break;
432  case 8: // See Profile.xlsx::Messages:weight_scale.physiqueRating
433  if (!verify(data, baseType, 1, FitBaseType::Uint8, "weight_scale.physiqueRating")) return false;
434  this->physiqueRating = static_cast<quint8>(data.at(0));
435  break;
436  case 9: // See Profile.xlsx::Messages:weight_scale.activeMet
437  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.activeMet")) return false;
438  this->activeMet = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
439  break;
440  case 10: // See Profile.xlsx::Messages:weight_scale.metabolicAge
441  if (!verify(data, baseType, 1, FitBaseType::Uint8, "weight_scale.metabolicAge")) return false;
442  this->metabolicAge = static_cast<quint8>(data.at(0));
443  break;
444  case 11: // See Profile.xlsx::Messages:weight_scale.visceralFatRating
445  if (!verify(data, baseType, 1, FitBaseType::Uint8, "weight_scale.visceralFatRating")) return false;
446  this->visceralFatRating = static_cast<quint8>(data.at(0));
447  break;
448  case 12: // See Profile.xlsx::Messages:weight_scale.userProfileIndex
449  if (!verify(data, baseType, 2, FitBaseType::Uint16, "weight_scale.userProfileIndex")) return false;
450  this->userProfileIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
451  break;
452  default:
453  qWarning() << "ignoring unknown weight_scale message field number" << fieldId << bigEndian;
454  // Fall through to return true, as its still 'safe' to continue parsing data messages.
455  }
456  return true;
457 }
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

◆ activeMet

quint16 WeightScaleMessagePrivate::activeMet

The WeightScaleMessage FIT message's activeMet field.

~4kJ per kcal, 0.25 allows max 16384 kcal

Definition at line 91 of file weightscalemessage_p.h.

◆ userProfileIndex

MessageIndex WeightScaleMessagePrivate::userProfileIndex

The WeightScaleMessage FIT message's userProfileIndex field.

Associates this weight scale message to a user. This corresponds to the index of the user profile message in the weight scale file.

Definition at line 109 of file weightscalemessage_p.h.


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