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

Public Member Functions

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

Public Attributes

Sport sport
 The SportMessage FIT message's sport field.
 
SubSport subSport
 The SportMessage FIT message's subSport field.
 
QString name
 The SportMessage 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 SportMessagePrivate class provides private implementation for the SportMessage.

See also
SportMessage

Definition at line 38 of file sportmessage_p.h.

Constructor & Destructor Documentation

◆ SportMessagePrivate()

SportMessagePrivate::SportMessagePrivate ( SportMessage *const  q)
explicit

Constructs a SportMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 152 of file sportmessage.cpp.

154  , sport(static_cast<Sport>(-1))
155  , subSport(static_cast<SubSport>(-1))
156 {
157  globalMessageNumber = MesgNum::Sport;
158 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
Sport sport
The SportMessage FIT message's sport field.
SubSport subSport
The SportMessage FIT message's subSport field.
Sport
Garmin FIT Sport type.
Definition: types.h:685
SubSport
Garmin FIT SubSport type.
Definition: types.h:881

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~SportMessagePrivate()

SportMessagePrivate::~SportMessagePrivate ( )
virtual

Destroys the SportMessagePrivate object.

Definition at line 165 of file sportmessage.cpp.

166 {
167 
168 }

Member Function Documentation

◆ setField()

bool SportMessagePrivate::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 sportmessage.cpp.

172 {
173  switch (fieldId) {
174  case 0: // See Profile.xlsx::Messages:sport.sport
175  if (!verify(data, baseType, 1, FitBaseType::Enum, "sport.sport")) return false;
176  this->sport = static_cast<Sport>(data.at(0));
177  break;
178  case 1: // See Profile.xlsx::Messages:sport.subSport
179  if (!verify(data, baseType, 1, FitBaseType::Enum, "sport.subSport")) return false;
180  this->subSport = static_cast<SubSport>(data.at(0));
181  break;
182  case 3: // See Profile.xlsx::Messages:sport.name
183  if (!verify(data, baseType, 1, FitBaseType::String, "sport.name")) return false;
184  this->name = QString::fromUtf8(data);
185  break;
186  default:
187  qWarning() << "ignoring unknown sport 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 SportMessage 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: