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

Public Member Functions

 WatchfaceSettingsMessagePrivate (WatchfaceSettingsMessage *const q)
 
virtual ~WatchfaceSettingsMessagePrivate ()
 
- 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 WatchfaceSettingsMessage FIT message's messageIndex field.
 
WatchfaceMode mode
 The WatchfaceSettingsMessage FIT message's mode field.
 
quint8 layout
 The WatchfaceSettingsMessage FIT message's layout 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 WatchfaceSettingsMessagePrivate class provides private implementation for the WatchfaceSettingsMessage.

See also
WatchfaceSettingsMessage

Definition at line 38 of file watchfacesettingsmessage_p.h.

Constructor & Destructor Documentation

◆ WatchfaceSettingsMessagePrivate()

WatchfaceSettingsMessagePrivate::WatchfaceSettingsMessagePrivate ( WatchfaceSettingsMessage *const  q)
explicit

Constructs a WatchfaceSettingsMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 152 of file watchfacesettingsmessage.cpp.

154  , messageIndex(static_cast<MessageIndex>(-1))
155  , mode(static_cast<WatchfaceMode>(-1))
156  , layout(0xFF)
157 {
158  globalMessageNumber = MesgNum::WatchfaceSettings;
159 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
MessageIndex messageIndex
The WatchfaceSettingsMessage FIT message's messageIndex field.
quint8 layout
The WatchfaceSettingsMessage FIT message's layout field.
WatchfaceMode mode
The WatchfaceSettingsMessage FIT message's mode field.
WatchfaceMode
Garmin FIT WatchfaceMode type.
Definition: types.h:2853
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~WatchfaceSettingsMessagePrivate()

WatchfaceSettingsMessagePrivate::~WatchfaceSettingsMessagePrivate ( )
virtual

Destroys the WatchfaceSettingsMessagePrivate object.

Definition at line 166 of file watchfacesettingsmessage.cpp.

167 {
168 
169 }

Member Function Documentation

◆ setField()

bool WatchfaceSettingsMessagePrivate::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 171 of file watchfacesettingsmessage.cpp.

173 {
174  switch (fieldId) {
175  case 254: // See Profile.xlsx::Messages:watchface_settings.messageIndex
176  if (!verify(data, baseType, 2, FitBaseType::Uint16, "watchface_settings.messageIndex")) return false;
177  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
178  break;
179  case 0: // See Profile.xlsx::Messages:watchface_settings.mode
180  if (!verify(data, baseType, 1, FitBaseType::Enum, "watchface_settings.mode")) return false;
181  this->mode = static_cast<WatchfaceMode>(data.at(0));
182  break;
183  case 1: // See Profile.xlsx::Messages:watchface_settings.layout
184  if (!verify(data, baseType, 1, FitBaseType::Byte, "watchface_settings.layout")) return false;
185  this->layout = static_cast<quint8>(data.at(0));
186  break;
187  default:
188  qWarning() << "ignoring unknown watchface_settings message field number" << fieldId << bigEndian;
189  // Fall through to return true, as its still 'safe' to continue parsing data messages.
190  }
191  return true;
192 }
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: