QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
filecapabilitiesmessage.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 FileCapabilitiesMessage, and FileCapabilitiesMessagePrivate classes.
28  */
29 
32 
33 #include <QDebug>
34 #include <QtEndian>
35 
37 
38 /*!
39  * \class FileCapabilitiesMessage
40  *
41  * The FileCapabilitiesMessage class represents a FIT FileCapabilitiesMessage data message.
42  *
43  * \sa DataMessage
44  */
45 
46 /*!
47  * Constructs a FileCapabilitiesMessage 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 FileCapabilitiesMessage object with private implementation \a d.
61  *
62  * \param d Pointer to private implementation.
63  */
65 {
66 
67 }
68 
69 /*!
70  * Returns the FileCapabilitiesMessage data message's \c messageIndex field's current value.
71  *
72  * \return the \c messageIndex field value.
73  */
75 {
76  Q_D(const FileCapabilitiesMessage);
77  return d->messageIndex;
78 }
79 
80 /*!
81  * Returns the FileCapabilitiesMessage data message's \c type field's current value.
82  *
83  * \return the \c type field value.
84  */
86 {
87  Q_D(const FileCapabilitiesMessage);
88  return d->type;
89 }
90 
91 /*!
92  * Returns the FileCapabilitiesMessage data message's \c flags field's current value.
93  *
94  * \return the \c flags field value.
95  */
97 {
98  Q_D(const FileCapabilitiesMessage);
99  return d->flags;
100 }
101 
102 /*!
103  * Returns the FileCapabilitiesMessage data message's \c directory field's current value.
104  *
105  * \return the \c directory field value.
106  */
108 {
109  Q_D(const FileCapabilitiesMessage);
110  return d->directory;
111 }
112 
113 /*!
114  * Returns the FileCapabilitiesMessage data message's \c maxCount field's current value.
115  *
116  * \return the \c maxCount field value.
117  */
119 {
120  Q_D(const FileCapabilitiesMessage);
121  return d->maxCount;
122 }
123 
124 /*!
125  * Returns the FileCapabilitiesMessage data message's \c maxSize field's current value.
126  *
127  * \return the \c maxSize field value.
128  */
130 {
131  Q_D(const FileCapabilitiesMessage);
132  return d->maxSize;
133 }
134 
135 /*!
136  * Sets the \c messageIndex field to \a messageIndex.
137  *
138  * \param messageIndex The field value to set.
139  */
141 {
143  d->messageIndex = messageIndex;
144 }
145 /*!
146  * Sets the \c type field to \a type.
147  *
148  * \param type The field value to set.
149  */
151 {
153  d->type = type;
154 }
155 /*!
156  * Sets the \c flags field to \a flags.
157  *
158  * \param flags The field value to set.
159  */
161 {
163  d->flags = flags;
164 }
165 /*!
166  * Sets the \c directory field to \a directory.
167  *
168  * \param directory The field value to set.
169  */
170 void FileCapabilitiesMessage::setDirectory(const QString directory)
171 {
173  d->directory = directory;
174 }
175 /*!
176  * Sets the \c maxCount field to \a maxCount.
177  *
178  * \param maxCount The field value to set.
179  */
180 void FileCapabilitiesMessage::setMaxCount(const quint16 maxCount)
181 {
183  d->maxCount = maxCount;
184 }
185 /*!
186  * Sets the \c maxSize field to \a maxSize.
187  *
188  * \param maxSize The field value to set.
189  */
190 void FileCapabilitiesMessage::setMaxSize(const quint32 maxSize)
191 {
193  d->maxSize = maxSize;
194 }
195 
196 /// \cond internal
197 
198 /*!
199  * \internal
200  *
201  * \class FileCapabilitiesMessagePrivate
202  *
203  * The FileCapabilitiesMessagePrivate class provides private implementation for the FileCapabilitiesMessage.
204  *
205  * \sa FileCapabilitiesMessage
206  */
207 
208 /*!
209  * \internal
210  *
211  * Constructs a FileCapabilitiesMessagePrivate object with public implementation \a q.
212  *
213  * \param q Pointer to public implementaton.
214  */
215 FileCapabilitiesMessagePrivate::FileCapabilitiesMessagePrivate(FileCapabilitiesMessage * const q)
217  , messageIndex(static_cast<MessageIndex>(-1))
218  , type(static_cast<File>(-1))
219  , flags(static_cast<FileFlags>(-1))
220  , maxCount(0xFFFF)
221  , maxSize(0xFFFFFFFF)
222 {
223  globalMessageNumber = MesgNum::FileCapabilities;
224 }
225 
226 /*!
227  * \internal
228  *
229  * Destroys the FileCapabilitiesMessagePrivate object.
230  */
232 {
233 
234 }
235 
237  const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian)
238 {
239  switch (fieldId) {
240  case 254: // See Profile.xlsx::Messages:file_capabilities.messageIndex
241  if (!verify(data, baseType, 2, FitBaseType::Uint16, "file_capabilities.messageIndex")) return false;
242  this->messageIndex = static_cast<MessageIndex>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
243  break;
244  case 0: // See Profile.xlsx::Messages:file_capabilities.type
245  if (!verify(data, baseType, 1, FitBaseType::Enum, "file_capabilities.type")) return false;
246  this->type = static_cast<File>(data.at(0));
247  break;
248  case 1: // See Profile.xlsx::Messages:file_capabilities.flags
249  if (!verify(data, baseType, 1, FitBaseType::Uint8z, "file_capabilities.flags")) return false;
250  this->flags = static_cast<FileFlags>(data.at(0));
251  break;
252  case 2: // See Profile.xlsx::Messages:file_capabilities.directory
253  if (!verify(data, baseType, 1, FitBaseType::String, "file_capabilities.directory")) return false;
254  this->directory = QString::fromUtf8(data);
255  break;
256  case 3: // See Profile.xlsx::Messages:file_capabilities.maxCount
257  if (!verify(data, baseType, 2, FitBaseType::Uint16, "file_capabilities.maxCount")) return false;
258  this->maxCount = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
259  break;
260  case 4: // See Profile.xlsx::Messages:file_capabilities.maxSize
261  if (!verify(data, baseType, 4, FitBaseType::Uint32, "file_capabilities.maxSize")) return false;
262  this->maxSize = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
263  break;
264  default:
265  qWarning() << "ignoring unknown file_capabilities message field number" << fieldId << bigEndian;
266  // Fall through to return true, as its still 'safe' to continue parsing data messages.
267  }
268  return true;
269 }
270 
271 /// \endcond
272 
#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.
bool setField(const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
QString directory
The FileCapabilitiesMessage FIT message's directory field.
quint16 maxCount
The FileCapabilitiesMessage FIT message's maxCount field.
FileFlags flags
The FileCapabilitiesMessage FIT message's flags field.
MessageIndex messageIndex
The FileCapabilitiesMessage FIT message's messageIndex field.
File type
The FileCapabilitiesMessage FIT message's type field.
quint32 maxSize
The FileCapabilitiesMessage FIT message's maxSize field.
The FileCapabilitiesMessage class represents a FIT FileCapabilitiesMessage data message.
void setMessageIndex(const MessageIndex messageIndex)
Sets the messageIndex field to messageIndex.
void setMaxCount(const quint16 maxCount)
Sets the maxCount field to maxCount.
quint32 maxSize() const
Returns the FileCapabilitiesMessage data message's maxSize field's current value.
quint16 maxCount() const
Returns the FileCapabilitiesMessage data message's maxCount field's current value.
File type() const
Returns the FileCapabilitiesMessage data message's type field's current value.
QString directory() const
Returns the FileCapabilitiesMessage data message's directory field's current value.
void setFlags(const FileFlags flags)
Sets the flags field to flags.
MessageIndex messageIndex() const
Returns the FileCapabilitiesMessage data message's messageIndex field's current value.
void setDirectory(const QString directory)
Sets the directory field to directory.
void setMaxSize(const quint32 maxSize)
Sets the maxSize field to maxSize.
FileCapabilitiesMessage()
Constructs a FileCapabilitiesMessage object.
FileFlags flags() const
Returns the FileCapabilitiesMessage data message's flags field's current value.
void setType(const File type)
Sets the type field to type.
Declares the FileCapabilitiesMessage class.
Declares the FileCapabilitiesMessagePrivate class.
FitBaseType
Garmin FIT FitBaseType type.
Definition: types.h:3388
MessageIndex
Garmin FIT MessageIndex type.
Definition: types.h:263
FileFlags
Garmin FIT FileFlags type.
Definition: types.h:207
File
Garmin FIT File type.
Definition: types.h:59