QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
segmentleaderboardentrymessage.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 SegmentLeaderboardEntryMessage, and SegmentLeaderboardEntryMessagePrivate classes.
28  */
29 
32 
33 #include <QDebug>
34 #include <QtEndian>
35 
37 
38 /*!
39  * \class SegmentLeaderboardEntryMessage
40  *
41  * The SegmentLeaderboardEntryMessage class represents a FIT SegmentLeaderboardEntryMessage data message.
42  *
43  * \sa DataMessage
44  */
45 
46 /*!
47  * Constructs a SegmentLeaderboardEntryMessage 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 SegmentLeaderboardEntryMessage object with private implementation \a d.
61  *
62  * \param d Pointer to private implementation.
63  */
65 {
66 
67 }
68 
69 /*!
70  * Returns the SegmentLeaderboardEntryMessage data message's \c messageIndex field's current value.
71  *
72  * \return the \c messageIndex field value.
73  */
75 {
77  return d->messageIndex;
78 }
79 
80 /*!
81  * Returns the SegmentLeaderboardEntryMessage data message's \c name field's current value.
82  *
83  * Friendly name assigned to leader
84  *
85  * \return the \c name field value.
86  */
88 {
90  return d->name;
91 }
92 
93 /*!
94  * Returns the SegmentLeaderboardEntryMessage data message's \c type field's current value.
95  *
96  * Leader classification
97  *
98  * \return the \c type field value.
99  */
101 {
103  return d->type;
104 }
105 
106 /*!
107  * Returns the SegmentLeaderboardEntryMessage data message's \c groupPrimaryKey field's current value.
108  *
109  * Primary user ID of this leader
110  *
111  * \return the \c groupPrimaryKey field value.
112  */
114 {
116  return d->groupPrimaryKey;
117 }
118 
119 /*!
120  * Returns the SegmentLeaderboardEntryMessage data message's \c activityId field's current value.
121  *
122  * ID of the activity associated with this leader time
123  *
124  * \return the \c activityId field value.
125  */
127 {
129  return d->activityId;
130 }
131 
132 /*!
133  * Returns the SegmentLeaderboardEntryMessage data message's \c segmentTime field's current value.
134  *
135  * Segment Time (includes pauses)
136  *
137  * \return the \c segmentTime field value.
138  */
140 {
142  return d->segmentTime;
143 }
144 
145 /*!
146  * Returns the SegmentLeaderboardEntryMessage data message's \c activityIdString field's current value.
147  *
148  * String version of the activity_id. 21 characters long, express in decimal
149  *
150  * \return the \c activityIdString field value.
151  */
153 {
155  return d->activityIdString;
156 }
157 
158 /*!
159  * Sets the \c messageIndex field to \a messageIndex.
160  *
161  * \param messageIndex The field value to set.
162  */
164 {
166  d->messageIndex = messageIndex;
167 }
168 /*!
169  * Sets the \c name field to \a name.
170  *
171  * \param name The field value to set.
172  */
174 {
176  d->name = name;
177 }
178 /*!
179  * Sets the \c type field to \a type.
180  *
181  * \param type The field value to set.
182  */
184 {
186  d->type = type;
187 }
188 /*!
189  * Sets the \c groupPrimaryKey field to \a groupPrimaryKey.
190  *
191  * \param groupPrimaryKey The field value to set.
192  */
193 void SegmentLeaderboardEntryMessage::setGroupPrimaryKey(const quint32 groupPrimaryKey)
194 {
196  d->groupPrimaryKey = groupPrimaryKey;
197 }
198 /*!
199  * Sets the \c activityId field to \a activityId.
200  *
201  * \param activityId The field value to set.
202  */
203 void SegmentLeaderboardEntryMessage::setActivityId(const quint32 activityId)
204 {
206  d->activityId = activityId;
207 }
208 /*!
209  * Sets the \c segmentTime field to \a segmentTime.
210  *
211  * \param segmentTime The field value to set.
212  */
213 void SegmentLeaderboardEntryMessage::setSegmentTime(const quint32 segmentTime)
214 {
216  d->segmentTime = segmentTime;
217 }
218 /*!
219  * Sets the \c activityIdString field to \a activityIdString.
220  *
221  * \param activityIdString The field value to set.
222  */
223 void SegmentLeaderboardEntryMessage::setActivityIdString(const QString activityIdString)
224 {
226  d->activityIdString = activityIdString;
227 }
228 
229 /// \cond internal
230 
231 /*!
232  * \internal
233  *
234  * \class SegmentLeaderboardEntryMessagePrivate
235  *
236  * The SegmentLeaderboardEntryMessagePrivate class provides private implementation for the SegmentLeaderboardEntryMessage.
237  *
238  * \sa SegmentLeaderboardEntryMessage
239  */
240 
241 /*!
242  * \internal
243  *
244  * Constructs a SegmentLeaderboardEntryMessagePrivate object with public implementation \a q.
245  *
246  * \param q Pointer to public implementaton.
247  */
248 SegmentLeaderboardEntryMessagePrivate::SegmentLeaderboardEntryMessagePrivate(SegmentLeaderboardEntryMessage * const q)
250  , messageIndex(static_cast<MessageIndex>(-1))
251  , type(static_cast<SegmentLeaderboardType>(-1))
252  , groupPrimaryKey(0xFFFFFFFF)
253  , activityId(0xFFFFFFFF)
254  , segmentTime(0xFFFFFFFF)
255 {
256  globalMessageNumber = MesgNum::SegmentLeaderboardEntry;
257 }
258 
259 /*!
260  * \internal
261  *
262  * Destroys the SegmentLeaderboardEntryMessagePrivate object.
263  */
265 {
266 
267 }
268 
270  const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian)
271 {
272  switch (fieldId) {
273  case 254: // See Profile.xlsx::Messages:segment_leaderboard_entry.messageIndex
274  if (!verify(data, baseType, 2, FitBaseType::Uint16, "segment_leaderboard_entry.messageIndex")) return false;
275  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
276  break;
277  case 0: // See Profile.xlsx::Messages:segment_leaderboard_entry.name
278  if (!verify(data, baseType, 1, FitBaseType::String, "segment_leaderboard_entry.name")) return false;
279  this->name = QString::fromUtf8(data);
280  break;
281  case 1: // See Profile.xlsx::Messages:segment_leaderboard_entry.type
282  if (!verify(data, baseType, 1, FitBaseType::Enum, "segment_leaderboard_entry.type")) return false;
283  this->type = static_cast<SegmentLeaderboardType>(data.at(0));
284  break;
285  case 2: // See Profile.xlsx::Messages:segment_leaderboard_entry.groupPrimaryKey
286  if (!verify(data, baseType, 4, FitBaseType::Uint32, "segment_leaderboard_entry.groupPrimaryKey")) return false;
287  this->groupPrimaryKey = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
288  break;
289  case 3: // See Profile.xlsx::Messages:segment_leaderboard_entry.activityId
290  if (!verify(data, baseType, 4, FitBaseType::Uint32, "segment_leaderboard_entry.activityId")) return false;
291  this->activityId = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
292  break;
293  case 4: // See Profile.xlsx::Messages:segment_leaderboard_entry.segmentTime
294  if (!verify(data, baseType, 4, FitBaseType::Uint32, "segment_leaderboard_entry.segmentTime")) return false;
295  this->segmentTime = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
296  break;
297  case 5: // See Profile.xlsx::Messages:segment_leaderboard_entry.activityIdString
298  if (!verify(data, baseType, 1, FitBaseType::String, "segment_leaderboard_entry.activityIdString")) return false;
299  this->activityIdString = QString::fromUtf8(data);
300  break;
301  default:
302  qWarning() << "ignoring unknown segment_leaderboard_entry message field number" << fieldId << bigEndian;
303  // Fall through to return true, as its still 'safe' to continue parsing data messages.
304  }
305  return true;
306 }
307 
308 /// \endcond
309 
#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.
QString activityIdString
The SegmentLeaderboardEntryMessage FIT message's activityIdString field.
MessageIndex messageIndex
The SegmentLeaderboardEntryMessage FIT message's messageIndex field.
quint32 activityId
The SegmentLeaderboardEntryMessage FIT message's activityId field.
quint32 groupPrimaryKey
The SegmentLeaderboardEntryMessage FIT message's groupPrimaryKey field.
bool setField(const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
QString name
The SegmentLeaderboardEntryMessage FIT message's name field.
quint32 segmentTime
The SegmentLeaderboardEntryMessage FIT message's segmentTime field.
SegmentLeaderboardType type
The SegmentLeaderboardEntryMessage FIT message's type field.
The SegmentLeaderboardEntryMessage class represents a FIT SegmentLeaderboardEntryMessage data message...
void setSegmentTime(const quint32 segmentTime)
Sets the segmentTime field to segmentTime.
void setName(const QString name)
Sets the name field to name.
QString name() const
Returns the SegmentLeaderboardEntryMessage data message's name field's current value.
void setActivityIdString(const QString activityIdString)
Sets the activityIdString field to activityIdString.
SegmentLeaderboardType type() const
Returns the SegmentLeaderboardEntryMessage data message's type field's current value.
quint32 segmentTime() const
Returns the SegmentLeaderboardEntryMessage data message's segmentTime field's current value.
QString activityIdString() const
Returns the SegmentLeaderboardEntryMessage data message's activityIdString field's current value.
SegmentLeaderboardEntryMessage()
Constructs a SegmentLeaderboardEntryMessage object.
quint32 groupPrimaryKey() const
Returns the SegmentLeaderboardEntryMessage data message's groupPrimaryKey field's current value.
quint32 activityId() const
Returns the SegmentLeaderboardEntryMessage data message's activityId field's current value.
void setGroupPrimaryKey(const quint32 groupPrimaryKey)
Sets the groupPrimaryKey field to groupPrimaryKey.
MessageIndex messageIndex() const
Returns the SegmentLeaderboardEntryMessage data message's messageIndex field's current value.
void setType(const SegmentLeaderboardType type)
Sets the type field to type.
void setMessageIndex(const MessageIndex messageIndex)
Sets the messageIndex field to messageIndex.
void setActivityId(const quint32 activityId)
Sets the activityId field to activityId.
Declares the SegmentLeaderboardEntryMessage class.
Declares the SegmentLeaderboardEntryMessagePrivate class.
FitBaseType
Garmin FIT FitBaseType type.
Definition: types.h:3388
SegmentLeaderboardType
Garmin FIT SegmentLeaderboardType type.
Definition: types.h:2737
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263