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

Public Member Functions

 WorkoutSessionMessagePrivate (WorkoutSessionMessage *const q)
 
virtual ~WorkoutSessionMessagePrivate ()
 
- 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 WorkoutSessionMessage FIT message's messageIndex field.
 
Sport sport
 The WorkoutSessionMessage FIT message's sport field.
 
SubSport subSport
 The WorkoutSessionMessage FIT message's subSport field.
 
quint16 numValidSteps
 The WorkoutSessionMessage FIT message's numValidSteps field.
 
quint16 firstStepIndex
 The WorkoutSessionMessage FIT message's firstStepIndex field.
 
quint16 poolLength
 The WorkoutSessionMessage FIT message's poolLength field.
 
DisplayMeasure poolLengthUnit
 The WorkoutSessionMessage FIT message's poolLengthUnit 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 WorkoutSessionMessagePrivate class provides private implementation for the WorkoutSessionMessage.

See also
WorkoutSessionMessage

Definition at line 38 of file workoutsessionmessage_p.h.

Constructor & Destructor Documentation

◆ WorkoutSessionMessagePrivate()

WorkoutSessionMessagePrivate::WorkoutSessionMessagePrivate ( WorkoutSessionMessage *const  q)
explicit

Constructs a WorkoutSessionMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 236 of file workoutsessionmessage.cpp.

238  , messageIndex(static_cast<MessageIndex>(-1))
239  , sport(static_cast<Sport>(-1))
240  , subSport(static_cast<SubSport>(-1))
241  , numValidSteps(0xFFFF)
242  , firstStepIndex(0xFFFF)
243  , poolLength(0xFFFF)
244  , poolLengthUnit(static_cast<DisplayMeasure>(-1))
245 {
246  globalMessageNumber = MesgNum::WorkoutSession;
247 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
MessageIndex messageIndex
The WorkoutSessionMessage FIT message's messageIndex field.
SubSport subSport
The WorkoutSessionMessage FIT message's subSport field.
quint16 firstStepIndex
The WorkoutSessionMessage FIT message's firstStepIndex field.
quint16 poolLength
The WorkoutSessionMessage FIT message's poolLength field.
Sport sport
The WorkoutSessionMessage FIT message's sport field.
quint16 numValidSteps
The WorkoutSessionMessage FIT message's numValidSteps field.
DisplayMeasure poolLengthUnit
The WorkoutSessionMessage FIT message's poolLengthUnit field.
Sport
Garmin FIT Sport type.
Definition: types.h:685
DisplayMeasure
Garmin FIT DisplayMeasure type.
Definition: types.h:572
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263
SubSport
Garmin FIT SubSport type.
Definition: types.h:881

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~WorkoutSessionMessagePrivate()

WorkoutSessionMessagePrivate::~WorkoutSessionMessagePrivate ( )
virtual

Destroys the WorkoutSessionMessagePrivate object.

Definition at line 254 of file workoutsessionmessage.cpp.

255 {
256 
257 }

Member Function Documentation

◆ setField()

bool WorkoutSessionMessagePrivate::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 259 of file workoutsessionmessage.cpp.

261 {
262  switch (fieldId) {
263  case 254: // See Profile.xlsx::Messages:workout_session.messageIndex
264  if (!verify(data, baseType, 2, FitBaseType::Uint16, "workout_session.messageIndex")) return false;
265  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
266  break;
267  case 0: // See Profile.xlsx::Messages:workout_session.sport
268  if (!verify(data, baseType, 1, FitBaseType::Enum, "workout_session.sport")) return false;
269  this->sport = static_cast<Sport>(data.at(0));
270  break;
271  case 1: // See Profile.xlsx::Messages:workout_session.subSport
272  if (!verify(data, baseType, 1, FitBaseType::Enum, "workout_session.subSport")) return false;
273  this->subSport = static_cast<SubSport>(data.at(0));
274  break;
275  case 2: // See Profile.xlsx::Messages:workout_session.numValidSteps
276  if (!verify(data, baseType, 2, FitBaseType::Uint16, "workout_session.numValidSteps")) return false;
277  this->numValidSteps = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
278  break;
279  case 3: // See Profile.xlsx::Messages:workout_session.firstStepIndex
280  if (!verify(data, baseType, 2, FitBaseType::Uint16, "workout_session.firstStepIndex")) return false;
281  this->firstStepIndex = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
282  break;
283  case 4: // See Profile.xlsx::Messages:workout_session.poolLength
284  if (!verify(data, baseType, 2, FitBaseType::Uint16, "workout_session.poolLength")) return false;
285  this->poolLength = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
286  break;
287  case 5: // See Profile.xlsx::Messages:workout_session.poolLengthUnit
288  if (!verify(data, baseType, 1, FitBaseType::Enum, "workout_session.poolLengthUnit")) return false;
289  this->poolLengthUnit = static_cast<DisplayMeasure>(data.at(0));
290  break;
291  default:
292  qWarning() << "ignoring unknown workout_session message field number" << fieldId << bigEndian;
293  // Fall through to return true, as its still 'safe' to continue parsing data messages.
294  }
295  return true;
296 }
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: