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

Public Member Functions

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

Public Attributes

Manufacturer manufacturer
 The SlaveDeviceMessage FIT message's manufacturer field.
 
quint16 product
 The SlaveDeviceMessage FIT message's product 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 SlaveDeviceMessagePrivate class provides private implementation for the SlaveDeviceMessage.

See also
SlaveDeviceMessage

Definition at line 38 of file slavedevicemessage_p.h.

Constructor & Destructor Documentation

◆ SlaveDeviceMessagePrivate()

SlaveDeviceMessagePrivate::SlaveDeviceMessagePrivate ( SlaveDeviceMessage *const  q)
explicit

Constructs a SlaveDeviceMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 131 of file slavedevicemessage.cpp.

133  , manufacturer(static_cast<Manufacturer>(-1))
134  , product(0xFFFF)
135 {
136  globalMessageNumber = MesgNum::SlaveDevice;
137 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
quint16 product
The SlaveDeviceMessage FIT message's product field.
Manufacturer manufacturer
The SlaveDeviceMessage FIT message's manufacturer field.
Manufacturer
Garmin FIT Manufacturer type.
Definition: types.h:1484

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~SlaveDeviceMessagePrivate()

SlaveDeviceMessagePrivate::~SlaveDeviceMessagePrivate ( )
virtual

Destroys the SlaveDeviceMessagePrivate object.

Definition at line 144 of file slavedevicemessage.cpp.

145 {
146 
147 }

Member Function Documentation

◆ setField()

bool SlaveDeviceMessagePrivate::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 149 of file slavedevicemessage.cpp.

151 {
152  switch (fieldId) {
153  case 0: // See Profile.xlsx::Messages:slave_device.manufacturer
154  if (!verify(data, baseType, 2, FitBaseType::Uint16, "slave_device.manufacturer")) return false;
155  this->manufacturer = static_cast<Manufacturer>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
156  break;
157  case 1: // See Profile.xlsx::Messages:slave_device.product
158  if (!verify(data, baseType, 2, FitBaseType::Uint16, "slave_device.product")) return false;
159  this->product = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
160  break;
161  default:
162  qWarning() << "ignoring unknown slave_device message field number" << fieldId << bigEndian;
163  // Fall through to return true, as its still 'safe' to continue parsing data messages.
164  }
165  return true;
166 }
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: