Packages

A high-performance Elixir library for decoding Garmin .fit files using a C++ NIF.

Current section

Files

Jump to
fit_decoder c_src fit_sdk cpp fit_spo2_data_mesg.hpp
Raw

c_src/fit_sdk/cpp/fit_spo2_data_mesg.hpp

/////////////////////////////////////////////////////////////////////////////////////////////
// Copyright 2025 Garmin International, Inc.
// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
// may not use this file except in compliance with the Flexible and Interoperable Data
// Transfer (FIT) Protocol License.
/////////////////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 21.171.0Release
// Tag = production/release/21.171.0-0-g57fed75
/////////////////////////////////////////////////////////////////////////////////////////////
#if !defined(FIT_SPO2_DATA_MESG_HPP)
#define FIT_SPO2_DATA_MESG_HPP
#include "fit_mesg.hpp"
namespace fit
{
class Spo2DataMesg : public Mesg
{
public:
class FieldDefNum final
{
public:
static const FIT_UINT8 Timestamp = 253;
static const FIT_UINT8 ReadingSpo2 = 0;
static const FIT_UINT8 ReadingConfidence = 1;
static const FIT_UINT8 Mode = 2;
static const FIT_UINT8 Invalid = FIT_FIELD_NUM_INVALID;
};
Spo2DataMesg(void) : Mesg(Profile::MESG_SPO2_DATA)
{
}
Spo2DataMesg(const Mesg &mesg) : Mesg(mesg)
{
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of timestamp field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsTimestampValid() const
{
const Field* field = GetField(253);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns timestamp field
// Units: s
///////////////////////////////////////////////////////////////////////
FIT_DATE_TIME GetTimestamp(void) const
{
return GetFieldUINT32Value(253, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set timestamp field
// Units: s
///////////////////////////////////////////////////////////////////////
void SetTimestamp(FIT_DATE_TIME timestamp)
{
SetFieldUINT32Value(253, timestamp, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of reading_spo2 field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsReadingSpo2Valid() const
{
const Field* field = GetField(0);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns reading_spo2 field
// Units: percent
///////////////////////////////////////////////////////////////////////
FIT_UINT8 GetReadingSpo2(void) const
{
return GetFieldUINT8Value(0, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set reading_spo2 field
// Units: percent
///////////////////////////////////////////////////////////////////////
void SetReadingSpo2(FIT_UINT8 readingSpo2)
{
SetFieldUINT8Value(0, readingSpo2, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of reading_confidence field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsReadingConfidenceValid() const
{
const Field* field = GetField(1);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns reading_confidence field
///////////////////////////////////////////////////////////////////////
FIT_UINT8 GetReadingConfidence(void) const
{
return GetFieldUINT8Value(1, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set reading_confidence field
///////////////////////////////////////////////////////////////////////
void SetReadingConfidence(FIT_UINT8 readingConfidence)
{
SetFieldUINT8Value(1, readingConfidence, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of mode field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsModeValid() const
{
const Field* field = GetField(2);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns mode field
// Comment: Mode when data was captured
///////////////////////////////////////////////////////////////////////
FIT_SPO2_MEASUREMENT_TYPE GetMode(void) const
{
return GetFieldENUMValue(2, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set mode field
// Comment: Mode when data was captured
///////////////////////////////////////////////////////////////////////
void SetMode(FIT_SPO2_MEASUREMENT_TYPE mode)
{
SetFieldENUMValue(2, mode, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
};
} // namespace fit
#endif // !defined(FIT_SPO2_DATA_MESG_HPP)