QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
timestampcorrelationmessage.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 TimestampCorrelationMessage, and TimestampCorrelationMessagePrivate classes.
28  */
29 
32 
33 #include <QDebug>
34 #include <QtEndian>
35 
37 
38 /*!
39  * \class TimestampCorrelationMessage
40  *
41  * The TimestampCorrelationMessage class represents a FIT TimestampCorrelationMessage data message.
42  *
43  * \sa DataMessage
44  */
45 
46 /*!
47  * Constructs a TimestampCorrelationMessage 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 TimestampCorrelationMessage object with private implementation \a d.
61  *
62  * \param d Pointer to private implementation.
63  */
65 {
66 
67 }
68 
69 /*!
70  * Returns the TimestampCorrelationMessage data message's \c timestamp field's current value.
71  *
72  * Whole second part of UTC timestamp at the time the system timestamp was recorded.
73  *
74  * \return the \c timestamp field value.
75  */
77 {
78  Q_D(const TimestampCorrelationMessage);
79  return d->timestamp;
80 }
81 
82 /*!
83  * Returns the TimestampCorrelationMessage data message's \c fractionalTimestamp field's current value.
84  *
85  * Fractional part of the UTC timestamp at the time the system timestamp was recorded.
86  *
87  * \return the \c fractionalTimestamp field value.
88  */
90 {
91  Q_D(const TimestampCorrelationMessage);
92  return d->fractionalTimestamp;
93 }
94 
95 /*!
96  * Returns the TimestampCorrelationMessage data message's \c systemTimestamp field's current value.
97  *
98  * Whole second part of the system timestamp
99  *
100  * \return the \c systemTimestamp field value.
101  */
103 {
104  Q_D(const TimestampCorrelationMessage);
105  return d->systemTimestamp;
106 }
107 
108 /*!
109  * Returns the TimestampCorrelationMessage data message's \c fractionalSystemTimestamp field's current value.
110  *
111  * Fractional part of the system timestamp
112  *
113  * \return the \c fractionalSystemTimestamp field value.
114  */
116 {
117  Q_D(const TimestampCorrelationMessage);
118  return d->fractionalSystemTimestamp;
119 }
120 
121 /*!
122  * Returns the TimestampCorrelationMessage data message's \c localTimestamp field's current value.
123  *
124  * timestamp epoch expressed in local time used to convert timestamps to local time
125  *
126  * \return the \c localTimestamp field value.
127  */
129 {
130  Q_D(const TimestampCorrelationMessage);
131  return d->localTimestamp;
132 }
133 
134 /*!
135  * Returns the TimestampCorrelationMessage data message's \c timestampMs field's current value.
136  *
137  * Millisecond part of the UTC timestamp at the time the system timestamp was recorded.
138  *
139  * \return the \c timestampMs field value.
140  */
142 {
143  Q_D(const TimestampCorrelationMessage);
144  return d->timestampMs;
145 }
146 
147 /*!
148  * Returns the TimestampCorrelationMessage data message's \c systemTimestampMs field's current value.
149  *
150  * Millisecond part of the system timestamp
151  *
152  * \return the \c systemTimestampMs field value.
153  */
155 {
156  Q_D(const TimestampCorrelationMessage);
157  return d->systemTimestampMs;
158 }
159 
160 /*!
161  * Sets the \c timestamp field to \a timestamp.
162  *
163  * \param timestamp The field value to set.
164  */
166 {
168  d->timestamp = timestamp;
169 }
170 /*!
171  * Sets the \c fractionalTimestamp field to \a fractionalTimestamp.
172  *
173  * \param fractionalTimestamp The field value to set.
174  */
175 void TimestampCorrelationMessage::setFractionalTimestamp(const quint16 fractionalTimestamp)
176 {
178  d->fractionalTimestamp = fractionalTimestamp;
179 }
180 /*!
181  * Sets the \c systemTimestamp field to \a systemTimestamp.
182  *
183  * \param systemTimestamp The field value to set.
184  */
186 {
188  d->systemTimestamp = systemTimestamp;
189 }
190 /*!
191  * Sets the \c fractionalSystemTimestamp field to \a fractionalSystemTimestamp.
192  *
193  * \param fractionalSystemTimestamp The field value to set.
194  */
195 void TimestampCorrelationMessage::setFractionalSystemTimestamp(const quint16 fractionalSystemTimestamp)
196 {
198  d->fractionalSystemTimestamp = fractionalSystemTimestamp;
199 }
200 /*!
201  * Sets the \c localTimestamp field to \a localTimestamp.
202  *
203  * \param localTimestamp The field value to set.
204  */
206 {
208  d->localTimestamp = localTimestamp;
209 }
210 /*!
211  * Sets the \c timestampMs field to \a timestampMs.
212  *
213  * \param timestampMs The field value to set.
214  */
215 void TimestampCorrelationMessage::setTimestampMs(const quint16 timestampMs)
216 {
218  d->timestampMs = timestampMs;
219 }
220 /*!
221  * Sets the \c systemTimestampMs field to \a systemTimestampMs.
222  *
223  * \param systemTimestampMs The field value to set.
224  */
225 void TimestampCorrelationMessage::setSystemTimestampMs(const quint16 systemTimestampMs)
226 {
228  d->systemTimestampMs = systemTimestampMs;
229 }
230 
231 /// \cond internal
232 
233 /*!
234  * \internal
235  *
236  * \class TimestampCorrelationMessagePrivate
237  *
238  * The TimestampCorrelationMessagePrivate class provides private implementation for the TimestampCorrelationMessage.
239  *
240  * \sa TimestampCorrelationMessage
241  */
242 
243 /*!
244  * \internal
245  *
246  * Constructs a TimestampCorrelationMessagePrivate object with public implementation \a q.
247  *
248  * \param q Pointer to public implementaton.
249  */
250 TimestampCorrelationMessagePrivate::TimestampCorrelationMessagePrivate(TimestampCorrelationMessage * const q)
252  , timestamp(static_cast<DateTime>(-1))
253  , fractionalTimestamp(0xFFFF)
254  , systemTimestamp(static_cast<DateTime>(-1))
255  , fractionalSystemTimestamp(0xFFFF)
256  , localTimestamp(static_cast<LocalDateTime>(-1))
257  , timestampMs(0xFFFF)
258  , systemTimestampMs(0xFFFF)
259 {
260  globalMessageNumber = MesgNum::TimestampCorrelation;
261 }
262 
263 /*!
264  * \internal
265  *
266  * Destroys the TimestampCorrelationMessagePrivate object.
267  */
269 {
270 
271 }
272 
274  const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian)
275 {
276  switch (fieldId) {
277  case 253: // See Profile.xlsx::Messages:timestamp_correlation.timestamp
278  if (!verify(data, baseType, 4, FitBaseType::Uint32, "timestamp_correlation.timestamp")) return false;
279  this->timestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
280  break;
281  case 0: // See Profile.xlsx::Messages:timestamp_correlation.fractionalTimestamp
282  if (!verify(data, baseType, 2, FitBaseType::Uint16, "timestamp_correlation.fractionalTimestamp")) return false;
283  this->fractionalTimestamp = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
284  break;
285  case 1: // See Profile.xlsx::Messages:timestamp_correlation.systemTimestamp
286  if (!verify(data, baseType, 4, FitBaseType::Uint32, "timestamp_correlation.systemTimestamp")) return false;
287  this->systemTimestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
288  break;
289  case 2: // See Profile.xlsx::Messages:timestamp_correlation.fractionalSystemTimestamp
290  if (!verify(data, baseType, 2, FitBaseType::Uint16, "timestamp_correlation.fractionalSystemTimestamp")) return false;
291  this->fractionalSystemTimestamp = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
292  break;
293  case 3: // See Profile.xlsx::Messages:timestamp_correlation.localTimestamp
294  if (!verify(data, baseType, 4, FitBaseType::Uint32, "timestamp_correlation.localTimestamp")) return false;
295  this->localTimestamp = static_cast<LocalDateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
296  break;
297  case 4: // See Profile.xlsx::Messages:timestamp_correlation.timestampMs
298  if (!verify(data, baseType, 2, FitBaseType::Uint16, "timestamp_correlation.timestampMs")) return false;
299  this->timestampMs = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
300  break;
301  case 5: // See Profile.xlsx::Messages:timestamp_correlation.systemTimestampMs
302  if (!verify(data, baseType, 2, FitBaseType::Uint16, "timestamp_correlation.systemTimestampMs")) return false;
303  this->systemTimestampMs = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
304  break;
305  default:
306  qWarning() << "ignoring unknown timestamp_correlation message field number" << fieldId << bigEndian;
307  // Fall through to return true, as its still 'safe' to continue parsing data messages.
308  }
309  return true;
310 }
311 
312 /// \endcond
313 
#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.
quint16 fractionalTimestamp
The TimestampCorrelationMessage FIT message's fractionalTimestamp field.
DateTime timestamp
The TimestampCorrelationMessage FIT message's timestamp field.
quint16 systemTimestampMs
The TimestampCorrelationMessage FIT message's systemTimestampMs field.
quint16 fractionalSystemTimestamp
The TimestampCorrelationMessage FIT message's fractionalSystemTimestamp field.
bool setField(const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
DateTime systemTimestamp
The TimestampCorrelationMessage FIT message's systemTimestamp field.
LocalDateTime localTimestamp
The TimestampCorrelationMessage FIT message's localTimestamp field.
quint16 timestampMs
The TimestampCorrelationMessage FIT message's timestampMs field.
The TimestampCorrelationMessage class represents a FIT TimestampCorrelationMessage data message.
void setTimestampMs(const quint16 timestampMs)
Sets the timestampMs field to timestampMs.
void setTimestamp(const DateTime timestamp)
Sets the timestamp field to timestamp.
void setSystemTimestampMs(const quint16 systemTimestampMs)
Sets the systemTimestampMs field to systemTimestampMs.
void setSystemTimestamp(const DateTime systemTimestamp)
Sets the systemTimestamp field to systemTimestamp.
void setFractionalSystemTimestamp(const quint16 fractionalSystemTimestamp)
Sets the fractionalSystemTimestamp field to fractionalSystemTimestamp.
quint16 fractionalSystemTimestamp() const
Returns the TimestampCorrelationMessage data message's fractionalSystemTimestamp field's current valu...
quint16 systemTimestampMs() const
Returns the TimestampCorrelationMessage data message's systemTimestampMs field's current value.
DateTime timestamp() const
Returns the TimestampCorrelationMessage data message's timestamp field's current value.
void setLocalTimestamp(const LocalDateTime localTimestamp)
Sets the localTimestamp field to localTimestamp.
quint16 timestampMs() const
Returns the TimestampCorrelationMessage data message's timestampMs field's current value.
void setFractionalTimestamp(const quint16 fractionalTimestamp)
Sets the fractionalTimestamp field to fractionalTimestamp.
quint16 fractionalTimestamp() const
Returns the TimestampCorrelationMessage data message's fractionalTimestamp field's current value.
TimestampCorrelationMessage()
Constructs a TimestampCorrelationMessage object.
LocalDateTime localTimestamp() const
Returns the TimestampCorrelationMessage data message's localTimestamp field's current value.
DateTime systemTimestamp() const
Returns the TimestampCorrelationMessage data message's systemTimestamp field's current value.
Declares the TimestampCorrelationMessage class.
Declares the TimestampCorrelationMessagePrivate class.
LocalDateTime
Seconds since 00:00 Dec 31 1989 in local time zone.
Definition: types.h:250
FitBaseType
Garmin FIT FitBaseType type.
Definition: types.h:3388
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237