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

Public Member Functions

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

Public Attributes

File type
 The FileIdMessage FIT message's type field.
 
Manufacturer manufacturer
 The FileIdMessage FIT message's manufacturer field.
 
quint16 product
 The FileIdMessage FIT message's product field.
 
quint32z serialNumber
 The FileIdMessage FIT message's serialNumber field.
 
DateTime timeCreated
 The FileIdMessage FIT message's timeCreated field. More...
 
quint16 number
 The FileIdMessage FIT message's number field. More...
 
QString productName
 The FileIdMessage FIT message's productName field. More...
 
- 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 FileIdMessagePrivate class provides private implementation for the FileIdMessage.

See also
FileIdMessage

Definition at line 38 of file fileidmessage_p.h.

Constructor & Destructor Documentation

◆ FileIdMessagePrivate()

FileIdMessagePrivate::FileIdMessagePrivate ( FileIdMessage *const  q)
explicit

Constructs a FileIdMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 242 of file fileidmessage.cpp.

244  , type(static_cast<File>(-1))
245  , manufacturer(static_cast<Manufacturer>(-1))
246  , product(0xFFFF)
247  , serialNumber(0)
248  , timeCreated(static_cast<DateTime>(-1))
249  , number(0xFFFF)
250 {
251  globalMessageNumber = MesgNum::FileId;
252 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
Manufacturer manufacturer
The FileIdMessage FIT message's manufacturer field.
DateTime timeCreated
The FileIdMessage FIT message's timeCreated field.
quint32z serialNumber
The FileIdMessage FIT message's serialNumber field.
quint16 number
The FileIdMessage FIT message's number field.
quint16 product
The FileIdMessage FIT message's product field.
File type
The FileIdMessage FIT message's type field.
Manufacturer
Garmin FIT Manufacturer type.
Definition: types.h:1484
File
Garmin FIT File type.
Definition: types.h:59
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~FileIdMessagePrivate()

FileIdMessagePrivate::~FileIdMessagePrivate ( )
virtual

Destroys the FileIdMessagePrivate object.

Definition at line 259 of file fileidmessage.cpp.

260 {
261 
262 }

Member Function Documentation

◆ setField()

bool FileIdMessagePrivate::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 264 of file fileidmessage.cpp.

266 {
267  switch (fieldId) {
268  case 0: // See Profile.xlsx::Messages:file_id.type
269  if (!verify(data, baseType, 1, FitBaseType::Enum, "file_id.type")) return false;
270  this->type = static_cast<File>(data.at(0));
271  break;
272  case 1: // See Profile.xlsx::Messages:file_id.manufacturer
273  if (!verify(data, baseType, 2, FitBaseType::Uint16, "file_id.manufacturer")) return false;
274  this->manufacturer = static_cast<Manufacturer>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
275  break;
276  case 2: // See Profile.xlsx::Messages:file_id.product
277  if (!verify(data, baseType, 2, FitBaseType::Uint16, "file_id.product")) return false;
278  this->product = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
279  break;
280  case 3: // See Profile.xlsx::Messages:file_id.serialNumber
281  if (!verify(data, baseType, 4, FitBaseType::Uint32z, "file_id.serialNumber")) return false;
282  this->serialNumber = static_cast<quint32z>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
283  break;
284  case 4: // See Profile.xlsx::Messages:file_id.timeCreated
285  if (!verify(data, baseType, 4, FitBaseType::Uint32, "file_id.timeCreated")) return false;
286  this->timeCreated = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
287  break;
288  case 5: // See Profile.xlsx::Messages:file_id.number
289  if (!verify(data, baseType, 2, FitBaseType::Uint16, "file_id.number")) return false;
290  this->number = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
291  break;
292  case 8: // See Profile.xlsx::Messages:file_id.productName
293  if (!verify(data, baseType, 1, FitBaseType::String, "file_id.productName")) return false;
294  this->productName = QString::fromUtf8(data);
295  break;
296  default:
297  qWarning() << "ignoring unknown file_id message field number" << fieldId << bigEndian;
298  // Fall through to return true, as its still 'safe' to continue parsing data messages.
299  }
300  return true;
301 }
bool verify(const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
QString productName
The FileIdMessage FIT message's productName field.
quint32 quint32z
32-bit unsigned integer, with 0-is-invalid semantics.
Definition: types.h:47

References AbstractDataMessagePrivate::verify().

Here is the call graph for this function:

Member Data Documentation

◆ number

quint16 FileIdMessagePrivate::number

The FileIdMessage FIT message's number field.

Only set for files that are not created/erased.

Definition at line 73 of file fileidmessage_p.h.

◆ productName

QString FileIdMessagePrivate::productName

The FileIdMessage FIT message's productName field.

Optional free form string to indicate the devices name or model

Definition at line 80 of file fileidmessage_p.h.

◆ timeCreated

DateTime FileIdMessagePrivate::timeCreated

The FileIdMessage FIT message's timeCreated field.

Only set for files that are can be created/erased.

Definition at line 66 of file fileidmessage_p.h.


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