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

Public Member Functions

 SoftwareMessagePrivate (SoftwareMessage *const q)
 
virtual ~SoftwareMessagePrivate ()
 
- 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 SoftwareMessage FIT message's messageIndex field.
 
quint16 version
 The SoftwareMessage FIT message's version field.
 
QString partNumber
 The SoftwareMessage FIT message's partNumber 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 SoftwareMessagePrivate class provides private implementation for the SoftwareMessage.

See also
SoftwareMessage

Definition at line 38 of file softwaremessage_p.h.

Constructor & Destructor Documentation

◆ SoftwareMessagePrivate()

SoftwareMessagePrivate::SoftwareMessagePrivate ( SoftwareMessage *const  q)
explicit

Constructs a SoftwareMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 152 of file softwaremessage.cpp.

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

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~SoftwareMessagePrivate()

SoftwareMessagePrivate::~SoftwareMessagePrivate ( )
virtual

Destroys the SoftwareMessagePrivate object.

Definition at line 165 of file softwaremessage.cpp.

166 {
167 
168 }

Member Function Documentation

◆ setField()

bool SoftwareMessagePrivate::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 softwaremessage.cpp.

172 {
173  switch (fieldId) {
174  case 254: // See Profile.xlsx::Messages:software.messageIndex
175  if (!verify(data, baseType, 2, FitBaseType::Uint16, "software.messageIndex")) return false;
176  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
177  break;
178  case 3: // See Profile.xlsx::Messages:software.version
179  if (!verify(data, baseType, 2, FitBaseType::Uint16, "software.version")) return false;
180  this->version = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
181  break;
182  case 5: // See Profile.xlsx::Messages:software.partNumber
183  if (!verify(data, baseType, 1, FitBaseType::String, "software.partNumber")) return false;
184  this->partNumber = QString::fromUtf8(data);
185  break;
186  default:
187  qWarning() << "ignoring unknown software 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 partNumber
The SoftwareMessage FIT message's partNumber field.

References AbstractDataMessagePrivate::verify().

Here is the call graph for this function:

The documentation for this class was generated from the following files: