QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hrvmessage.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2021 Paul Colby
3 
4  This file is part of QtFit.
5 
6  QtFit is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  QtFit is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with QtFit. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 /*!
21  * \file
22  * \note This file is automatcially generated. Any changes here are likely to be overwritten.
23  */
24 
25 /*!
26  * \file
27  * Defines the HrvMessage, and HrvMessagePrivate classes.
28  */
29 
30 #include "hrvmessage.h"
31 #include "hrvmessage_p.h"
32 
33 #include <QDebug>
34 #include <QtEndian>
35 
37 
38 /*!
39  * \class HrvMessage
40  *
41  * The HrvMessage class represents a FIT HrvMessage data message.
42  *
43  * \sa DataMessage
44  */
45 
46 /*!
47  * Constructs a HrvMessage object.
48  *
49  * Typically, instances of this class will be returned by FitStreamReader::readNext, but this
50  * constructor may be used, along with the relevant setter methods, to create a valid message.
51  */
53 {
54 
55 }
56 
57 /*!
58  * \internal
59  *
60  * Constructs a HrvMessage object with private implementation \a d.
61  *
62  * \param d Pointer to private implementation.
63  */
65 {
66 
67 }
68 
69 /*!
70  * Returns the HrvMessage data message's \c time field's current value.
71  *
72  * Time between beats
73  *
74  * \return the \c time field value.
75  */
76 quint16 HrvMessage::time() const
77 {
78  Q_D(const HrvMessage);
79  return d->time;
80 }
81 
82 /*!
83  * Sets the \c time field to \a time.
84  *
85  * \param time The field value to set.
86  */
87 void HrvMessage::setTime(const quint16 time)
88 {
89  Q_D(HrvMessage);
90  d->time = time;
91 }
92 
93 /// \cond internal
94 
95 /*!
96  * \internal
97  *
98  * \class HrvMessagePrivate
99  *
100  * The HrvMessagePrivate class provides private implementation for the HrvMessage.
101  *
102  * \sa HrvMessage
103  */
104 
105 /*!
106  * \internal
107  *
108  * Constructs a HrvMessagePrivate object with public implementation \a q.
109  *
110  * \param q Pointer to public implementaton.
111  */
112 HrvMessagePrivate::HrvMessagePrivate(HrvMessage * const q)
114  , time(0xFFFF)
115 {
116  globalMessageNumber = MesgNum::Hrv;
117 }
118 
119 /*!
120  * \internal
121  *
122  * Destroys the HrvMessagePrivate object.
123  */
125 {
126 
127 }
128 
130  const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian)
131 {
132  switch (fieldId) {
133  case 0: // See Profile.xlsx::Messages:hrv.time
134  if (!verify(data, baseType, 2, FitBaseType::Uint16, "hrv.time")) return false;
135  this->time = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
136  break;
137  default:
138  qWarning() << "ignoring unknown hrv message field number" << fieldId << bigEndian;
139  // Fall through to return true, as its still 'safe' to continue parsing data messages.
140  }
141  return true;
142 }
143 
144 /// \endcond
145 
#define QTFIT_END_NAMESPACE
Macro for ending the QtFit library's top-most namespace (if one is defined).
Definition: QtFit_global.h:78
#define QTFIT_BEGIN_NAMESPACE
Macro for starting the QtFit library's top-most namespace (if one is defined).
Definition: QtFit_global.h:77
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
bool verify(const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
The AbstractDataMessage class is the polymorphic base class for all FIT Data Message classes.
virtual ~HrvMessagePrivate()
Definition: hrvmessage.cpp:124
bool setField(const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
Definition: hrvmessage.cpp:129
quint16 time
The HrvMessage FIT message's time field.
Definition: hrvmessage_p.h:46
The HrvMessage class represents a FIT HrvMessage data message.
Definition: hrvmessage.h:39
void setTime(const quint16 time)
Sets the time field to time.
Definition: hrvmessage.cpp:87
quint16 time() const
Returns the HrvMessage data message's time field's current value.
Definition: hrvmessage.cpp:76
HrvMessage()
Constructs a HrvMessage object.
Definition: hrvmessage.cpp:52
Declares the HrvMessage class.
Declares the HrvMessagePrivate class.
FitBaseType
Garmin FIT FitBaseType type.
Definition: types.h:3388