Skip to content

Commit

Permalink
add polar fit mapping, garmin devices update
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Pohl committed Jun 3, 2022
1 parent 45cc7dc commit 16fbb6e
Show file tree
Hide file tree
Showing 11 changed files with 306 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Device/DeviceProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -1649,4 +1649,25 @@ class DeviceProfile extends AbstractEnum

/** @var int */
const GARMIN_VIVO_SMART_5 = 542;

/** @var int */
const GARMIN_DESCENT_G_1 = 543;

/** @var int */
const GARMIN_FORERUNNER_225_S_MUSIC = 544;

/** @var int */
const GARMIN_FORERUNNER_225_MUSIC = 545;

/** @var int */
const GARMIN_VIVO_MOVE_SPORT = 546;

/** @var int */
const GARMIN_INSTINCT_2_S = 547;

/** @var int */
const GARMIN_FORERUNNER_955 = 548;

/** @var int */
const GARMIN_FORERUNNER_955_SOLAR = 549;
}
32 changes: 32 additions & 0 deletions src/Device/GarminDescentG1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Runalyze Device List.
*
* (c) RUNALYZE <mail@runalyze.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Runalyze\Devices\Device;

class GarminDescentG1 extends AbstractDevice
{
use GarminDeviceTrait;

public function getEnum()
{
return DeviceProfile::GARMIN_DESCENT_G_1;
}

public function getName()
{
return 'Descent G1';
}

public function hasBarometer()
{
return true;
}
}
27 changes: 27 additions & 0 deletions src/Device/GarminForerunner225Music.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/*
* This file is part of the Runalyze Device List.
*
* (c) RUNALYZE <mail@runalyze.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Runalyze\Devices\Device;

class GarminForerunner225Music extends AbstractDevice
{
use GarminDeviceTrait;

public function getEnum()
{
return DeviceProfile::GARMIN_FORERUNNER_225_MUSIC;
}

public function getName()
{
return 'Forerunner 225 Music';
}
}
27 changes: 27 additions & 0 deletions src/Device/GarminForerunner225SMusic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/*
* This file is part of the Runalyze Device List.
*
* (c) RUNALYZE <mail@runalyze.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Runalyze\Devices\Device;

class GarminForerunner225SMusic extends AbstractDevice
{
use GarminDeviceTrait;

public function getEnum()
{
return DeviceProfile::GARMIN_FORERUNNER_225_S_MUSIC;
}

public function getName()
{
return 'Forerunner 225S Music';
}
}
32 changes: 32 additions & 0 deletions src/Device/GarminForerunner955.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Runalyze Device List.
*
* (c) RUNALYZE <mail@runalyze.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Runalyze\Devices\Device;

class GarminForerunner955 extends AbstractDevice
{
use GarminDeviceTrait;

public function getEnum()
{
return DeviceProfile::GARMIN_FORERUNNER_955;
}

public function getName()
{
return 'Forerunner 955';
}

public function hasBarometer()
{
return true;
}
}
32 changes: 32 additions & 0 deletions src/Device/GarminForerunner955Solar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Runalyze Device List.
*
* (c) RUNALYZE <mail@runalyze.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Runalyze\Devices\Device;

class GarminForerunner955Solar extends AbstractDevice
{
use GarminDeviceTrait;

public function getEnum()
{
return DeviceProfile::GARMIN_FORERUNNER_955_SOLAR;
}

public function getName()
{
return 'Forerunner 955 Solar';
}

public function hasBarometer()
{
return true;
}
}
32 changes: 32 additions & 0 deletions src/Device/GarminInstinct2S.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Runalyze Device List.
*
* (c) RUNALYZE <mail@runalyze.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Runalyze\Devices\Device;

class GarminInstinct2S extends AbstractDevice
{
use GarminDeviceTrait;

public function getEnum()
{
return DeviceProfile::GARMIN_INSTINCT_2_S;
}

public function getName()
{
return 'Instinct 2S';
}

public function hasBarometer()
{
return false;
}
}
32 changes: 32 additions & 0 deletions src/Device/GarminVivoMoveSport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Runalyze Device List.
*
* (c) RUNALYZE <mail@runalyze.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Runalyze\Devices\Device;

class GarminVivoMoveSport extends AbstractDevice
{
use GarminDeviceTrait;

public function getEnum()
{
return DeviceProfile::GARMIN_VIVO_MOVE_SPORT;
}

public function getName()
{
return 'vívomove Sport';
}

public function hasBarometer()
{
return true;
}
}
3 changes: 3 additions & 0 deletions src/Mapping/FitMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public static function guessDevice($manufactorId, $productId)
case 505:
return DeviceProfile::MIO_UNKNOWN;
break;
case 123:
return (new PolarFitSdkMapping())->toInternal($productId);
break;
case 309:
return DeviceProfile::FORM_SMART_SWIM_GOGGLES;
break;
Expand Down
9 changes: 9 additions & 0 deletions src/Mapping/GarminFitSdkMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ protected function getMapping()
3930 => DeviceProfile::GARMIN_DESCENT_MK_2_S,
3258 => DeviceProfile::GARMIN_DESCENT_MK_2_I,
3702 => DeviceProfile::GARMIN_DESCENT_MK_2_I,
4005 => DeviceProfile::GARMIN_DESCENT_G_1,
2187 => DeviceProfile::GARMIN_D_2_AIR,
3198 => DeviceProfile::GARMIN_D_2_DELTA_P_X,
2262 => DeviceProfile::GARMIN_D_2_BRAVO,
Expand Down Expand Up @@ -108,6 +109,7 @@ protected function getMapping()
2332 => DeviceProfile::GARMIN_EPIX,
2457 => DeviceProfile::GARMIN_EPIX,
3943 => DeviceProfile::GARMIN_EPIX_2,
3944 => DeviceProfile::GARMIN_EPIX_2,
2140 => DeviceProfile::GARMIN_ETREX_TOUCH,
1551 => DeviceProfile::GARMIN_FENIX,
1967 => DeviceProfile::GARMIN_FENIX_2,
Expand All @@ -127,6 +129,7 @@ protected function getMapping()
2476 => DeviceProfile::GARMIN_FENIX_3_H_R,
2477 => DeviceProfile::GARMIN_FENIX_3_H_R,
2697 => DeviceProfile::GARMIN_FENIX_5,
4125 => DeviceProfile::GARMIN_FENIX_5,
4135 => DeviceProfile::GARMIN_FENIX_5,
3110 => DeviceProfile::GARMIN_FENIX_5_PLUS,
3909 => DeviceProfile::GARMIN_FENIX_5_PLUS,
Expand Down Expand Up @@ -166,6 +169,7 @@ protected function getMapping()
3907 => DeviceProfile::GARMIN_FENIX_7_X_SAPPHIRE_SOLAR,
3976 => DeviceProfile::GARMIN_FENIX_7_X_SAPPHIRE_SOLAR,
3905 => DeviceProfile::GARMIN_FENIX_7_S_SAPPHIRE_SOLAR,
3908 => DeviceProfile::GARMIN_FENIX_7_S_SAPPHIRE_SOLAR,
1482 => DeviceProfile::GARMIN_FORERUNNER_10,
1688 => DeviceProfile::GARMIN_FORERUNNER_10,
1903 => DeviceProfile::GARMIN_FORERUNNER_15,
Expand Down Expand Up @@ -197,6 +201,8 @@ protected function getMapping()
2174 => DeviceProfile::GARMIN_FORERUNNER_220,
2153 => DeviceProfile::GARMIN_FORERUNNER_225,
2219 => DeviceProfile::GARMIN_FORERUNNER_225,
3990 => DeviceProfile::GARMIN_FORERUNNER_225_MUSIC,
3991 => DeviceProfile::GARMIN_FORERUNNER_225_S_MUSIC,
2313 => DeviceProfile::GARMIN_FORERUNNER_230,
2157 => DeviceProfile::GARMIN_FORERUNNER_230,
2431 => DeviceProfile::GARMIN_FORERUNNER_235,
Expand Down Expand Up @@ -256,6 +262,7 @@ protected function getMapping()
3910 => DeviceProfile::GARMIN_FORERUNNER_945,
3652 => DeviceProfile::GARMIN_FORERUNNER_945_LTE,
3126 => DeviceProfile::GARMIN_INSTINCT,
3889 => DeviceProfile::GARMIN_INSTINCT_2_S,
3466 => DeviceProfile::GARMIN_INSTINCT_SOLAR,
3778 => DeviceProfile::GARMIN_INSTINCT_SOLAR,
3498 => DeviceProfile::GARMIN_LEGACY_SAGA_REY,
Expand Down Expand Up @@ -323,6 +330,7 @@ protected function getMapping()
2945 => DeviceProfile::GARMIN_VIVO_MOVE_H_R,
3378 => DeviceProfile::GARMIN_VIVO_MOVE_3_S,
3308 => DeviceProfile::GARMIN_VIVO_MOVE_LUXE,
3982 => DeviceProfile::GARMIN_VIVO_MOVE_SPORT,
3572 => DeviceProfile::GARMIN_VIVO_LUXE,
2623 => DeviceProfile::GARMIN_VIVO_SPORT,
2832 => DeviceProfile::GARMIN_VIVO_SPORT,
Expand All @@ -334,6 +342,7 @@ protected function getMapping()
2622 => DeviceProfile::GARMIN_VIVO_SMART_3,
2927 => DeviceProfile::GARMIN_VIVO_SMART_4,
3218 => DeviceProfile::GARMIN_VIVO_SMART_4,
4063 => DeviceProfile::GARMIN_VIVO_SMART_5,
2347 => DeviceProfile::GARMIN_VIVO_SMART_GPS_H_R,
2362 => DeviceProfile::GARMIN_VIVO_SMART_GPS_H_R,
2348 => DeviceProfile::GARMIN_VIVO_SMART_H_R,
Expand Down
59 changes: 59 additions & 0 deletions src/Mapping/PolarFitSdkMapping.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

/*
* This file is part of the Runalyze Device List.
*
* (c) RUNALYZE <mail@runalyze.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Runalyze\Devices\Mapping;

use Runalyze\Devices\Device\DeviceProfile;

class PolarFitSdkMapping
{
/** @var int[]|string[] */
protected $Mapping = [];

protected function getMapping()
{
return [
13 => DeviceProfile::POLAR_V_800,
22 => DeviceProfile::POLAR_M_400,
151 => DeviceProfile::POLAR_O_H_1,
163 => DeviceProfile::POLAR_M_430,
172 => DeviceProfile::POLAR_M_460,
203 => DeviceProfile::POLAR_VANTAGE_V,
209 => DeviceProfile::POLAR_VANTAGE_M,
217 => DeviceProfile::POLAR_GRIT_X,
225 => DeviceProfile::POLAR_UNITE,
230 => DeviceProfile::POLAR_VANTAGE_V_2,
235 => DeviceProfile::POLAR_VERITY_SENSE,
236 => DeviceProfile::POLAR_VANTAGE_M_2,
241 => DeviceProfile::POLAR_IGNITE_2,
251 => DeviceProfile::POLAR_GRIT_X_PRO,
261 => DeviceProfile::POLAR_PACER_PRO,
];
}

public function __construct()
{
$this->Mapping = $this->getMapping();
}

/**
* @param int|string $value
* @return int|string
*/
public function toInternal($value)
{
if (isset($this->Mapping[$value])) {
return $this->Mapping[$value];
}

return;
}
}

0 comments on commit 16fbb6e

Please sign in to comment.