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

Public Member Functions

 DiveAlarmMessagePrivate (DiveAlarmMessage *const q)
 
virtual ~DiveAlarmMessagePrivate ()
 
- 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 DiveAlarmMessage FIT message's messageIndex field. More...
 
quint32 depth
 The DiveAlarmMessage FIT message's depth field.
 
qint32 time
 The DiveAlarmMessage FIT message's time field.
 
bool enabled
 The DiveAlarmMessage FIT message's enabled field.
 
DiveAlarmType alarmType
 The DiveAlarmMessage FIT message's alarmType field.
 
Tone sound
 The DiveAlarmMessage FIT message's sound field.
 
SubSport diveTypes
 The DiveAlarmMessage FIT message's diveTypes 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 DiveAlarmMessagePrivate class provides private implementation for the DiveAlarmMessage.

See also
DiveAlarmMessage

Definition at line 38 of file divealarmmessage_p.h.

Constructor & Destructor Documentation

◆ DiveAlarmMessagePrivate()

DiveAlarmMessagePrivate::DiveAlarmMessagePrivate ( DiveAlarmMessage *const  q)
explicit

Constructs a DiveAlarmMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 238 of file divealarmmessage.cpp.

240  , messageIndex(static_cast<MessageIndex>(-1))
241  , depth(0xFFFFFFFF)
242  , time(0x7FFFFFFF)
243  , enabled(static_cast<bool>(-1))
244  , alarmType(static_cast<DiveAlarmType>(-1))
245  , sound(static_cast<Tone>(-1))
246  , diveTypes(static_cast<SubSport>(-1))
247 {
248  globalMessageNumber = MesgNum::DiveAlarm;
249 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
quint32 depth
The DiveAlarmMessage FIT message's depth field.
Tone sound
The DiveAlarmMessage FIT message's sound field.
MessageIndex messageIndex
The DiveAlarmMessage FIT message's messageIndex field.
qint32 time
The DiveAlarmMessage FIT message's time field.
bool enabled
The DiveAlarmMessage FIT message's enabled field.
SubSport diveTypes
The DiveAlarmMessage FIT message's diveTypes field.
DiveAlarmType alarmType
The DiveAlarmMessage FIT message's alarmType field.
Tone
Garmin FIT Tone type.
Definition: types.h:1235
DiveAlarmType
Garmin FIT DiveAlarmType type.
Definition: types.h:5235
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263
SubSport
Garmin FIT SubSport type.
Definition: types.h:881

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~DiveAlarmMessagePrivate()

DiveAlarmMessagePrivate::~DiveAlarmMessagePrivate ( )
virtual

Destroys the DiveAlarmMessagePrivate object.

Definition at line 256 of file divealarmmessage.cpp.

257 {
258 
259 }

Member Function Documentation

◆ setField()

bool DiveAlarmMessagePrivate::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 261 of file divealarmmessage.cpp.

263 {
264  switch (fieldId) {
265  case 254: // See Profile.xlsx::Messages:dive_alarm.messageIndex
266  if (!verify(data, baseType, 2, FitBaseType::Uint16, "dive_alarm.messageIndex")) return false;
267  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
268  break;
269  case 0: // See Profile.xlsx::Messages:dive_alarm.depth
270  if (!verify(data, baseType, 4, FitBaseType::Uint32, "dive_alarm.depth")) return false;
271  this->depth = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
272  break;
273  case 1: // See Profile.xlsx::Messages:dive_alarm.time
274  if (!verify(data, baseType, 4, FitBaseType::Sint32, "dive_alarm.time")) return false;
275  this->time = static_cast<qint32>(bigEndian ? qFromBigEndian< qint32>(data) : qFromLittleEndian< qint32>(data));
276  break;
277  case 2: // See Profile.xlsx::Messages:dive_alarm.enabled
278  if (!verify(data, baseType, 0, FitBaseType::Byte, "dive_alarm.enabled")) return false;
279  this->enabled = static_cast<bool>(data.at(0));
280  break;
281  case 3: // See Profile.xlsx::Messages:dive_alarm.alarmType
282  if (!verify(data, baseType, 1, FitBaseType::Enum, "dive_alarm.alarmType")) return false;
283  this->alarmType = static_cast<DiveAlarmType>(data.at(0));
284  break;
285  case 4: // See Profile.xlsx::Messages:dive_alarm.sound
286  if (!verify(data, baseType, 1, FitBaseType::Enum, "dive_alarm.sound")) return false;
287  this->sound = static_cast<Tone>(data.at(0));
288  break;
289  case 5: // See Profile.xlsx::Messages:dive_alarm.diveTypes
290  if (!verify(data, baseType, 1, FitBaseType::Enum, "dive_alarm.diveTypes")) return false;
291  this->diveTypes = static_cast<SubSport>(data.at(0));
292  break;
293  default:
294  qWarning() << "ignoring unknown dive_alarm message field number" << fieldId << bigEndian;
295  // Fall through to return true, as its still 'safe' to continue parsing data messages.
296  }
297  return true;
298 }
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:

Member Data Documentation

◆ messageIndex

MessageIndex DiveAlarmMessagePrivate::messageIndex

The DiveAlarmMessage FIT message's messageIndex field.

Index of the alarm

Definition at line 46 of file divealarmmessage_p.h.


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