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

Public Member Functions

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

Public Attributes

DateTime timestamp
 The HrMessage FIT message's timestamp field.
 
quint16 fractionalTimestamp
 The HrMessage FIT message's fractionalTimestamp field.
 
quint8 time256
 The HrMessage FIT message's time256 field.
 
quint8 filteredBpm
 The HrMessage FIT message's filteredBpm field.
 
quint32 eventTimestamp
 The HrMessage FIT message's eventTimestamp field.
 
quint8 eventTimestamp12
 The HrMessage FIT message's eventTimestamp12 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 HrMessagePrivate class provides private implementation for the HrMessage.

See also
HrMessage

Definition at line 38 of file hrmessage_p.h.

Constructor & Destructor Documentation

◆ HrMessagePrivate()

HrMessagePrivate::HrMessagePrivate ( HrMessage *const  q)
explicit

Constructs a HrMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 215 of file hrmessage.cpp.

217  , timestamp(static_cast<DateTime>(-1))
218  , fractionalTimestamp(0xFFFF)
219  , time256(0xFF)
220  , filteredBpm(0xFF)
221  , eventTimestamp(0xFFFFFFFF)
222  , eventTimestamp12(0xFF)
223 {
224  globalMessageNumber = MesgNum::Hr;
225 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
quint8 filteredBpm
The HrMessage FIT message's filteredBpm field.
Definition: hrmessage_p.h:59
quint8 time256
The HrMessage FIT message's time256 field.
Definition: hrmessage_p.h:54
quint8 eventTimestamp12
The HrMessage FIT message's eventTimestamp12 field.
Definition: hrmessage_p.h:69
DateTime timestamp
The HrMessage FIT message's timestamp field.
Definition: hrmessage_p.h:44
quint32 eventTimestamp
The HrMessage FIT message's eventTimestamp field.
Definition: hrmessage_p.h:64
quint16 fractionalTimestamp
The HrMessage FIT message's fractionalTimestamp field.
Definition: hrmessage_p.h:49
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~HrMessagePrivate()

HrMessagePrivate::~HrMessagePrivate ( )
virtual

Destroys the HrMessagePrivate object.

Definition at line 232 of file hrmessage.cpp.

233 {
234 
235 }

Member Function Documentation

◆ setField()

bool HrMessagePrivate::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 237 of file hrmessage.cpp.

239 {
240  switch (fieldId) {
241  case 253: // See Profile.xlsx::Messages:hr.timestamp
242  if (!verify(data, baseType, 4, FitBaseType::Uint32, "hr.timestamp")) return false;
243  this->timestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
244  break;
245  case 0: // See Profile.xlsx::Messages:hr.fractionalTimestamp
246  if (!verify(data, baseType, 2, FitBaseType::Uint16, "hr.fractionalTimestamp")) return false;
247  this->fractionalTimestamp = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
248  break;
249  case 1: // See Profile.xlsx::Messages:hr.time256
250  if (!verify(data, baseType, 1, FitBaseType::Uint8, "hr.time256")) return false;
251  this->time256 = static_cast<quint8>(data.at(0));
252  break;
253  case 6: // See Profile.xlsx::Messages:hr.filteredBpm
254  if (!verify(data, baseType, 1, FitBaseType::Uint8, "hr.filteredBpm")) return false;
255  this->filteredBpm = static_cast<quint8>(data.at(0));
256  break;
257  case 9: // See Profile.xlsx::Messages:hr.eventTimestamp
258  if (!verify(data, baseType, 4, FitBaseType::Uint32, "hr.eventTimestamp")) return false;
259  this->eventTimestamp = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
260  break;
261  case 10: // See Profile.xlsx::Messages:hr.eventTimestamp12
262  if (!verify(data, baseType, 1, FitBaseType::Byte, "hr.eventTimestamp12")) return false;
263  this->eventTimestamp12 = static_cast<quint8>(data.at(0));
264  break;
265  default:
266  qWarning() << "ignoring unknown hr message field number" << fieldId << bigEndian;
267  // Fall through to return true, as its still 'safe' to continue parsing data messages.
268  }
269  return true;
270 }
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: