QtFit  0.1
Internal library development documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WeatherAlertMessagePrivate Class Reference
Inheritance diagram for WeatherAlertMessagePrivate:
[legend]
Collaboration diagram for WeatherAlertMessagePrivate:
[legend]

Public Member Functions

 WeatherAlertMessagePrivate (WeatherAlertMessage *const q)
 
virtual ~WeatherAlertMessagePrivate ()
 
- Public Member Functions inherited from AbstractDataMessagePrivate
 AbstractDataMessagePrivate (AbstractDataMessage *const q)
 
virtual ~AbstractDataMessagePrivate ()
 
bool setFields (const DataDefinition *const defn, const QByteArray &record)
 

Public Attributes

DateTime timestamp
 The WeatherAlertMessage FIT message's timestamp field.
 
QString reportId
 The WeatherAlertMessage FIT message's reportId field. More...
 
DateTime issueTime
 The WeatherAlertMessage FIT message's issueTime field. More...
 
DateTime expireTime
 The WeatherAlertMessage FIT message's expireTime field. More...
 
WeatherSeverity severity
 The WeatherAlertMessage FIT message's severity field. More...
 
WeatherSevereType type
 The WeatherAlertMessage FIT message's type field. More...
 
- Public Attributes inherited from AbstractDataMessagePrivate
MesgNum globalMessageNumber
 FIT Globla Message Number for this FIT Data Message.
 

Protected Member Functions

bool setField (const int fieldId, const QByteArray &data, const FitBaseType baseType, const bool bigEndian) override
 
- Protected Member Functions inherited from AbstractDataMessagePrivate
bool verify (const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
 

Additional Inherited Members

- Protected Attributes inherited from AbstractDataMessagePrivate
AbstractDataMessage *const q_ptr
 Internal q-pointer.
 

Detailed Description

The WeatherAlertMessagePrivate class provides private implementation for the WeatherAlertMessage.

See also
WeatherAlertMessage

Definition at line 38 of file weatheralertmessage_p.h.

Constructor & Destructor Documentation

◆ WeatherAlertMessagePrivate()

WeatherAlertMessagePrivate::WeatherAlertMessagePrivate ( WeatherAlertMessage *const  q)
explicit

Constructs a WeatherAlertMessagePrivate object with public implementation q.

Parameters
qPointer to public implementaton.

Definition at line 225 of file weatheralertmessage.cpp.

227  , timestamp(static_cast<DateTime>(-1))
228  , issueTime(static_cast<DateTime>(-1))
229  , expireTime(static_cast<DateTime>(-1))
230  , severity(static_cast<WeatherSeverity>(-1))
231  , type(static_cast<WeatherSevereType>(-1))
232 {
233  globalMessageNumber = MesgNum::WeatherAlert;
234 }
MesgNum globalMessageNumber
FIT Globla Message Number for this FIT Data Message.
DateTime timestamp
The WeatherAlertMessage FIT message's timestamp field.
WeatherSeverity severity
The WeatherAlertMessage FIT message's severity field.
WeatherSevereType type
The WeatherAlertMessage FIT message's type field.
DateTime expireTime
The WeatherAlertMessage FIT message's expireTime field.
DateTime issueTime
The WeatherAlertMessage FIT message's issueTime field.
WeatherSevereType
Garmin FIT WeatherSevereType type.
Definition: types.h:2534
WeatherSeverity
Garmin FIT WeatherSeverity type.
Definition: types.h:2517
DateTime
Seconds since UTC 00:00 Dec 31 1989.
Definition: types.h:237

References AbstractDataMessagePrivate::globalMessageNumber.

◆ ~WeatherAlertMessagePrivate()

WeatherAlertMessagePrivate::~WeatherAlertMessagePrivate ( )
virtual

Destroys the WeatherAlertMessagePrivate object.

Definition at line 241 of file weatheralertmessage.cpp.

242 {
243 
244 }

Member Function Documentation

◆ setField()

bool WeatherAlertMessagePrivate::setField ( const int  fieldId,
const QByteArray &  data,
const FitBaseType  baseType,
const bool  bigEndian 
)
overrideprotectedvirtual

Sets the value of the fieldId field.

Derived classes must implement this method to extract the baseType value from data, and assign the extracted value the fieldId field.

Parameters
fieldIdThe field number within the given FIT data message.
dataThe raw data to extract the field value from.
baseTypeThe FIT base type for the field.
bigEndianWhether or not multibyte values in record are big-endian.
Returns
true if the field was set, or safely ignored; false otherwise.

Implements AbstractDataMessagePrivate.

Definition at line 246 of file weatheralertmessage.cpp.

248 {
249  switch (fieldId) {
250  case 253: // See Profile.xlsx::Messages:weather_alert.timestamp
251  if (!verify(data, baseType, 4, FitBaseType::Uint32, "weather_alert.timestamp")) return false;
252  this->timestamp = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
253  break;
254  case 0: // See Profile.xlsx::Messages:weather_alert.reportId
255  if (!verify(data, baseType, 1, FitBaseType::String, "weather_alert.reportId")) return false;
256  this->reportId = QString::fromUtf8(data);
257  break;
258  case 1: // See Profile.xlsx::Messages:weather_alert.issueTime
259  if (!verify(data, baseType, 4, FitBaseType::Uint32, "weather_alert.issueTime")) return false;
260  this->issueTime = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
261  break;
262  case 2: // See Profile.xlsx::Messages:weather_alert.expireTime
263  if (!verify(data, baseType, 4, FitBaseType::Uint32, "weather_alert.expireTime")) return false;
264  this->expireTime = static_cast<DateTime>(bigEndian ? qFromBigEndian<quint32>(data) : qFromLittleEndian<quint32>(data));
265  break;
266  case 3: // See Profile.xlsx::Messages:weather_alert.severity
267  if (!verify(data, baseType, 1, FitBaseType::Enum, "weather_alert.severity")) return false;
268  this->severity = static_cast<WeatherSeverity>(data.at(0));
269  break;
270  case 4: // See Profile.xlsx::Messages:weather_alert.type
271  if (!verify(data, baseType, 1, FitBaseType::Enum, "weather_alert.type")) return false;
272  this->type = static_cast<WeatherSevereType>(data.at(0));
273  break;
274  default:
275  qWarning() << "ignoring unknown weather_alert message field number" << fieldId << bigEndian;
276  // Fall through to return true, as its still 'safe' to continue parsing data messages.
277  }
278  return true;
279 }
bool verify(const QByteArray &data, const FitBaseType actualType, const int expectedSize, const FitBaseType expectedType, const char *messageFieldName)
QString reportId
The WeatherAlertMessage FIT message's reportId field.

References AbstractDataMessagePrivate::verify().

Here is the call graph for this function:

Member Data Documentation

◆ expireTime

DateTime WeatherAlertMessagePrivate::expireTime

The WeatherAlertMessage FIT message's expireTime field.

Time alert expires

Definition at line 65 of file weatheralertmessage_p.h.

◆ issueTime

DateTime WeatherAlertMessagePrivate::issueTime

The WeatherAlertMessage FIT message's issueTime field.

Time alert was issued

Definition at line 58 of file weatheralertmessage_p.h.

◆ reportId

QString WeatherAlertMessagePrivate::reportId

The WeatherAlertMessage FIT message's reportId field.

Unique identifier from GCS report ID string, length is 12

Definition at line 51 of file weatheralertmessage_p.h.

◆ severity

WeatherSeverity WeatherAlertMessagePrivate::severity

The WeatherAlertMessage FIT message's severity field.

Warning, Watch, Advisory, Statement

Definition at line 72 of file weatheralertmessage_p.h.

◆ type

WeatherSevereType WeatherAlertMessagePrivate::type

The WeatherAlertMessage FIT message's type field.

Tornado, Severe Thunderstorm, etc.

Definition at line 79 of file weatheralertmessage_p.h.


The documentation for this class was generated from the following files: