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

Public Member Functions

 SpeedZoneMessagePrivate (SpeedZoneMessage *const q)
 
virtual ~SpeedZoneMessagePrivate ()
 
- 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 SpeedZoneMessage FIT message's messageIndex field.
 
quint16 highValue
 The SpeedZoneMessage FIT message's highValue field.
 
QString name
 The SpeedZoneMessage FIT message's name 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 SpeedZoneMessagePrivate class provides private implementation for the SpeedZoneMessage.

See also
SpeedZoneMessage

Definition at line 38 of file speedzonemessage_p.h.

Constructor & Destructor Documentation

◆ SpeedZoneMessagePrivate()

SpeedZoneMessagePrivate::SpeedZoneMessagePrivate ( SpeedZoneMessage *const  q)
explicit

Constructs a SpeedZoneMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 152 of file speedzonemessage.cpp.

154  , messageIndex(static_cast<MessageIndex>(-1))
155  , highValue(0xFFFF)
156 {
157  globalMessageNumber = MesgNum::SpeedZone;
158 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
MessageIndex messageIndex
The SpeedZoneMessage FIT message's messageIndex field.
quint16 highValue
The SpeedZoneMessage FIT message's highValue field.
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~SpeedZoneMessagePrivate()

SpeedZoneMessagePrivate::~SpeedZoneMessagePrivate ( )
virtual

Destroys the SpeedZoneMessagePrivate object.

Definition at line 165 of file speedzonemessage.cpp.

166 {
167 
168 }

Member Function Documentation

◆ setField()

bool SpeedZoneMessagePrivate::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 170 of file speedzonemessage.cpp.

172 {
173  switch (fieldId) {
174  case 254: // See Profile.xlsx::Messages:speed_zone.messageIndex
175  if (!verify(data, baseType, 2, FitBaseType::Uint16, "speed_zone.messageIndex")) return false;
176  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
177  break;
178  case 0: // See Profile.xlsx::Messages:speed_zone.highValue
179  if (!verify(data, baseType, 2, FitBaseType::Uint16, "speed_zone.highValue")) return false;
180  this->highValue = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
181  break;
182  case 1: // See Profile.xlsx::Messages:speed_zone.name
183  if (!verify(data, baseType, 1, FitBaseType::String, "speed_zone.name")) return false;
184  this->name = QString::fromUtf8(data);
185  break;
186  default:
187  qWarning() << "ignoring unknown speed_zone message field number" << fieldId << bigEndian;
188  // Fall through to return true, as its still 'safe' to continue parsing data messages.
189  }
190  return true;
191 }
bool verify(const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
QString name
The SpeedZoneMessage FIT message's name field.

References AbstractDataMessagePrivate::verify().

Here is the call graph for this function:

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