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

Public Member Functions

 HrZoneMessagePrivate (HrZoneMessage *const q)
 
virtual ~HrZoneMessagePrivate ()
 
- 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 HrZoneMessage FIT message's messageIndex field.
 
quint8 highBpm
 The HrZoneMessage FIT message's highBpm field.
 
QString name
 The HrZoneMessage 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 HrZoneMessagePrivate class provides private implementation for the HrZoneMessage.

See also
HrZoneMessage

Definition at line 38 of file hrzonemessage_p.h.

Constructor & Destructor Documentation

◆ HrZoneMessagePrivate()

HrZoneMessagePrivate::HrZoneMessagePrivate ( HrZoneMessage *const  q)
explicit

Constructs a HrZoneMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 152 of file hrzonemessage.cpp.

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

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~HrZoneMessagePrivate()

HrZoneMessagePrivate::~HrZoneMessagePrivate ( )
virtual

Destroys the HrZoneMessagePrivate object.

Definition at line 165 of file hrzonemessage.cpp.

166 {
167 
168 }

Member Function Documentation

◆ setField()

bool HrZoneMessagePrivate::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 hrzonemessage.cpp.

172 {
173  switch (fieldId) {
174  case 254: // See Profile.xlsx::Messages:hr_zone.messageIndex
175  if (!verify(data, baseType, 2, FitBaseType::Uint16, "hr_zone.messageIndex")) return false;
176  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
177  break;
178  case 1: // See Profile.xlsx::Messages:hr_zone.highBpm
179  if (!verify(data, baseType, 1, FitBaseType::Uint8, "hr_zone.highBpm")) return false;
180  this->highBpm = static_cast<quint8>(data.at(0));
181  break;
182  case 2: // See Profile.xlsx::Messages:hr_zone.name
183  if (!verify(data, baseType, 1, FitBaseType::String, "hr_zone.name")) return false;
184  this->name = QString::fromUtf8(data);
185  break;
186  default:
187  qWarning() << "ignoring unknown hr_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 HrZoneMessage 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: