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

Public Member Functions

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

Public Attributes

MessageIndex messageIndex
 The DiveSettingsMessage FIT message's messageIndex field.
 
QString name
 The DiveSettingsMessage FIT message's name field.
 
TissueModelType model
 The DiveSettingsMessage FIT message's model field.
 
quint8 gfLow
 The DiveSettingsMessage FIT message's gfLow field.
 
quint8 gfHigh
 The DiveSettingsMessage FIT message's gfHigh field.
 
WaterType waterType
 The DiveSettingsMessage FIT message's waterType field.
 
float waterDensity
 The DiveSettingsMessage FIT message's waterDensity field. More...
 
quint8 po2Warn
 The DiveSettingsMessage FIT message's po2Warn field. More...
 
quint8 po2Critical
 The DiveSettingsMessage FIT message's po2Critical field. More...
 
quint8 po2Deco
 The DiveSettingsMessage FIT message's po2Deco field.
 
bool safetyStopEnabled
 The DiveSettingsMessage FIT message's safetyStopEnabled field.
 
float bottomDepth
 The DiveSettingsMessage FIT message's bottomDepth field.
 
quint32 bottomTime
 The DiveSettingsMessage FIT message's bottomTime field.
 
bool apneaCountdownEnabled
 The DiveSettingsMessage FIT message's apneaCountdownEnabled field.
 
quint32 apneaCountdownTime
 The DiveSettingsMessage FIT message's apneaCountdownTime field.
 
DiveBacklightMode backlightMode
 The DiveSettingsMessage FIT message's backlightMode field.
 
quint8 backlightBrightness
 The DiveSettingsMessage FIT message's backlightBrightness field.
 
BacklightTimeout backlightTimeout
 The DiveSettingsMessage FIT message's backlightTimeout field.
 
quint16 repeatDiveInterval
 The DiveSettingsMessage FIT message's repeatDiveInterval field. More...
 
quint16 safetyStopTime
 The DiveSettingsMessage FIT message's safetyStopTime field. More...
 
SourceType heartRateSourceType
 The DiveSettingsMessage FIT message's heartRateSourceType field.
 
quint8 heartRateSource
 The DiveSettingsMessage FIT message's heartRateSource 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 DiveSettingsMessagePrivate class provides private implementation for the DiveSettingsMessage.

See also
DiveSettingsMessage

Definition at line 38 of file divesettingsmessage_p.h.

Constructor & Destructor Documentation

◆ DiveSettingsMessagePrivate()

DiveSettingsMessagePrivate::DiveSettingsMessagePrivate ( DiveSettingsMessage *const  q)
explicit

Constructs a DiveSettingsMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 561 of file divesettingsmessage.cpp.

563  , messageIndex(static_cast<MessageIndex>(-1))
564  , model(static_cast<TissueModelType>(-1))
565  , gfLow(0xFF)
566  , gfHigh(0xFF)
567  , waterType(static_cast<WaterType>(-1))
568  , waterDensity(static_cast<float>(-1))
569  , po2Warn(0xFF)
570  , po2Critical(0xFF)
571  , po2Deco(0xFF)
572  , safetyStopEnabled(static_cast<bool>(-1))
573  , bottomDepth(static_cast<float>(-1))
574  , bottomTime(0xFFFFFFFF)
575  , apneaCountdownEnabled(static_cast<bool>(-1))
576  , apneaCountdownTime(0xFFFFFFFF)
577  , backlightMode(static_cast<DiveBacklightMode>(-1))
578  , backlightBrightness(0xFF)
579  , backlightTimeout(static_cast<BacklightTimeout>(-1))
580  , repeatDiveInterval(0xFFFF)
581  , safetyStopTime(0xFFFF)
582  , heartRateSourceType(static_cast<SourceType>(-1))
583  , heartRateSource(0xFF)
584 {
585  globalMessageNumber = MesgNum::DiveSettings;
586 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
quint8 gfLow
The DiveSettingsMessage FIT message's gfLow field.
bool safetyStopEnabled
The DiveSettingsMessage FIT message's safetyStopEnabled field.
quint8 po2Deco
The DiveSettingsMessage FIT message's po2Deco field.
float waterDensity
The DiveSettingsMessage FIT message's waterDensity field.
float bottomDepth
The DiveSettingsMessage FIT message's bottomDepth field.
DiveBacklightMode backlightMode
The DiveSettingsMessage FIT message's backlightMode field.
quint8 po2Critical
The DiveSettingsMessage FIT message's po2Critical field.
quint8 po2Warn
The DiveSettingsMessage FIT message's po2Warn field.
BacklightTimeout backlightTimeout
The DiveSettingsMessage FIT message's backlightTimeout field.
quint16 safetyStopTime
The DiveSettingsMessage FIT message's safetyStopTime field.
quint32 apneaCountdownTime
The DiveSettingsMessage FIT message's apneaCountdownTime field.
quint8 heartRateSource
The DiveSettingsMessage FIT message's heartRateSource field.
SourceType heartRateSourceType
The DiveSettingsMessage FIT message's heartRateSourceType field.
quint8 gfHigh
The DiveSettingsMessage FIT message's gfHigh field.
WaterType waterType
The DiveSettingsMessage FIT message's waterType field.
TissueModelType model
The DiveSettingsMessage FIT message's model field.
quint8 backlightBrightness
The DiveSettingsMessage FIT message's backlightBrightness field.
MessageIndex messageIndex
The DiveSettingsMessage FIT message's messageIndex field.
quint16 repeatDiveInterval
The DiveSettingsMessage FIT message's repeatDiveInterval field.
bool apneaCountdownEnabled
The DiveSettingsMessage FIT message's apneaCountdownEnabled field.
quint32 bottomTime
The DiveSettingsMessage FIT message's bottomTime field.
SourceType
Garmin FIT SourceType type.
Definition: types.h:2789
DiveBacklightMode
Garmin FIT DiveBacklightMode type.
Definition: types.h:5249
TissueModelType
Garmin FIT TissueModelType type.
Definition: types.h:5207
BacklightTimeout
Timeout in seconds.
Definition: types.h:1120
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263
WaterType
Garmin FIT WaterType type.
Definition: types.h:5191

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~DiveSettingsMessagePrivate()

DiveSettingsMessagePrivate::~DiveSettingsMessagePrivate ( )
virtual

Destroys the DiveSettingsMessagePrivate object.

Definition at line 593 of file divesettingsmessage.cpp.

594 {
595 
596 }

Member Function Documentation

◆ setField()

bool DiveSettingsMessagePrivate::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 598 of file divesettingsmessage.cpp.

600 {
601  switch (fieldId) {
602  case 254: // See Profile.xlsx::Messages:dive_settings.messageIndex
603  if (!verify(data, baseType, 2, FitBaseType::Uint16, "dive_settings.messageIndex")) return false;
604  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
605  break;
606  case 0: // See Profile.xlsx::Messages:dive_settings.name
607  if (!verify(data, baseType, 1, FitBaseType::String, "dive_settings.name")) return false;
608  this->name = QString::fromUtf8(data);
609  break;
610  case 1: // See Profile.xlsx::Messages:dive_settings.model
611  if (!verify(data, baseType, 1, FitBaseType::Enum, "dive_settings.model")) return false;
612  this->model = static_cast<TissueModelType>(data.at(0));
613  break;
614  case 2: // See Profile.xlsx::Messages:dive_settings.gfLow
615  if (!verify(data, baseType, 1, FitBaseType::Uint8, "dive_settings.gfLow")) return false;
616  this->gfLow = static_cast<quint8>(data.at(0));
617  break;
618  case 3: // See Profile.xlsx::Messages:dive_settings.gfHigh
619  if (!verify(data, baseType, 1, FitBaseType::Uint8, "dive_settings.gfHigh")) return false;
620  this->gfHigh = static_cast<quint8>(data.at(0));
621  break;
622  case 4: // See Profile.xlsx::Messages:dive_settings.waterType
623  if (!verify(data, baseType, 1, FitBaseType::Enum, "dive_settings.waterType")) return false;
624  this->waterType = static_cast<WaterType>(data.at(0));
625  break;
626  case 5: // See Profile.xlsx::Messages:dive_settings.waterDensity
627  if (!verify(data, baseType, 4, FitBaseType::Float32, "dive_settings.waterDensity")) return false;
628  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
629  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
630  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
631  static_assert(sizeof(localEndian) == 4, "src not expected size");
632  static_assert(sizeof(this->waterDensity) == 4, "src and dst not the same size");
633  memcpy(&this->waterDensity, &localEndian, data.size());
634  }
635  #else
636  this->waterDensity = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
637  #endif
638  break;
639  case 6: // See Profile.xlsx::Messages:dive_settings.po2Warn
640  if (!verify(data, baseType, 1, FitBaseType::Uint8, "dive_settings.po2Warn")) return false;
641  this->po2Warn = static_cast<quint8>(data.at(0));
642  break;
643  case 7: // See Profile.xlsx::Messages:dive_settings.po2Critical
644  if (!verify(data, baseType, 1, FitBaseType::Uint8, "dive_settings.po2Critical")) return false;
645  this->po2Critical = static_cast<quint8>(data.at(0));
646  break;
647  case 8: // See Profile.xlsx::Messages:dive_settings.po2Deco
648  if (!verify(data, baseType, 1, FitBaseType::Uint8, "dive_settings.po2Deco")) return false;
649  this->po2Deco = static_cast<quint8>(data.at(0));
650  break;
651  case 9: // See Profile.xlsx::Messages:dive_settings.safetyStopEnabled
652  if (!verify(data, baseType, 0, FitBaseType::Byte, "dive_settings.safetyStopEnabled")) return false;
653  this->safetyStopEnabled = static_cast<bool>(data.at(0));
654  break;
655  case 10: // See Profile.xlsx::Messages:dive_settings.bottomDepth
656  if (!verify(data, baseType, 4, FitBaseType::Float32, "dive_settings.bottomDepth")) return false;
657  #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
658  { // Qt's from-endian functions have no float/double specialisations prior to Qt 5.12.
659  const quint32 localEndian = bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data);
660  static_assert(sizeof(localEndian) == 4, "src not expected size");
661  static_assert(sizeof(this->bottomDepth) == 4, "src and dst not the same size");
662  memcpy(&this->bottomDepth, &localEndian, data.size());
663  }
664  #else
665  this->bottomDepth = static_cast<float>(bigEndian ? qFromBigEndian<float>(data) : qFromLittleEndian<float>(data));
666  #endif
667  break;
668  case 11: // See Profile.xlsx::Messages:dive_settings.bottomTime
669  if (!verify(data, baseType, 4, FitBaseType::Uint32, "dive_settings.bottomTime")) return false;
670  this->bottomTime = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
671  break;
672  case 12: // See Profile.xlsx::Messages:dive_settings.apneaCountdownEnabled
673  if (!verify(data, baseType, 0, FitBaseType::Byte, "dive_settings.apneaCountdownEnabled")) return false;
674  this->apneaCountdownEnabled = static_cast<bool>(data.at(0));
675  break;
676  case 13: // See Profile.xlsx::Messages:dive_settings.apneaCountdownTime
677  if (!verify(data, baseType, 4, FitBaseType::Uint32, "dive_settings.apneaCountdownTime")) return false;
678  this->apneaCountdownTime = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
679  break;
680  case 14: // See Profile.xlsx::Messages:dive_settings.backlightMode
681  if (!verify(data, baseType, 1, FitBaseType::Enum, "dive_settings.backlightMode")) return false;
682  this->backlightMode = static_cast<DiveBacklightMode>(data.at(0));
683  break;
684  case 15: // See Profile.xlsx::Messages:dive_settings.backlightBrightness
685  if (!verify(data, baseType, 1, FitBaseType::Uint8, "dive_settings.backlightBrightness")) return false;
686  this->backlightBrightness = static_cast<quint8>(data.at(0));
687  break;
688  case 16: // See Profile.xlsx::Messages:dive_settings.backlightTimeout
689  if (!verify(data, baseType, 1, FitBaseType::Uint8, "dive_settings.backlightTimeout")) return false;
690  this->backlightTimeout = static_cast<BacklightTimeout>(data.at(0));
691  break;
692  case 17: // See Profile.xlsx::Messages:dive_settings.repeatDiveInterval
693  if (!verify(data, baseType, 2, FitBaseType::Uint16, "dive_settings.repeatDiveInterval")) return false;
694  this->repeatDiveInterval = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
695  break;
696  case 18: // See Profile.xlsx::Messages:dive_settings.safetyStopTime
697  if (!verify(data, baseType, 2, FitBaseType::Uint16, "dive_settings.safetyStopTime")) return false;
698  this->safetyStopTime = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
699  break;
700  case 19: // See Profile.xlsx::Messages:dive_settings.heartRateSourceType
701  if (!verify(data, baseType, 1, FitBaseType::Enum, "dive_settings.heartRateSourceType")) return false;
702  this->heartRateSourceType = static_cast<SourceType>(data.at(0));
703  break;
704  case 20: // See Profile.xlsx::Messages:dive_settings.heartRateSource
705  if (!verify(data, baseType, 1, FitBaseType::Uint8, "dive_settings.heartRateSource")) return false;
706  this->heartRateSource = static_cast<quint8>(data.at(0));
707  break;
708  default:
709  qWarning() << "ignoring unknown dive_settings message field number" << fieldId << bigEndian;
710  // Fall through to return true, as its still 'safe' to continue parsing data messages.
711  }
712  return true;
713 }
bool verify(const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
QString name
The DiveSettingsMessage FIT message's name field.

References AbstractDataMessagePrivate::verify().

Here is the call graph for this function:

Member Data Documentation

◆ po2Critical

quint8 DiveSettingsMessagePrivate::po2Critical

The DiveSettingsMessage FIT message's po2Critical field.

Typically 1.60

Definition at line 90 of file divesettingsmessage_p.h.

◆ po2Warn

quint8 DiveSettingsMessagePrivate::po2Warn

The DiveSettingsMessage FIT message's po2Warn field.

Typically 1.40

Definition at line 83 of file divesettingsmessage_p.h.

◆ repeatDiveInterval

quint16 DiveSettingsMessagePrivate::repeatDiveInterval

The DiveSettingsMessage FIT message's repeatDiveInterval field.

Time between surfacing and ending the activity

Definition at line 142 of file divesettingsmessage_p.h.

◆ safetyStopTime

quint16 DiveSettingsMessagePrivate::safetyStopTime

The DiveSettingsMessage FIT message's safetyStopTime field.

Time at safety stop (if enabled)

Definition at line 149 of file divesettingsmessage_p.h.

◆ waterDensity

float DiveSettingsMessagePrivate::waterDensity

The DiveSettingsMessage FIT message's waterDensity field.

Fresh water is usually 1000; salt water is usually 1025

Definition at line 76 of file divesettingsmessage_p.h.


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