Packages
fit_decoder
0.1.0
A high-performance Elixir library for decoding Garmin .fit files using a C++ NIF.
Current section
Files
Jump to
Current section
Files
c_src/fit_sdk/cpp/fit_activity_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_ACTIVITY_MESG_HPP)
#define FIT_ACTIVITY_MESG_HPP
#include "fit_mesg.hpp"
#include "fit_mesg_with_event.hpp"
namespace fit
{
class ActivityMesg : public Mesg, public MesgWithEvent
{
public:
class FieldDefNum final
{
public:
static const FIT_UINT8 Timestamp = 253;
static const FIT_UINT8 TotalTimerTime = 0;
static const FIT_UINT8 NumSessions = 1;
static const FIT_UINT8 Type = 2;
static const FIT_UINT8 Event = 3;
static const FIT_UINT8 EventType = 4;
static const FIT_UINT8 LocalTimestamp = 5;
static const FIT_UINT8 EventGroup = 6;
static const FIT_UINT8 Invalid = FIT_FIELD_NUM_INVALID;
};
ActivityMesg(void) : Mesg(Profile::MESG_ACTIVITY)
{
}
ActivityMesg(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
///////////////////////////////////////////////////////////////////////
FIT_DATE_TIME GetTimestamp(void) const
{
return GetFieldUINT32Value(253, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set timestamp field
///////////////////////////////////////////////////////////////////////
void SetTimestamp(FIT_DATE_TIME timestamp)
{
SetFieldUINT32Value(253, timestamp, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of total_timer_time field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsTotalTimerTimeValid() const
{
const Field* field = GetField(0);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns total_timer_time field
// Units: s
// Comment: Exclude pauses
///////////////////////////////////////////////////////////////////////
FIT_FLOAT32 GetTotalTimerTime(void) const
{
return GetFieldFLOAT32Value(0, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set total_timer_time field
// Units: s
// Comment: Exclude pauses
///////////////////////////////////////////////////////////////////////
void SetTotalTimerTime(FIT_FLOAT32 totalTimerTime)
{
SetFieldFLOAT32Value(0, totalTimerTime, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of num_sessions field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsNumSessionsValid() const
{
const Field* field = GetField(1);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns num_sessions field
///////////////////////////////////////////////////////////////////////
FIT_UINT16 GetNumSessions(void) const
{
return GetFieldUINT16Value(1, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set num_sessions field
///////////////////////////////////////////////////////////////////////
void SetNumSessions(FIT_UINT16 numSessions)
{
SetFieldUINT16Value(1, numSessions, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of type field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsTypeValid() const
{
const Field* field = GetField(2);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns type field
///////////////////////////////////////////////////////////////////////
FIT_ACTIVITY GetType(void) const
{
return GetFieldENUMValue(2, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set type field
///////////////////////////////////////////////////////////////////////
void SetType(FIT_ACTIVITY type)
{
SetFieldENUMValue(2, type, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of event field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsEventValid() const
{
const Field* field = GetField(3);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns event field
///////////////////////////////////////////////////////////////////////
FIT_EVENT GetEvent(void) const
{
return GetFieldENUMValue(3, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set event field
///////////////////////////////////////////////////////////////////////
void SetEvent(FIT_EVENT event)
{
SetFieldENUMValue(3, event, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of event_type field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsEventTypeValid() const
{
const Field* field = GetField(4);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns event_type field
///////////////////////////////////////////////////////////////////////
FIT_EVENT_TYPE GetEventType(void) const
{
return GetFieldENUMValue(4, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set event_type field
///////////////////////////////////////////////////////////////////////
void SetEventType(FIT_EVENT_TYPE eventType)
{
SetFieldENUMValue(4, eventType, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of local_timestamp field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsLocalTimestampValid() const
{
const Field* field = GetField(5);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns local_timestamp field
// Comment: timestamp epoch expressed in local time, used to convert activity timestamps to local time
///////////////////////////////////////////////////////////////////////
FIT_LOCAL_DATE_TIME GetLocalTimestamp(void) const
{
return GetFieldUINT32Value(5, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set local_timestamp field
// Comment: timestamp epoch expressed in local time, used to convert activity timestamps to local time
///////////////////////////////////////////////////////////////////////
void SetLocalTimestamp(FIT_LOCAL_DATE_TIME localTimestamp)
{
SetFieldUINT32Value(5, localTimestamp, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Checks the validity of event_group field
// Returns FIT_TRUE if field is valid
///////////////////////////////////////////////////////////////////////
FIT_BOOL IsEventGroupValid() const
{
const Field* field = GetField(6);
if( FIT_NULL == field )
{
return FIT_FALSE;
}
return field->IsValueValid();
}
///////////////////////////////////////////////////////////////////////
// Returns event_group field
///////////////////////////////////////////////////////////////////////
FIT_UINT8 GetEventGroup(void) const
{
return GetFieldUINT8Value(6, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
///////////////////////////////////////////////////////////////////////
// Set event_group field
///////////////////////////////////////////////////////////////////////
void SetEventGroup(FIT_UINT8 eventGroup)
{
SetFieldUINT8Value(6, eventGroup, 0, FIT_SUBFIELD_INDEX_MAIN_FIELD);
}
};
} // namespace fit
#endif // !defined(FIT_ACTIVITY_MESG_HPP)