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

Public Member Functions

 CourseMessagePrivate (CourseMessage *const q)
 
virtual ~CourseMessagePrivate ()
 
- 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 CourseMessage FIT message's sport field.
 
QString name
 The CourseMessage FIT message's name field.
 
CourseCapabilities capabilities
 The CourseMessage FIT message's capabilities field.
 
SubSport subSport
 The CourseMessage FIT message's subSport 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 CourseMessagePrivate class provides private implementation for the CourseMessage.

See also
CourseMessage

Definition at line 38 of file coursemessage_p.h.

Constructor & Destructor Documentation

◆ CourseMessagePrivate()

CourseMessagePrivate::CourseMessagePrivate ( CourseMessage *const  q)
explicit

Constructs a CourseMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 173 of file coursemessage.cpp.

175  , sport(static_cast<Sport>(-1))
176  , capabilities(static_cast<CourseCapabilities>(-1))
177  , subSport(static_cast<SubSport>(-1))
178 {
179  globalMessageNumber = MesgNum::Course;
180 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
CourseCapabilities capabilities
The CourseMessage FIT message's capabilities field.
Sport sport
The CourseMessage FIT message's sport field.
SubSport subSport
The CourseMessage FIT message's subSport field.
Sport
Garmin FIT Sport type.
Definition: types.h:685
CourseCapabilities
Garmin FIT CourseCapabilities type.
Definition: types.h:2165
SubSport
Garmin FIT SubSport type.
Definition: types.h:881

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~CourseMessagePrivate()

CourseMessagePrivate::~CourseMessagePrivate ( )
virtual

Destroys the CourseMessagePrivate object.

Definition at line 187 of file coursemessage.cpp.

188 {
189 
190 }

Member Function Documentation

◆ setField()

bool CourseMessagePrivate::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 192 of file coursemessage.cpp.

194 {
195  switch (fieldId) {
196  case 4: // See Profile.xlsx::Messages:course.sport
197  if (!verify(data, baseType, 1, FitBaseType::Enum, "course.sport")) return false;
198  this->sport = static_cast<Sport>(data.at(0));
199  break;
200  case 5: // See Profile.xlsx::Messages:course.name
201  if (!verify(data, baseType, 1, FitBaseType::String, "course.name")) return false;
202  this->name = QString::fromUtf8(data);
203  break;
204  case 6: // See Profile.xlsx::Messages:course.capabilities
205  if (!verify(data, baseType, 4, FitBaseType::Uint32z, "course.capabilities")) return false;
206  this->capabilities = static_cast<CourseCapabilities>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
207  break;
208  case 7: // See Profile.xlsx::Messages:course.subSport
209  if (!verify(data, baseType, 1, FitBaseType::Enum, "course.subSport")) return false;
210  this->subSport = static_cast<SubSport>(data.at(0));
211  break;
212  default:
213  qWarning() << "ignoring unknown course message field number" << fieldId << bigEndian;
214  // Fall through to return true, as its still 'safe' to continue parsing data messages.
215  }
216  return true;
217 }
bool verify(const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
QString name
The CourseMessage 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: