-
Notifications
You must be signed in to change notification settings - Fork 1
/
TourData.cpp
109 lines (99 loc) · 2.86 KB
/
TourData.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "TourData.h"
TourData::TourData()
{
reset();
}
void TourData::reset()
{
m_tourTimeStamp.clear();
m_tourDistance.clear();
m_tourBatterySoc.clear();
m_tourSpeed.clear();
m_tourCadence.clear();
m_tourAltitude.clear();
m_tourGpsAccuracy.clear();
m_tourTemperature.clear();
m_tourGrade.clear();
m_tourPosLat.clear();
m_tourPosLong.clear();
m_tourHeartRate.clear();
m_tourCalories.clear();
m_tourPower.clear();
m_tourLRBalance.clear();
m_altCorrectionDone = false;
m_posCorrectionDone = false;
m_tempCorrectionDone = false;
m_battCorrectionDone = false;
m_gradeCorrectionDone = false;
m_caloriesCorrectionDone = false;
m_heartRateCorrectionDone = false;
m_firstPosRead = false;
m_posRead = false;
m_gearTimeStamp.clear();
m_gearDistance.clear();
m_gearNumFront.clear();
m_gearToothFront.clear();
m_gearNumRear.clear();
m_gearToothRear.clear();
m_gearRatio.clear();
m_gearInfoRear = false;
m_gearInfoFront = false;
m_gearCountFront = 0;
m_gearCountRear = 0;
m_session.totalElapsedTime = 0;
m_session.totalTimerTime = 0;
m_session.avgSpeed = 0;
m_session.maxSpeed = 0;
m_session.totalDistance = 0;
m_session.avgCadence = 0;
m_session.maxCadence = 0;
m_session.ascent = 0;
m_session.descent = 0;
m_session.altitudeMax = 0;
m_session.altitudeMin = 0;
m_session.avgTemperature = 0;
m_session.maxTemperature = 0;
m_session.minTemperature = 9999;
m_session.startTime = 0;
m_session.startDistance = 0;
m_session.maxGrade = 0;
m_session.minGrade = 0;
m_session.minHeartRate = 0;
m_session.avgHeartRate = 0;
m_session.maxHeartRate = 0;
for( int i = 0; i < 5; i++ ) m_session.hrTimeInZone[i] = 0.0;
for( int i = 0; i < 8; i++ ) m_session.pwrTimeInZone[i] = 0.0;
m_session.avgPower = 0;
m_session.maxPower = 0;
m_session.leftRightBalance = 0;
m_session.totalWork = 0;
m_session.totalCalories = 0;
m_session.normalizedPower = 0;
m_session.thresholdPower = 0;
m_session.trainingStressScore = 0;
m_session.itensityFactor = 0;
m_altCorrectionDone = false;
for( int i = 0; i < 5; i++ ) m_hrZoneHigh[i] = 0.0;
for( int i = 0; i < 8; i++ ) m_pwrZoneHigh[i] = 0.0;
m_deviceInfo.clear();
m_sections.clear();
m_workoutName.clear();
}
bool TourData::deviceIdIsIncluded(deviceInfo_t a)
{
foreach( deviceInfo_t deviceInfo, m_deviceInfo )
{
if( deviceInfo.deviceId == a.deviceId ) return true;
if( deviceInfo.name == a.name ) return true;
}
return false;
}
int TourData::deviceIdInVectorAt(deviceInfo_t a)
{
for( int i = 0; i < m_deviceInfo.size(); i++ )
{
if( m_deviceInfo.at( i ).deviceId == a.deviceId ) return i;
if( m_deviceInfo.at( i ).name == a.name ) return i;
}
return -1;
}