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

Public Member Functions

 CoursePointMessagePrivate (CoursePointMessage *const q)
 
virtual ~CoursePointMessagePrivate ()
 
- 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 CoursePointMessage FIT message's messageIndex field.
 
DateTime timestamp
 The CoursePointMessage FIT message's timestamp field.
 
qint32 positionLat
 The CoursePointMessage FIT message's positionLat field.
 
qint32 positionLong
 The CoursePointMessage FIT message's positionLong field.
 
quint32 distance
 The CoursePointMessage FIT message's distance field.
 
CoursePoint type
 The CoursePointMessage FIT message's type field.
 
QString name
 The CoursePointMessage FIT message's name field.
 
bool favorite
 The CoursePointMessage FIT message's favorite 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 CoursePointMessagePrivate class provides private implementation for the CoursePointMessage.

See also
CoursePointMessage

Definition at line 38 of file coursepointmessage_p.h.

Constructor & Destructor Documentation

◆ CoursePointMessagePrivate()

CoursePointMessagePrivate::CoursePointMessagePrivate ( CoursePointMessage *const  q)
explicit

Constructs a CoursePointMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 257 of file coursepointmessage.cpp.

259  , messageIndex(static_cast<MessageIndex>(-1))
260  , timestamp(static_cast<DateTime>(-1))
261  , positionLat(0x7FFFFFFF)
262  , positionLong(0x7FFFFFFF)
263  , distance(0xFFFFFFFF)
264  , type(static_cast<CoursePoint>(-1))
265  , favorite(static_cast<bool>(-1))
266 {
267  globalMessageNumber = MesgNum::CoursePoint;
268 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
MessageIndex messageIndex
The CoursePointMessage FIT message's messageIndex field.
bool favorite
The CoursePointMessage FIT message's favorite field.
quint32 distance
The CoursePointMessage FIT message's distance field.
qint32 positionLat
The CoursePointMessage FIT message's positionLat field.
CoursePoint type
The CoursePointMessage FIT message's type field.
qint32 positionLong
The CoursePointMessage FIT message's positionLong field.
DateTime timestamp
The CoursePointMessage FIT message's timestamp field.
CoursePoint
Garmin FIT CoursePoint type.
Definition: types.h:1446
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~CoursePointMessagePrivate()

CoursePointMessagePrivate::~CoursePointMessagePrivate ( )
virtual

Destroys the CoursePointMessagePrivate object.

Definition at line 275 of file coursepointmessage.cpp.

276 {
277 
278 }

Member Function Documentation

◆ setField()

bool CoursePointMessagePrivate::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 280 of file coursepointmessage.cpp.

282 {
283  switch (fieldId) {
284  case 254: // See Profile.xlsx::Messages:course_point.messageIndex
285  if (!verify(data, baseType, 2, FitBaseType::Uint16, "course_point.messageIndex")) return false;
286  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
287  break;
288  case 1: // See Profile.xlsx::Messages:course_point.timestamp
289  if (!verify(data, baseType, 4, FitBaseType::Uint32, "course_point.timestamp")) return false;
290  this->timestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
291  break;
292  case 2: // See Profile.xlsx::Messages:course_point.positionLat
293  if (!verify(data, baseType, 4, FitBaseType::Sint32, "course_point.positionLat")) return false;
294  this->positionLat = static_cast<qint32>(bigEndian ? qFromBigEndian< qint32>(data) : qFromLittleEndian< qint32>(data));
295  break;
296  case 3: // See Profile.xlsx::Messages:course_point.positionLong
297  if (!verify(data, baseType, 4, FitBaseType::Sint32, "course_point.positionLong")) return false;
298  this->positionLong = static_cast<qint32>(bigEndian ? qFromBigEndian< qint32>(data) : qFromLittleEndian< qint32>(data));
299  break;
300  case 4: // See Profile.xlsx::Messages:course_point.distance
301  if (!verify(data, baseType, 4, FitBaseType::Uint32, "course_point.distance")) return false;
302  this->distance = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
303  break;
304  case 5: // See Profile.xlsx::Messages:course_point.type
305  if (!verify(data, baseType, 1, FitBaseType::Enum, "course_point.type")) return false;
306  this->type = static_cast<CoursePoint>(data.at(0));
307  break;
308  case 6: // See Profile.xlsx::Messages:course_point.name
309  if (!verify(data, baseType, 1, FitBaseType::String, "course_point.name")) return false;
310  this->name = QString::fromUtf8(data);
311  break;
312  case 8: // See Profile.xlsx::Messages:course_point.favorite
313  if (!verify(data, baseType, 0, FitBaseType::Byte, "course_point.favorite")) return false;
314  this->favorite = static_cast<bool>(data.at(0));
315  break;
316  default:
317  qWarning() << "ignoring unknown course_point message field number" << fieldId << bigEndian;
318  // Fall through to return true, as its still 'safe' to continue parsing data messages.
319  }
320  return true;
321 }
bool verify(const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
QString name
The CoursePointMessage 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: