QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
videoclipmessage.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 VideoClipMessage, and VideoClipMessagePrivate classes.
28  */
29 
30 #include "videoclipmessage.h"
31 #include "videoclipmessage_p.h"
32 
33 #include <QDebug>
34 #include <QtEndian>
35 
37 
38 /*!
39  * \class VideoClipMessage
40  *
41  * The VideoClipMessage class represents a FIT VideoClipMessage data message.
42  *
43  * \sa DataMessage
44  */
45 
46 /*!
47  * Constructs a VideoClipMessage 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 VideoClipMessage object with private implementation \a d.
61  *
62  * \param d Pointer to private implementation.
63  */
65 {
66 
67 }
68 
69 /*!
70  * Returns the VideoClipMessage data message's \c clipNumber field's current value.
71  *
72  * \return the \c clipNumber field value.
73  */
75 {
76  Q_D(const VideoClipMessage);
77  return d->clipNumber;
78 }
79 
80 /*!
81  * Returns the VideoClipMessage data message's \c startTimestamp field's current value.
82  *
83  * \return the \c startTimestamp field value.
84  */
86 {
87  Q_D(const VideoClipMessage);
88  return d->startTimestamp;
89 }
90 
91 /*!
92  * Returns the VideoClipMessage data message's \c startTimestampMs field's current value.
93  *
94  * \return the \c startTimestampMs field value.
95  */
97 {
98  Q_D(const VideoClipMessage);
99  return d->startTimestampMs;
100 }
101 
102 /*!
103  * Returns the VideoClipMessage data message's \c endTimestamp field's current value.
104  *
105  * \return the \c endTimestamp field value.
106  */
108 {
109  Q_D(const VideoClipMessage);
110  return d->endTimestamp;
111 }
112 
113 /*!
114  * Returns the VideoClipMessage data message's \c endTimestampMs field's current value.
115  *
116  * \return the \c endTimestampMs field value.
117  */
119 {
120  Q_D(const VideoClipMessage);
121  return d->endTimestampMs;
122 }
123 
124 /*!
125  * Returns the VideoClipMessage data message's \c clipStart field's current value.
126  *
127  * Start of clip in video time
128  *
129  * \return the \c clipStart field value.
130  */
132 {
133  Q_D(const VideoClipMessage);
134  return d->clipStart;
135 }
136 
137 /*!
138  * Returns the VideoClipMessage data message's \c clipEnd field's current value.
139  *
140  * End of clip in video time
141  *
142  * \return the \c clipEnd field value.
143  */
145 {
146  Q_D(const VideoClipMessage);
147  return d->clipEnd;
148 }
149 
150 /*!
151  * Sets the \c clipNumber field to \a clipNumber.
152  *
153  * \param clipNumber The field value to set.
154  */
155 void VideoClipMessage::setClipNumber(const quint16 clipNumber)
156 {
157  Q_D(VideoClipMessage);
158  d->clipNumber = clipNumber;
159 }
160 /*!
161  * Sets the \c startTimestamp field to \a startTimestamp.
162  *
163  * \param startTimestamp The field value to set.
164  */
166 {
167  Q_D(VideoClipMessage);
168  d->startTimestamp = startTimestamp;
169 }
170 /*!
171  * Sets the \c startTimestampMs field to \a startTimestampMs.
172  *
173  * \param startTimestampMs The field value to set.
174  */
175 void VideoClipMessage::setStartTimestampMs(const quint16 startTimestampMs)
176 {
177  Q_D(VideoClipMessage);
178  d->startTimestampMs = startTimestampMs;
179 }
180 /*!
181  * Sets the \c endTimestamp field to \a endTimestamp.
182  *
183  * \param endTimestamp The field value to set.
184  */
186 {
187  Q_D(VideoClipMessage);
188  d->endTimestamp = endTimestamp;
189 }
190 /*!
191  * Sets the \c endTimestampMs field to \a endTimestampMs.
192  *
193  * \param endTimestampMs The field value to set.
194  */
195 void VideoClipMessage::setEndTimestampMs(const quint16 endTimestampMs)
196 {
197  Q_D(VideoClipMessage);
198  d->endTimestampMs = endTimestampMs;
199 }
200 /*!
201  * Sets the \c clipStart field to \a clipStart.
202  *
203  * \param clipStart The field value to set.
204  */
205 void VideoClipMessage::setClipStart(const quint32 clipStart)
206 {
207  Q_D(VideoClipMessage);
208  d->clipStart = clipStart;
209 }
210 /*!
211  * Sets the \c clipEnd field to \a clipEnd.
212  *
213  * \param clipEnd The field value to set.
214  */
215 void VideoClipMessage::setClipEnd(const quint32 clipEnd)
216 {
217  Q_D(VideoClipMessage);
218  d->clipEnd = clipEnd;
219 }
220 
221 /// \cond internal
222 
223 /*!
224  * \internal
225  *
226  * \class VideoClipMessagePrivate
227  *
228  * The VideoClipMessagePrivate class provides private implementation for the VideoClipMessage.
229  *
230  * \sa VideoClipMessage
231  */
232 
233 /*!
234  * \internal
235  *
236  * Constructs a VideoClipMessagePrivate object with public implementation \a q.
237  *
238  * \param q Pointer to public implementaton.
239  */
240 VideoClipMessagePrivate::VideoClipMessagePrivate(VideoClipMessage * const q)
242  , clipNumber(0xFFFF)
243  , startTimestamp(static_cast<DateTime>(-1))
244  , startTimestampMs(0xFFFF)
245  , endTimestamp(static_cast<DateTime>(-1))
246  , endTimestampMs(0xFFFF)
247  , clipStart(0xFFFFFFFF)
248  , clipEnd(0xFFFFFFFF)
249 {
250  globalMessageNumber = MesgNum::VideoClip;
251 }
252 
253 /*!
254  * \internal
255  *
256  * Destroys the VideoClipMessagePrivate object.
257  */
259 {
260 
261 }
262 
264  const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian)
265 {
266  switch (fieldId) {
267  case 0: // See Profile.xlsx::Messages:video_clip.clipNumber
268  if (!verify(data, baseType, 2, FitBaseType::Uint16, "video_clip.clipNumber")) return false;
269  this->clipNumber = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
270  break;
271  case 1: // See Profile.xlsx::Messages:video_clip.startTimestamp
272  if (!verify(data, baseType, 4, FitBaseType::Uint32, "video_clip.startTimestamp")) return false;
273  this->startTimestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
274  break;
275  case 2: // See Profile.xlsx::Messages:video_clip.startTimestampMs
276  if (!verify(data, baseType, 2, FitBaseType::Uint16, "video_clip.startTimestampMs")) return false;
277  this->startTimestampMs = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
278  break;
279  case 3: // See Profile.xlsx::Messages:video_clip.endTimestamp
280  if (!verify(data, baseType, 4, FitBaseType::Uint32, "video_clip.endTimestamp")) return false;
281  this->endTimestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
282  break;
283  case 4: // See Profile.xlsx::Messages:video_clip.endTimestampMs
284  if (!verify(data, baseType, 2, FitBaseType::Uint16, "video_clip.endTimestampMs")) return false;
285  this->endTimestampMs = static_cast<quint16>(bigEndian ? qFromBigEndian<quint16>(data) : qFromLittleEndian<quint16>(data));
286  break;
287  case 6: // See Profile.xlsx::Messages:video_clip.clipStart
288  if (!verify(data, baseType, 4, FitBaseType::Uint32, "video_clip.clipStart")) return false;
289  this->clipStart = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
290  break;
291  case 7: // See Profile.xlsx::Messages:video_clip.clipEnd
292  if (!verify(data, baseType, 4, FitBaseType::Uint32, "video_clip.clipEnd")) return false;
293  this->clipEnd = static_cast<quint32>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
294  break;
295  default:
296  qWarning() << "ignoring unknown video_clip message field number" << fieldId << bigEndian;
297  // Fall through to return true, as its still 'safe' to continue parsing data messages.
298  }
299  return true;
300 }
301 
302 /// \endcond
303 
#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.
quint16 clipNumber
The VideoClipMessage FIT message's clipNumber field.
bool setField(const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
quint32 clipEnd
The VideoClipMessage FIT message's clipEnd field.
quint16 startTimestampMs
The VideoClipMessage FIT message's startTimestampMs field.
DateTime startTimestamp
The VideoClipMessage FIT message's startTimestamp field.
quint16 endTimestampMs
The VideoClipMessage FIT message's endTimestampMs field.
quint32 clipStart
The VideoClipMessage FIT message's clipStart field.
DateTime endTimestamp
The VideoClipMessage FIT message's endTimestamp field.
The VideoClipMessage class represents a FIT VideoClipMessage data message.
void setStartTimestamp(const DateTime startTimestamp)
Sets the startTimestamp field to startTimestamp.
quint16 endTimestampMs() const
Returns the VideoClipMessage data message's endTimestampMs field's current value.
quint16 startTimestampMs() const
Returns the VideoClipMessage data message's startTimestampMs field's current value.
void setStartTimestampMs(const quint16 startTimestampMs)
Sets the startTimestampMs field to startTimestampMs.
void setEndTimestamp(const DateTime endTimestamp)
Sets the endTimestamp field to endTimestamp.
void setEndTimestampMs(const quint16 endTimestampMs)
Sets the endTimestampMs field to endTimestampMs.
void setClipEnd(const quint32 clipEnd)
Sets the clipEnd field to clipEnd.
quint16 clipNumber() const
Returns the VideoClipMessage data message's clipNumber field's current value.
void setClipNumber(const quint16 clipNumber)
Sets the clipNumber field to clipNumber.
quint32 clipEnd() const
Returns the VideoClipMessage data message's clipEnd field's current value.
VideoClipMessage()
Constructs a VideoClipMessage object.
void setClipStart(const quint32 clipStart)
Sets the clipStart field to clipStart.
quint32 clipStart() const
Returns the VideoClipMessage data message's clipStart field's current value.
DateTime startTimestamp() const
Returns the VideoClipMessage data message's startTimestamp field's current value.
DateTime endTimestamp() const
Returns the VideoClipMessage data message's endTimestamp field's current value.
FitBaseType
Garmin FIT FitBaseType type.
Definition: types.h:3388
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237
Declares the VideoClipMessage class.
Declares the VideoClipMessagePrivate class.