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

Public Member Functions

 OhrSettingsMessagePrivate (OhrSettingsMessage *const q)
 
virtual ~OhrSettingsMessagePrivate ()
 
- 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 OhrSettingsMessage FIT message's timestamp field.
 
Switch enabled
 The OhrSettingsMessage FIT message's enabled 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 OhrSettingsMessagePrivate class provides private implementation for the OhrSettingsMessage.

See also
OhrSettingsMessage

Definition at line 38 of file ohrsettingsmessage_p.h.

Constructor & Destructor Documentation

◆ OhrSettingsMessagePrivate()

OhrSettingsMessagePrivate::OhrSettingsMessagePrivate ( OhrSettingsMessage *const  q)
explicit

Constructs a OhrSettingsMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 131 of file ohrsettingsmessage.cpp.

133  , timestamp(static_cast<DateTime>(-1))
134  , enabled(static_cast<Switch>(-1))
135 {
136  globalMessageNumber = MesgNum::OhrSettings;
137 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
DateTime timestamp
The OhrSettingsMessage FIT message's timestamp field.
Switch enabled
The OhrSettingsMessage FIT message's enabled field.
Switch
Garmin FIT Switch type.
Definition: types.h:670
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~OhrSettingsMessagePrivate()

OhrSettingsMessagePrivate::~OhrSettingsMessagePrivate ( )
virtual

Destroys the OhrSettingsMessagePrivate object.

Definition at line 144 of file ohrsettingsmessage.cpp.

145 {
146 
147 }

Member Function Documentation

◆ setField()

bool OhrSettingsMessagePrivate::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 149 of file ohrsettingsmessage.cpp.

151 {
152  switch (fieldId) {
153  case 253: // See Profile.xlsx::Messages:ohr_settings.timestamp
154  if (!verify(data, baseType, 4, FitBaseType::Uint32, "ohr_settings.timestamp")) return false;
155  this->timestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
156  break;
157  case 0: // See Profile.xlsx::Messages:ohr_settings.enabled
158  if (!verify(data, baseType, 1, FitBaseType::Enum, "ohr_settings.enabled")) return false;
159  this->enabled = static_cast<Switch>(data.at(0));
160  break;
161  default:
162  qWarning() << "ignoring unknown ohr_settings message field number" << fieldId << bigEndian;
163  // Fall through to return true, as its still 'safe' to continue parsing data messages.
164  }
165  return true;
166 }
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:

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