1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Runalyze Device List. |
5
|
|
|
* |
6
|
|
|
* (c) RUNALYZE <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Runalyze\Devices\Mapping; |
13
|
|
|
|
14
|
|
|
use Runalyze\Devices\Device\DeviceProfile; |
15
|
|
|
|
16
|
|
|
class FitSdkMapping |
17
|
|
|
{ |
18
|
|
|
/** @var int[]|string[] */ |
19
|
|
|
protected $Mapping = []; |
20
|
|
|
|
21
|
1 |
|
protected function getMapping() |
22
|
|
|
{ |
23
|
|
|
return $Mapping = [ |
|
|
|
|
24
|
1 |
|
2266 => DeviceProfile::GARMIN_APPROACH_S_20, |
25
|
1 |
|
1936 => DeviceProfile::GARMIN_APPROACH_S_6, |
26
|
1 |
|
2262 => DeviceProfile::GARMIN_D_2_BRAVO, |
27
|
1 |
|
2547 => DeviceProfile::GARMIN_D_2_BRAVO_TITANIUM, |
28
|
1 |
|
2530 => DeviceProfile::GARMIN_EDGE_820, |
29
|
1 |
|
2204 => DeviceProfile::GARMIN_EDGE_EXPLORE_1000, |
30
|
1 |
|
2531 => DeviceProfile::GARMIN_EDGE_EXPLORE_820, |
31
|
1 |
|
1736 => DeviceProfile::GARMIN_EDGE_TOURING, |
32
|
1 |
|
1836 => DeviceProfile::GARMIN_EDGE_1000, |
33
|
1 |
|
2070 => DeviceProfile::GARMIN_EDGE_1000, |
34
|
1 |
|
2053 => DeviceProfile::GARMIN_EDGE_1000, |
35
|
1 |
|
2100 => DeviceProfile::GARMIN_EDGE_1000, |
36
|
1 |
|
2052 => DeviceProfile::GARMIN_EDGE_1000, |
37
|
1 |
|
2238 => DeviceProfile::GARMIN_EDGE_20, |
38
|
1 |
|
1325 => DeviceProfile::GARMIN_EDGE_200, |
39
|
1 |
|
1555 => DeviceProfile::GARMIN_EDGE_200, |
40
|
1 |
|
2147 => DeviceProfile::GARMIN_EDGE_25, |
41
|
1 |
|
1036 => DeviceProfile::GARMIN_EDGE_500, |
42
|
1 |
|
1387 => DeviceProfile::GARMIN_EDGE_500, |
43
|
1 |
|
1213 => DeviceProfile::GARMIN_EDGE_500, |
44
|
1 |
|
1422 => DeviceProfile::GARMIN_EDGE_500, |
45
|
1 |
|
1199 => DeviceProfile::GARMIN_EDGE_500, |
46
|
1 |
|
1561 => DeviceProfile::GARMIN_EDGE_510, |
47
|
1 |
|
1821 => DeviceProfile::GARMIN_EDGE_510, |
48
|
1 |
|
1742 => DeviceProfile::GARMIN_EDGE_510, |
49
|
1 |
|
1918 => DeviceProfile::GARMIN_EDGE_510, |
50
|
1 |
|
2067 => DeviceProfile::GARMIN_EDGE_520, |
51
|
1 |
|
1169 => DeviceProfile::GARMIN_EDGE_800, |
52
|
1 |
|
1386 => DeviceProfile::GARMIN_EDGE_800, |
53
|
1 |
|
1334 => DeviceProfile::GARMIN_EDGE_800, |
54
|
1 |
|
1497 => DeviceProfile::GARMIN_EDGE_800, |
55
|
1 |
|
1333 => DeviceProfile::GARMIN_EDGE_800, |
56
|
1 |
|
1567 => DeviceProfile::GARMIN_EDGE_810, |
57
|
1 |
|
1822 => DeviceProfile::GARMIN_EDGE_810, |
58
|
1 |
|
1721 => DeviceProfile::GARMIN_EDGE_810, |
59
|
1 |
|
1823 => DeviceProfile::GARMIN_EDGE_810, |
60
|
1 |
|
1988 => DeviceProfile::GARMIN_EPIX, |
61
|
1 |
|
2140 => DeviceProfile::GARMIN_ETREX_TOUCH, |
62
|
1 |
|
1551 => DeviceProfile::GARMIN_FENIX, |
63
|
1 |
|
1967 => DeviceProfile::GARMIN_FENIX_2, |
64
|
1 |
|
2050 => DeviceProfile::GARMIN_FENIX_3, |
65
|
1 |
|
2188 => DeviceProfile::GARMIN_FENIX_3, |
66
|
1 |
|
2189 => DeviceProfile::GARMIN_FENIX_3, |
67
|
1 |
|
2432 => DeviceProfile::GARMIN_FENIX_3, |
68
|
1 |
|
2413 => DeviceProfile::GARMIN_FENIX_3_H_R, |
69
|
1 |
|
2697 => DeviceProfile::GARMIN_FENIX_5, |
70
|
1 |
|
2544 => DeviceProfile::GARMIN_FENIX_5_S, |
71
|
1 |
|
2604 => DeviceProfile::GARMIN_FENIX_5_X, |
72
|
1 |
|
1482 => DeviceProfile::GARMIN_FORERUNNER_10, |
73
|
1 |
|
1688 => DeviceProfile::GARMIN_FORERUNNER_10, |
74
|
1 |
|
1124 => DeviceProfile::GARMIN_FORERUNNER_110, |
75
|
1 |
|
1274 => DeviceProfile::GARMIN_FORERUNNER_110, |
76
|
1 |
|
1903 => DeviceProfile::GARMIN_FORERUNNER_15, |
77
|
1 |
|
2061 => DeviceProfile::GARMIN_FORERUNNER_15, |
78
|
1 |
|
1360 => DeviceProfile::GARMIN_FORERUNNER_210, |
79
|
1 |
|
1631 => DeviceProfile::GARMIN_FORERUNNER_220, |
80
|
1 |
|
1931 => DeviceProfile::GARMIN_FORERUNNER_220, |
81
|
1 |
|
1930 => DeviceProfile::GARMIN_FORERUNNER_220, |
82
|
1 |
|
2073 => DeviceProfile::GARMIN_FORERUNNER_220, |
83
|
1 |
|
2174 => DeviceProfile::GARMIN_FORERUNNER_220, |
84
|
1 |
|
2153 => DeviceProfile::GARMIN_FORERUNNER_225, |
85
|
1 |
|
2219 => DeviceProfile::GARMIN_FORERUNNER_225, |
86
|
1 |
|
14 => DeviceProfile::GARMIN_FORERUNNER_225, |
87
|
1 |
|
2157 => DeviceProfile::GARMIN_FORERUNNER_230, |
88
|
1 |
|
2431 => DeviceProfile::GARMIN_FORERUNNER_235, |
89
|
1 |
|
2148 => DeviceProfile::GARMIN_FORERUNNER_25, |
90
|
1 |
|
473 => DeviceProfile::GARMIN_FORERUNNER_301, |
91
|
1 |
|
474 => DeviceProfile::GARMIN_FORERUNNER_301, |
92
|
1 |
|
475 => DeviceProfile::GARMIN_FORERUNNER_301, |
93
|
1 |
|
494 => DeviceProfile::GARMIN_FORERUNNER_301, |
94
|
1 |
|
1018 => DeviceProfile::GARMIN_FORERUNNER_310_X_T, |
95
|
1 |
|
1446 => DeviceProfile::GARMIN_FORERUNNER_310_X_T, |
96
|
1 |
|
717 => DeviceProfile::GARMIN_FORERUNNER_405, |
97
|
1 |
|
987 => DeviceProfile::GARMIN_FORERUNNER_405, |
98
|
1 |
|
782 => DeviceProfile::GARMIN_FORERUNNER_50, |
99
|
1 |
|
988 => DeviceProfile::GARMIN_FORERUNNER_60, |
100
|
1 |
|
1345 => DeviceProfile::GARMIN_FORERUNNER_610, |
101
|
1 |
|
1410 => DeviceProfile::GARMIN_FORERUNNER_610, |
102
|
1 |
|
1623 => DeviceProfile::GARMIN_FORERUNNER_620, |
103
|
1 |
|
1929 => DeviceProfile::GARMIN_FORERUNNER_620, |
104
|
1 |
|
1928 => DeviceProfile::GARMIN_FORERUNNER_620, |
105
|
1 |
|
2072 => DeviceProfile::GARMIN_FORERUNNER_620, |
106
|
1 |
|
2173 => DeviceProfile::GARMIN_FORERUNNER_620, |
107
|
1 |
|
2156 => DeviceProfile::GARMIN_FORERUNNER_630, |
108
|
1 |
|
1436 => DeviceProfile::GARMIN_FORERUNNER_70, |
109
|
1 |
|
1328 => DeviceProfile::GARMIN_FORERUNNER_910_X_T, |
110
|
1 |
|
1537 => DeviceProfile::GARMIN_FORERUNNER_910_X_T, |
111
|
1 |
|
1600 => DeviceProfile::GARMIN_FORERUNNER_910_X_T, |
112
|
1 |
|
1664 => DeviceProfile::GARMIN_FORERUNNER_910_X_T, |
113
|
1 |
|
1765 => DeviceProfile::GARMIN_FORERUNNER_920_X_T, |
114
|
1 |
|
2131 => DeviceProfile::GARMIN_FORERUNNER_920_X_T, |
115
|
1 |
|
2132 => DeviceProfile::GARMIN_FORERUNNER_920_X_T, |
116
|
1 |
|
2130 => DeviceProfile::GARMIN_FORERUNNER_920_X_T, |
117
|
1 |
|
2691 => DeviceProfile::GARMIN_FORERUNNER_935_X_T, |
118
|
1 |
|
1499 => DeviceProfile::GARMIN_SWIM, |
119
|
1 |
|
1907 => DeviceProfile::GARMIN_VIVO_ACTIVE, |
120
|
1 |
|
2160 => DeviceProfile::GARMIN_VIVO_ACTIVE, |
121
|
1 |
|
2337 => DeviceProfile::GARMIN_VIVO_ACTIVE_H_R, |
122
|
1 |
|
1837 => DeviceProfile::GARMIN_VIVO_FIT, |
123
|
1 |
|
2606 => DeviceProfile::GARMIN_VIVO_FIT_JR, |
124
|
1 |
|
2150 => DeviceProfile::GARMIN_VIVO_FIT_2, |
125
|
1 |
|
2406 => DeviceProfile::GARMIN_VIVO_FIT_3, |
126
|
1 |
|
2368 => DeviceProfile::GARMIN_VIVO_MOVE, |
127
|
1 |
|
1956 => DeviceProfile::GARMIN_VIVO_SMART, |
128
|
1 |
|
2135 => DeviceProfile::GARMIN_VIVO_SMART, |
129
|
1 |
|
2347 => DeviceProfile::GARMIN_VIVO_SMART_GPS_H_R, |
130
|
1 |
|
2348 => DeviceProfile::GARMIN_VIVO_SMART_H_R, |
131
|
1 |
|
]; |
132
|
|
|
} |
133
|
|
|
|
134
|
1 |
|
public function __construct() |
135
|
|
|
{ |
136
|
1 |
|
$this->Mapping = $this->getMapping(); |
|
|
|
|
137
|
1 |
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param int|string $value |
141
|
|
|
* @return int|string |
142
|
|
|
*/ |
143
|
1 |
|
public function toInternal($value) |
144
|
|
|
{ |
145
|
1 |
|
if (isset($this->Mapping[$value])) { |
146
|
1 |
|
return $this->Mapping[$value]; |
147
|
|
|
} |
148
|
|
|
|
149
|
1 |
|
return null; |
150
|
|
|
} |
151
|
|
|
} |
152
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.