QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
exercisetitlemessage.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 ExerciseTitleMessage, and ExerciseTitleMessagePrivate classes.
28  */
29 
30 #include "exercisetitlemessage.h"
31 #include "exercisetitlemessage_p.h"
32 
33 #include <QDebug>
34 #include <QtEndian>
35 
37 
38 /*!
39  * \class ExerciseTitleMessage
40  *
41  * The ExerciseTitleMessage class represents a FIT ExerciseTitleMessage data message.
42  *
43  * \sa DataMessage
44  */
45 
46 /*!
47  * Constructs a ExerciseTitleMessage 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 ExerciseTitleMessage object with private implementation \a d.
61  *
62  * \param d Pointer to private implementation.
63  */
65 {
66 
67 }
68 
69 /*!
70  * Returns the ExerciseTitleMessage data message's \c messageIndex field's current value.
71  *
72  * \return the \c messageIndex field value.
73  */
75 {
76  Q_D(const ExerciseTitleMessage);
77  return d->messageIndex;
78 }
79 
80 /*!
81  * Returns the ExerciseTitleMessage data message's \c exerciseCategory field's current value.
82  *
83  * \return the \c exerciseCategory field value.
84  */
86 {
87  Q_D(const ExerciseTitleMessage);
88  return d->exerciseCategory;
89 }
90 
91 /*!
92  * Returns the ExerciseTitleMessage data message's \c exerciseName field's current value.
93  *
94  * \return the \c exerciseName field value.
95  */
97 {
98  Q_D(const ExerciseTitleMessage);
99  return d->exerciseName;
100 }
101 
102 /*!
103  * Returns the ExerciseTitleMessage data message's \c wktStepName field's current value.
104  *
105  * \return the \c wktStepName field value.
106  */
108 {
109  Q_D(const ExerciseTitleMessage);
110  return d->wktStepName;
111 }
112 
113 /*!
114  * Sets the \c messageIndex field to \a messageIndex.
115  *
116  * \param messageIndex The field value to set.
117  */
119 {
121  d->messageIndex = messageIndex;
122 }
123 /*!
124  * Sets the \c exerciseCategory field to \a exerciseCategory.
125  *
126  * \param exerciseCategory The field value to set.
127  */
129 {
131  d->exerciseCategory = exerciseCategory;
132 }
133 /*!
134  * Sets the \c exerciseName field to \a exerciseName.
135  *
136  * \param exerciseName The field value to set.
137  */
138 void ExerciseTitleMessage::setExerciseName(const quint16 exerciseName)
139 {
141  d->exerciseName = exerciseName;
142 }
143 /*!
144  * Sets the \c wktStepName field to \a wktStepName.
145  *
146  * \param wktStepName The field value to set.
147  */
148 void ExerciseTitleMessage::setWktStepName(const QString wktStepName)
149 {
151  d->wktStepName = wktStepName;
152 }
153 
154 /// \cond internal
155 
156 /*!
157  * \internal
158  *
159  * \class ExerciseTitleMessagePrivate
160  *
161  * The ExerciseTitleMessagePrivate class provides private implementation for the ExerciseTitleMessage.
162  *
163  * \sa ExerciseTitleMessage
164  */
165 
166 /*!
167  * \internal
168  *
169  * Constructs a ExerciseTitleMessagePrivate object with public implementation \a q.
170  *
171  * \param q Pointer to public implementaton.
172  */
173 ExerciseTitleMessagePrivate::ExerciseTitleMessagePrivate(ExerciseTitleMessage * const q)
175  , messageIndex(static_cast<MessageIndex>(-1))
176  , exerciseCategory(static_cast<ExerciseCategory>(-1))
177  , exerciseName(0xFFFF)
178 {
179  globalMessageNumber = MesgNum::ExerciseTitle;
180 }
181 
182 /*!
183  * \internal
184  *
185  * Destroys the ExerciseTitleMessagePrivate object.
186  */
188 {
189 
190 }
191 
193  const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian)
194 {
195  switch (fieldId) {
196  case 254: // See Profile.xlsx::Messages:exercise_title.messageIndex
197  if (!verify(data, baseType, 2, FitBaseType::Uint16, "exercise_title.messageIndex")) return false;
198  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
199  break;
200  case 0: // See Profile.xlsx::Messages:exercise_title.exerciseCategory
201  if (!verify(data, baseType, 2, FitBaseType::Uint16, "exercise_title.exerciseCategory")) return false;
202  this->exerciseCategory = static_cast<ExerciseCategory>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
203  break;
204  case 1: // See Profile.xlsx::Messages:exercise_title.exerciseName
205  if (!verify(data, baseType, 2, FitBaseType::Uint16, "exercise_title.exerciseName")) return false;
206  this->exerciseName = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
207  break;
208  case 2: // See Profile.xlsx::Messages:exercise_title.wktStepName
209  if (!verify(data, baseType, 1, FitBaseType::String, "exercise_title.wktStepName")) return false;
210  this->wktStepName = QString::fromUtf8(data);
211  break;
212  default:
213  qWarning() << "ignoring unknown exercise_title message field number" << fieldId << bigEndian;
214  // Fall through to return true, as its still 'safe' to continue parsing data messages.
215  }
216  return true;
217 }
218 
219 /// \endcond
220 
#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.
MessageIndex messageIndex
The ExerciseTitleMessage FIT message's messageIndex field.
ExerciseCategory exerciseCategory
The ExerciseTitleMessage FIT message's exerciseCategory field.
QString wktStepName
The ExerciseTitleMessage FIT message's wktStepName field.
bool setField(const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
quint16 exerciseName
The ExerciseTitleMessage FIT message's exerciseName field.
The ExerciseTitleMessage class represents a FIT ExerciseTitleMessage data message.
quint16 exerciseName() const
Returns the ExerciseTitleMessage data message's exerciseName field's current value.
void setExerciseCategory(const ExerciseCategory exerciseCategory)
Sets the exerciseCategory field to exerciseCategory.
ExerciseCategory exerciseCategory() const
Returns the ExerciseTitleMessage data message's exerciseCategory field's current value.
void setWktStepName(const QString wktStepName)
Sets the wktStepName field to wktStepName.
ExerciseTitleMessage()
Constructs a ExerciseTitleMessage object.
QString wktStepName() const
Returns the ExerciseTitleMessage data message's wktStepName field's current value.
MessageIndex messageIndex() const
Returns the ExerciseTitleMessage data message's messageIndex field's current value.
void setExerciseName(const quint16 exerciseName)
Sets the exerciseName field to exerciseName.
void setMessageIndex(const MessageIndex messageIndex)
Sets the messageIndex field to messageIndex.
Declares the ExerciseTitleMessage class.
Declares the ExerciseTitleMessagePrivate class.
FitBaseType
Garmin FIT FitBaseType type.
Definition: types.h:3388
ExerciseCategory
Garmin FIT ExerciseCategory type.
Definition: types.h:3510
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263