QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
connectivitymessage.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 ConnectivityMessage, and ConnectivityMessagePrivate classes.
28  */
29 
30 #include "connectivitymessage.h"
31 #include "connectivitymessage_p.h"
32 
33 #include <QDebug>
34 #include <QtEndian>
35 
37 
38 /*!
39  * \class ConnectivityMessage
40  *
41  * The ConnectivityMessage class represents a FIT ConnectivityMessage data message.
42  *
43  * \sa DataMessage
44  */
45 
46 /*!
47  * Constructs a ConnectivityMessage 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 ConnectivityMessage object with private implementation \a d.
61  *
62  * \param d Pointer to private implementation.
63  */
65 {
66 
67 }
68 
69 /*!
70  * Returns the ConnectivityMessage data message's \c bluetoothEnabled field's current value.
71  *
72  * Use Bluetooth for connectivity features
73  *
74  * \return the \c bluetoothEnabled field value.
75  */
77 {
78  Q_D(const ConnectivityMessage);
79  return d->bluetoothEnabled;
80 }
81 
82 /*!
83  * Returns the ConnectivityMessage data message's \c bluetoothLeEnabled field's current value.
84  *
85  * Use Bluetooth Low Energy for connectivity features
86  *
87  * \return the \c bluetoothLeEnabled field value.
88  */
90 {
91  Q_D(const ConnectivityMessage);
92  return d->bluetoothLeEnabled;
93 }
94 
95 /*!
96  * Returns the ConnectivityMessage data message's \c antEnabled field's current value.
97  *
98  * Use ANT for connectivity features
99  *
100  * \return the \c antEnabled field value.
101  */
103 {
104  Q_D(const ConnectivityMessage);
105  return d->antEnabled;
106 }
107 
108 /*!
109  * Returns the ConnectivityMessage data message's \c name field's current value.
110  *
111  * \return the \c name field value.
112  */
114 {
115  Q_D(const ConnectivityMessage);
116  return d->name;
117 }
118 
119 /*!
120  * Returns the ConnectivityMessage data message's \c liveTrackingEnabled field's current value.
121  *
122  * \return the \c liveTrackingEnabled field value.
123  */
125 {
126  Q_D(const ConnectivityMessage);
127  return d->liveTrackingEnabled;
128 }
129 
130 /*!
131  * Returns the ConnectivityMessage data message's \c weatherConditionsEnabled field's current value.
132  *
133  * \return the \c weatherConditionsEnabled field value.
134  */
136 {
137  Q_D(const ConnectivityMessage);
138  return d->weatherConditionsEnabled;
139 }
140 
141 /*!
142  * Returns the ConnectivityMessage data message's \c weatherAlertsEnabled field's current value.
143  *
144  * \return the \c weatherAlertsEnabled field value.
145  */
147 {
148  Q_D(const ConnectivityMessage);
149  return d->weatherAlertsEnabled;
150 }
151 
152 /*!
153  * Returns the ConnectivityMessage data message's \c autoActivityUploadEnabled field's current value.
154  *
155  * \return the \c autoActivityUploadEnabled field value.
156  */
158 {
159  Q_D(const ConnectivityMessage);
160  return d->autoActivityUploadEnabled;
161 }
162 
163 /*!
164  * Returns the ConnectivityMessage data message's \c courseDownloadEnabled field's current value.
165  *
166  * \return the \c courseDownloadEnabled field value.
167  */
169 {
170  Q_D(const ConnectivityMessage);
171  return d->courseDownloadEnabled;
172 }
173 
174 /*!
175  * Returns the ConnectivityMessage data message's \c workoutDownloadEnabled field's current value.
176  *
177  * \return the \c workoutDownloadEnabled field value.
178  */
180 {
181  Q_D(const ConnectivityMessage);
182  return d->workoutDownloadEnabled;
183 }
184 
185 /*!
186  * Returns the ConnectivityMessage data message's \c gpsEphemerisDownloadEnabled field's current value.
187  *
188  * \return the \c gpsEphemerisDownloadEnabled field value.
189  */
191 {
192  Q_D(const ConnectivityMessage);
193  return d->gpsEphemerisDownloadEnabled;
194 }
195 
196 /*!
197  * Returns the ConnectivityMessage data message's \c incidentDetectionEnabled field's current value.
198  *
199  * \return the \c incidentDetectionEnabled field value.
200  */
202 {
203  Q_D(const ConnectivityMessage);
204  return d->incidentDetectionEnabled;
205 }
206 
207 /*!
208  * Returns the ConnectivityMessage data message's \c grouptrackEnabled field's current value.
209  *
210  * \return the \c grouptrackEnabled field value.
211  */
213 {
214  Q_D(const ConnectivityMessage);
215  return d->grouptrackEnabled;
216 }
217 
218 /*!
219  * Sets the \c bluetoothEnabled field to \a bluetoothEnabled.
220  *
221  * \param bluetoothEnabled The field value to set.
222  */
223 void ConnectivityMessage::setBluetoothEnabled(const bool bluetoothEnabled)
224 {
225  Q_D(ConnectivityMessage);
226  d->bluetoothEnabled = bluetoothEnabled;
227 }
228 /*!
229  * Sets the \c bluetoothLeEnabled field to \a bluetoothLeEnabled.
230  *
231  * \param bluetoothLeEnabled The field value to set.
232  */
233 void ConnectivityMessage::setBluetoothLeEnabled(const bool bluetoothLeEnabled)
234 {
235  Q_D(ConnectivityMessage);
236  d->bluetoothLeEnabled = bluetoothLeEnabled;
237 }
238 /*!
239  * Sets the \c antEnabled field to \a antEnabled.
240  *
241  * \param antEnabled The field value to set.
242  */
243 void ConnectivityMessage::setAntEnabled(const bool antEnabled)
244 {
245  Q_D(ConnectivityMessage);
246  d->antEnabled = antEnabled;
247 }
248 /*!
249  * Sets the \c name field to \a name.
250  *
251  * \param name The field value to set.
252  */
253 void ConnectivityMessage::setName(const QString name)
254 {
255  Q_D(ConnectivityMessage);
256  d->name = name;
257 }
258 /*!
259  * Sets the \c liveTrackingEnabled field to \a liveTrackingEnabled.
260  *
261  * \param liveTrackingEnabled The field value to set.
262  */
263 void ConnectivityMessage::setLiveTrackingEnabled(const bool liveTrackingEnabled)
264 {
265  Q_D(ConnectivityMessage);
266  d->liveTrackingEnabled = liveTrackingEnabled;
267 }
268 /*!
269  * Sets the \c weatherConditionsEnabled field to \a weatherConditionsEnabled.
270  *
271  * \param weatherConditionsEnabled The field value to set.
272  */
273 void ConnectivityMessage::setWeatherConditionsEnabled(const bool weatherConditionsEnabled)
274 {
275  Q_D(ConnectivityMessage);
276  d->weatherConditionsEnabled = weatherConditionsEnabled;
277 }
278 /*!
279  * Sets the \c weatherAlertsEnabled field to \a weatherAlertsEnabled.
280  *
281  * \param weatherAlertsEnabled The field value to set.
282  */
283 void ConnectivityMessage::setWeatherAlertsEnabled(const bool weatherAlertsEnabled)
284 {
285  Q_D(ConnectivityMessage);
286  d->weatherAlertsEnabled = weatherAlertsEnabled;
287 }
288 /*!
289  * Sets the \c autoActivityUploadEnabled field to \a autoActivityUploadEnabled.
290  *
291  * \param autoActivityUploadEnabled The field value to set.
292  */
293 void ConnectivityMessage::setAutoActivityUploadEnabled(const bool autoActivityUploadEnabled)
294 {
295  Q_D(ConnectivityMessage);
296  d->autoActivityUploadEnabled = autoActivityUploadEnabled;
297 }
298 /*!
299  * Sets the \c courseDownloadEnabled field to \a courseDownloadEnabled.
300  *
301  * \param courseDownloadEnabled The field value to set.
302  */
303 void ConnectivityMessage::setCourseDownloadEnabled(const bool courseDownloadEnabled)
304 {
305  Q_D(ConnectivityMessage);
306  d->courseDownloadEnabled = courseDownloadEnabled;
307 }
308 /*!
309  * Sets the \c workoutDownloadEnabled field to \a workoutDownloadEnabled.
310  *
311  * \param workoutDownloadEnabled The field value to set.
312  */
313 void ConnectivityMessage::setWorkoutDownloadEnabled(const bool workoutDownloadEnabled)
314 {
315  Q_D(ConnectivityMessage);
316  d->workoutDownloadEnabled = workoutDownloadEnabled;
317 }
318 /*!
319  * Sets the \c gpsEphemerisDownloadEnabled field to \a gpsEphemerisDownloadEnabled.
320  *
321  * \param gpsEphemerisDownloadEnabled The field value to set.
322  */
323 void ConnectivityMessage::setGpsEphemerisDownloadEnabled(const bool gpsEphemerisDownloadEnabled)
324 {
325  Q_D(ConnectivityMessage);
326  d->gpsEphemerisDownloadEnabled = gpsEphemerisDownloadEnabled;
327 }
328 /*!
329  * Sets the \c incidentDetectionEnabled field to \a incidentDetectionEnabled.
330  *
331  * \param incidentDetectionEnabled The field value to set.
332  */
333 void ConnectivityMessage::setIncidentDetectionEnabled(const bool incidentDetectionEnabled)
334 {
335  Q_D(ConnectivityMessage);
336  d->incidentDetectionEnabled = incidentDetectionEnabled;
337 }
338 /*!
339  * Sets the \c grouptrackEnabled field to \a grouptrackEnabled.
340  *
341  * \param grouptrackEnabled The field value to set.
342  */
343 void ConnectivityMessage::setGrouptrackEnabled(const bool grouptrackEnabled)
344 {
345  Q_D(ConnectivityMessage);
346  d->grouptrackEnabled = grouptrackEnabled;
347 }
348 
349 /// \cond internal
350 
351 /*!
352  * \internal
353  *
354  * \class ConnectivityMessagePrivate
355  *
356  * The ConnectivityMessagePrivate class provides private implementation for the ConnectivityMessage.
357  *
358  * \sa ConnectivityMessage
359  */
360 
361 /*!
362  * \internal
363  *
364  * Constructs a ConnectivityMessagePrivate object with public implementation \a q.
365  *
366  * \param q Pointer to public implementaton.
367  */
368 ConnectivityMessagePrivate::ConnectivityMessagePrivate(ConnectivityMessage * const q)
370  , bluetoothEnabled(static_cast<bool>(-1))
371  , bluetoothLeEnabled(static_cast<bool>(-1))
372  , antEnabled(static_cast<bool>(-1))
373  , liveTrackingEnabled(static_cast<bool>(-1))
374  , weatherConditionsEnabled(static_cast<bool>(-1))
375  , weatherAlertsEnabled(static_cast<bool>(-1))
376  , autoActivityUploadEnabled(static_cast<bool>(-1))
377  , courseDownloadEnabled(static_cast<bool>(-1))
378  , workoutDownloadEnabled(static_cast<bool>(-1))
379  , gpsEphemerisDownloadEnabled(static_cast<bool>(-1))
380  , incidentDetectionEnabled(static_cast<bool>(-1))
381  , grouptrackEnabled(static_cast<bool>(-1))
382 {
383  globalMessageNumber = MesgNum::Connectivity;
384 }
385 
386 /*!
387  * \internal
388  *
389  * Destroys the ConnectivityMessagePrivate object.
390  */
392 {
393 
394 }
395 
397  const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian)
398 {
399  switch (fieldId) {
400  case 0: // See Profile.xlsx::Messages:connectivity.bluetoothEnabled
401  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.bluetoothEnabled")) return false;
402  this->bluetoothEnabled = static_cast<bool>(data.at(0));
403  break;
404  case 1: // See Profile.xlsx::Messages:connectivity.bluetoothLeEnabled
405  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.bluetoothLeEnabled")) return false;
406  this->bluetoothLeEnabled = static_cast<bool>(data.at(0));
407  break;
408  case 2: // See Profile.xlsx::Messages:connectivity.antEnabled
409  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.antEnabled")) return false;
410  this->antEnabled = static_cast<bool>(data.at(0));
411  break;
412  case 3: // See Profile.xlsx::Messages:connectivity.name
413  if (!verify(data, baseType, 1, FitBaseType::String, "connectivity.name")) return false;
414  this->name = QString::fromUtf8(data);
415  break;
416  case 4: // See Profile.xlsx::Messages:connectivity.liveTrackingEnabled
417  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.liveTrackingEnabled")) return false;
418  this->liveTrackingEnabled = static_cast<bool>(data.at(0));
419  break;
420  case 5: // See Profile.xlsx::Messages:connectivity.weatherConditionsEnabled
421  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.weatherConditionsEnabled")) return false;
422  this->weatherConditionsEnabled = static_cast<bool>(data.at(0));
423  break;
424  case 6: // See Profile.xlsx::Messages:connectivity.weatherAlertsEnabled
425  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.weatherAlertsEnabled")) return false;
426  this->weatherAlertsEnabled = static_cast<bool>(data.at(0));
427  break;
428  case 7: // See Profile.xlsx::Messages:connectivity.autoActivityUploadEnabled
429  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.autoActivityUploadEnabled")) return false;
430  this->autoActivityUploadEnabled = static_cast<bool>(data.at(0));
431  break;
432  case 8: // See Profile.xlsx::Messages:connectivity.courseDownloadEnabled
433  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.courseDownloadEnabled")) return false;
434  this->courseDownloadEnabled = static_cast<bool>(data.at(0));
435  break;
436  case 9: // See Profile.xlsx::Messages:connectivity.workoutDownloadEnabled
437  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.workoutDownloadEnabled")) return false;
438  this->workoutDownloadEnabled = static_cast<bool>(data.at(0));
439  break;
440  case 10: // See Profile.xlsx::Messages:connectivity.gpsEphemerisDownloadEnabled
441  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.gpsEphemerisDownloadEnabled")) return false;
442  this->gpsEphemerisDownloadEnabled = static_cast<bool>(data.at(0));
443  break;
444  case 11: // See Profile.xlsx::Messages:connectivity.incidentDetectionEnabled
445  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.incidentDetectionEnabled")) return false;
446  this->incidentDetectionEnabled = static_cast<bool>(data.at(0));
447  break;
448  case 12: // See Profile.xlsx::Messages:connectivity.grouptrackEnabled
449  if (!verify(data, baseType, 0, FitBaseType::Byte, "connectivity.grouptrackEnabled")) return false;
450  this->grouptrackEnabled = static_cast<bool>(data.at(0));
451  break;
452  default:
453  qWarning() << "ignoring unknown connectivity message field number" << fieldId << bigEndian;
454  // Fall through to return true, as its still 'safe' to continue parsing data messages.
455  }
456  return true;
457 }
458 
459 /// \endcond
460 
#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 antEnabled
The ConnectivityMessage FIT message's antEnabled field.
bool grouptrackEnabled
The ConnectivityMessage FIT message's grouptrackEnabled field.
bool workoutDownloadEnabled
The ConnectivityMessage FIT message's workoutDownloadEnabled field.
bool bluetoothLeEnabled
The ConnectivityMessage FIT message's bluetoothLeEnabled field.
bool weatherConditionsEnabled
The ConnectivityMessage FIT message's weatherConditionsEnabled field.
bool setField(const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
bool gpsEphemerisDownloadEnabled
The ConnectivityMessage FIT message's gpsEphemerisDownloadEnabled field.
bool weatherAlertsEnabled
The ConnectivityMessage FIT message's weatherAlertsEnabled field.
bool bluetoothEnabled
The ConnectivityMessage FIT message's bluetoothEnabled field.
bool autoActivityUploadEnabled
The ConnectivityMessage FIT message's autoActivityUploadEnabled field.
bool liveTrackingEnabled
The ConnectivityMessage FIT message's liveTrackingEnabled field.
bool incidentDetectionEnabled
The ConnectivityMessage FIT message's incidentDetectionEnabled field.
bool courseDownloadEnabled
The ConnectivityMessage FIT message's courseDownloadEnabled field.
QString name
The ConnectivityMessage FIT message's name field.
The ConnectivityMessage class represents a FIT ConnectivityMessage data message.
void setGrouptrackEnabled(const bool grouptrackEnabled)
Sets the grouptrackEnabled field to grouptrackEnabled.
void setWeatherConditionsEnabled(const bool weatherConditionsEnabled)
Sets the weatherConditionsEnabled field to weatherConditionsEnabled.
void setCourseDownloadEnabled(const bool courseDownloadEnabled)
Sets the courseDownloadEnabled field to courseDownloadEnabled.
bool grouptrackEnabled() const
Returns the ConnectivityMessage data message's grouptrackEnabled field's current value.
void setBluetoothEnabled(const bool bluetoothEnabled)
Sets the bluetoothEnabled field to bluetoothEnabled.
bool autoActivityUploadEnabled() const
Returns the ConnectivityMessage data message's autoActivityUploadEnabled field's current value.
void setWorkoutDownloadEnabled(const bool workoutDownloadEnabled)
Sets the workoutDownloadEnabled field to workoutDownloadEnabled.
void setAutoActivityUploadEnabled(const bool autoActivityUploadEnabled)
Sets the autoActivityUploadEnabled field to autoActivityUploadEnabled.
void setGpsEphemerisDownloadEnabled(const bool gpsEphemerisDownloadEnabled)
Sets the gpsEphemerisDownloadEnabled field to gpsEphemerisDownloadEnabled.
bool bluetoothEnabled() const
Returns the ConnectivityMessage data message's bluetoothEnabled field's current value.
bool workoutDownloadEnabled() const
Returns the ConnectivityMessage data message's workoutDownloadEnabled field's current value.
void setLiveTrackingEnabled(const bool liveTrackingEnabled)
Sets the liveTrackingEnabled field to liveTrackingEnabled.
bool gpsEphemerisDownloadEnabled() const
Returns the ConnectivityMessage data message's gpsEphemerisDownloadEnabled field's current value.
void setWeatherAlertsEnabled(const bool weatherAlertsEnabled)
Sets the weatherAlertsEnabled field to weatherAlertsEnabled.
QString name() const
Returns the ConnectivityMessage data message's name field's current value.
bool antEnabled() const
Returns the ConnectivityMessage data message's antEnabled field's current value.
bool weatherAlertsEnabled() const
Returns the ConnectivityMessage data message's weatherAlertsEnabled field's current value.
void setAntEnabled(const bool antEnabled)
Sets the antEnabled field to antEnabled.
bool courseDownloadEnabled() const
Returns the ConnectivityMessage data message's courseDownloadEnabled field's current value.
void setBluetoothLeEnabled(const bool bluetoothLeEnabled)
Sets the bluetoothLeEnabled field to bluetoothLeEnabled.
bool weatherConditionsEnabled() const
Returns the ConnectivityMessage data message's weatherConditionsEnabled field's current value.
void setName(const QString name)
Sets the name field to name.
bool bluetoothLeEnabled() const
Returns the ConnectivityMessage data message's bluetoothLeEnabled field's current value.
ConnectivityMessage()
Constructs a ConnectivityMessage object.
bool incidentDetectionEnabled() const
Returns the ConnectivityMessage data message's incidentDetectionEnabled field's current value.
void setIncidentDetectionEnabled(const bool incidentDetectionEnabled)
Sets the incidentDetectionEnabled field to incidentDetectionEnabled.
bool liveTrackingEnabled() const
Returns the ConnectivityMessage data message's liveTrackingEnabled field's current value.
Declares the ConnectivityMessage class.
Declares the ConnectivityMessagePrivate class.
FitBaseType
Garmin FIT FitBaseType type.
Definition: types.h:3388