QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
segmentpointmessage.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 SegmentPointMessage, and SegmentPointMessagePrivate classes.
28  */
29 
30 #include "segmentpointmessage.h"
31 #include "segmentpointmessage_p.h"
32 
33 #include <QDebug>
34 #include <QtEndian>
35 
37 
38 /*!
39  * \class SegmentPointMessage
40  *
41  * The SegmentPointMessage class represents a FIT SegmentPointMessage data message.
42  *
43  * \sa DataMessage
44  */
45 
46 /*!
47  * Constructs a SegmentPointMessage 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 SegmentPointMessage object with private implementation \a d.
61  *
62  * \param d Pointer to private implementation.
63  */
65 {
66 
67 }
68 
69 /*!
70  * Returns the SegmentPointMessage data message's \c messageIndex field's current value.
71  *
72  * \return the \c messageIndex field value.
73  */
75 {
76  Q_D(const SegmentPointMessage);
77  return d->messageIndex;
78 }
79 
80 /*!
81  * Returns the SegmentPointMessage data message's \c positionLat field's current value.
82  *
83  * \return the \c positionLat field value.
84  */
86 {
87  Q_D(const SegmentPointMessage);
88  return d->positionLat;
89 }
90 
91 /*!
92  * Returns the SegmentPointMessage data message's \c positionLong field's current value.
93  *
94  * \return the \c positionLong field value.
95  */
97 {
98  Q_D(const SegmentPointMessage);
99  return d->positionLong;
100 }
101 
102 /*!
103  * Returns the SegmentPointMessage data message's \c distance field's current value.
104  *
105  * Accumulated distance along the segment at the described point
106  *
107  * \return the \c distance field value.
108  */
110 {
111  Q_D(const SegmentPointMessage);
112  return d->distance;
113 }
114 
115 /*!
116  * Returns the SegmentPointMessage data message's \c altitude field's current value.
117  *
118  * Accumulated altitude along the segment at the described point
119  *
120  * \return the \c altitude field value.
121  */
123 {
124  Q_D(const SegmentPointMessage);
125  return d->altitude;
126 }
127 
128 /*!
129  * Returns the SegmentPointMessage data message's \c leaderTime field's current value.
130  *
131  * Accumualted time each leader board member required to reach the described point. This value
132  * is zero for all leader board members at the starting point of the segment.
133  *
134  * \return the \c leaderTime field value.
135  */
137 {
138  Q_D(const SegmentPointMessage);
139  return d->leaderTime;
140 }
141 
142 /*!
143  * Sets the \c messageIndex field to \a messageIndex.
144  *
145  * \param messageIndex The field value to set.
146  */
148 {
149  Q_D(SegmentPointMessage);
150  d->messageIndex = messageIndex;
151 }
152 /*!
153  * Sets the \c positionLat field to \a positionLat.
154  *
155  * \param positionLat The field value to set.
156  */
157 void SegmentPointMessage::setPositionLat(const qint32 positionLat)
158 {
159  Q_D(SegmentPointMessage);
160  d->positionLat = positionLat;
161 }
162 /*!
163  * Sets the \c positionLong field to \a positionLong.
164  *
165  * \param positionLong The field value to set.
166  */
167 void SegmentPointMessage::setPositionLong(const qint32 positionLong)
168 {
169  Q_D(SegmentPointMessage);
170  d->positionLong = positionLong;
171 }
172 /*!
173  * Sets the \c distance field to \a distance.
174  *
175  * \param distance The field value to set.
176  */
177 void SegmentPointMessage::setDistance(const quint32 distance)
178 {
179  Q_D(SegmentPointMessage);
180  d->distance = distance;
181 }
182 /*!
183  * Sets the \c altitude field to \a altitude.
184  *
185  * \param altitude The field value to set.
186  */
187 void SegmentPointMessage::setAltitude(const quint16 altitude)
188 {
189  Q_D(SegmentPointMessage);
190  d->altitude = altitude;
191 }
192 /*!
193  * Sets the \c leaderTime field to \a leaderTime.
194  *
195  * \param leaderTime The field value to set.
196  */
197 void SegmentPointMessage::setLeaderTime(const quint32 leaderTime)
198 {
199  Q_D(SegmentPointMessage);
200  d->leaderTime = leaderTime;
201 }
202 
203 /// \cond internal
204 
205 /*!
206  * \internal
207  *
208  * \class SegmentPointMessagePrivate
209  *
210  * The SegmentPointMessagePrivate class provides private implementation for the SegmentPointMessage.
211  *
212  * \sa SegmentPointMessage
213  */
214 
215 /*!
216  * \internal
217  *
218  * Constructs a SegmentPointMessagePrivate object with public implementation \a q.
219  *
220  * \param q Pointer to public implementaton.
221  */
222 SegmentPointMessagePrivate::SegmentPointMessagePrivate(SegmentPointMessage * const q)
224  , messageIndex(static_cast<MessageIndex>(-1))
225  , positionLat(0x7FFFFFFF)
226  , positionLong(0x7FFFFFFF)
227  , distance(0xFFFFFFFF)
228  , altitude(0xFFFF)
229  , leaderTime(0xFFFFFFFF)
230 {
231  globalMessageNumber = MesgNum::SegmentPoint;
232 }
233 
234 /*!
235  * \internal
236  *
237  * Destroys the SegmentPointMessagePrivate object.
238  */
240 {
241 
242 }
243 
245  const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian)
246 {
247  switch (fieldId) {
248  case 254: // See Profile.xlsx::Messages:segment_point.messageIndex
249  if (!verify(data, baseType, 2, FitBaseType::Uint16, "segment_point.messageIndex")) return false;
250  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
251  break;
252  case 1: // See Profile.xlsx::Messages:segment_point.positionLat
253  if (!verify(data, baseType, 4, FitBaseType::Sint32, "segment_point.positionLat")) return false;
254  this->positionLat = static_cast<qint32>(bigEndian ? qFromBigEndian< qint32>(data) : qFromLittleEndian< qint32>(data));
255  break;
256  case 2: // See Profile.xlsx::Messages:segment_point.positionLong
257  if (!verify(data, baseType, 4, FitBaseType::Sint32, "segment_point.positionLong")) return false;
258  this->positionLong = static_cast<qint32>(bigEndian ? qFromBigEndian< qint32>(data) : qFromLittleEndian< qint32>(data));
259  break;
260  case 3: // See Profile.xlsx::Messages:segment_point.distance
261  if (!verify(data, baseType, 4, FitBaseType::Uint32, "segment_point.distance")) return false;
262  this->distance = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
263  break;
264  case 4: // See Profile.xlsx::Messages:segment_point.altitude
265  if (!verify(data, baseType, 2, FitBaseType::Uint16, "segment_point.altitude")) return false;
266  this->altitude = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
267  break;
268  case 5: // See Profile.xlsx::Messages:segment_point.leaderTime
269  if (!verify(data, baseType, 4, FitBaseType::Uint32, "segment_point.leaderTime")) return false;
270  this->leaderTime = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
271  break;
272  default:
273  qWarning() << "ignoring unknown segment_point message field number" << fieldId << bigEndian;
274  // Fall through to return true, as its still 'safe' to continue parsing data messages.
275  }
276  return true;
277 }
278 
279 /// \endcond
280 
#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.
quint32 distance
The SegmentPointMessage FIT message's distance field.
bool setField(const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
quint32 leaderTime
The SegmentPointMessage FIT message's leaderTime field.
qint32 positionLat
The SegmentPointMessage FIT message's positionLat field.
quint16 altitude
The SegmentPointMessage FIT message's altitude field.
qint32 positionLong
The SegmentPointMessage FIT message's positionLong field.
MessageIndex messageIndex
The SegmentPointMessage FIT message's messageIndex field.
The SegmentPointMessage class represents a FIT SegmentPointMessage data message.
qint32 positionLong() const
Returns the SegmentPointMessage data message's positionLong field's current value.
MessageIndex messageIndex() const
Returns the SegmentPointMessage data message's messageIndex field's current value.
qint32 positionLat() const
Returns the SegmentPointMessage data message's positionLat field's current value.
void setPositionLong(const qint32 positionLong)
Sets the positionLong field to positionLong.
quint32 leaderTime() const
Returns the SegmentPointMessage data message's leaderTime field's current value.
void setMessageIndex(const MessageIndex messageIndex)
Sets the messageIndex field to messageIndex.
quint32 distance() const
Returns the SegmentPointMessage data message's distance field's current value.
void setAltitude(const quint16 altitude)
Sets the altitude field to altitude.
void setDistance(const quint32 distance)
Sets the distance field to distance.
quint16 altitude() const
Returns the SegmentPointMessage data message's altitude field's current value.
void setLeaderTime(const quint32 leaderTime)
Sets the leaderTime field to leaderTime.
void setPositionLat(const qint32 positionLat)
Sets the positionLat field to positionLat.
SegmentPointMessage()
Constructs a SegmentPointMessage object.
Declares the SegmentPointMessage class.
Declares the SegmentPointMessagePrivate class.
FitBaseType
Garmin FIT FitBaseType type.
Definition: types.h:3388
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263