2020-01-09 10:44:32 +01:00
|
|
|
/* Copyright (C) 2015-2020 Andreas Böhler, Andreas Shimokawa, Carsten
|
2019-12-15 22:07:00 +01:00
|
|
|
Pfeiffer, Cre3per, Daniel Dakhno, Daniele Gobbetti, Gordon Williams,
|
|
|
|
Jean-François Greffier, João Paulo Barraca, José Rebelo, Kranz, ladbsoft,
|
2020-01-09 10:44:32 +01:00
|
|
|
Manuel Ruß, maxirnilian, Pavel, Pavel Elagin, protomors, Quallenauge,
|
|
|
|
Sami Alaoui, Sebastian Kranz, Sophanimus, tiparega, Vadim Kaushan
|
2017-03-10 14:53:19 +01:00
|
|
|
|
|
|
|
This file is part of Gadgetbridge.
|
|
|
|
|
|
|
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Gadgetbridge is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2015-08-03 23:09:49 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.model;
|
2015-05-05 00:48:02 +02:00
|
|
|
|
2019-01-26 15:52:40 +01:00
|
|
|
import androidx.annotation.DrawableRes;
|
|
|
|
import androidx.annotation.StringRes;
|
2020-10-27 12:56:27 +01:00
|
|
|
|
2017-02-26 22:46:49 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
|
|
|
|
2015-10-26 23:32:03 +01:00
|
|
|
/**
|
|
|
|
* For every supported device, a device type constant must exist.
|
2016-08-17 00:34:19 +02:00
|
|
|
*
|
|
|
|
* Note: they key of every constant is stored in the DB, so it is fixed forever,
|
|
|
|
* and may not be changed.
|
2015-10-26 23:32:03 +01:00
|
|
|
*/
|
2015-05-05 00:48:02 +02:00
|
|
|
public enum DeviceType {
|
2021-12-23 18:28:02 +01:00
|
|
|
UNKNOWN(-1, R.drawable.ic_device_unknown, R.drawable.ic_device_unknown_disabled, R.string.devicetype_unknown),
|
2017-12-11 23:36:39 +01:00
|
|
|
PEBBLE(1, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled, R.string.devicetype_pebble),
|
|
|
|
MIBAND(10, R.drawable.ic_device_miband, R.drawable.ic_device_miband_disabled, R.string.devicetype_miband),
|
2018-08-08 15:06:44 +02:00
|
|
|
MIBAND2(11, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband2),
|
2020-07-09 13:55:18 +02:00
|
|
|
AMAZFITBIP(12, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_bip),
|
2017-12-11 23:36:39 +01:00
|
|
|
AMAZFITCOR(13, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_amazfit_cor),
|
2018-08-08 15:06:44 +02:00
|
|
|
MIBAND3(14, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband3),
|
2019-05-09 12:42:59 +02:00
|
|
|
AMAZFITCOR2(15, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_amazfit_cor2),
|
2019-06-23 22:39:45 +02:00
|
|
|
MIBAND4(16, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband4),
|
2020-07-09 13:55:18 +02:00
|
|
|
AMAZFITBIP_LITE(17, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_bip_lite),
|
2020-05-02 23:38:58 +02:00
|
|
|
AMAZFITGTR(18, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_amazfit_gtr),
|
2020-07-09 13:55:18 +02:00
|
|
|
AMAZFITGTS(19, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_gts),
|
|
|
|
AMAZFITBIPS(20, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_bips),
|
2020-05-02 23:38:58 +02:00
|
|
|
AMAZFITGTR_LITE(21, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_amazfit_gtr),
|
2020-06-24 17:43:23 +02:00
|
|
|
AMAZFITTREX(22, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_amazfit_trex),
|
2020-07-28 18:16:56 +02:00
|
|
|
MIBAND5(23, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband5),
|
2020-10-17 11:58:22 +02:00
|
|
|
AMAZFITBAND5(24, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_amazfit_band5),
|
2020-10-27 12:56:27 +01:00
|
|
|
AMAZFITBIPS_LITE(25, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_bips_lite),
|
2020-11-15 16:25:47 +01:00
|
|
|
AMAZFITGTR2(26, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_amazfit_gtr2),
|
|
|
|
AMAZFITGTS2(27, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_gts2),
|
2020-11-30 17:09:29 +01:00
|
|
|
AMAZFITBIPU(28, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_bipu),
|
2021-01-06 10:17:15 +01:00
|
|
|
AMAZFITVERGEL(29, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_vergel),
|
|
|
|
AMAZFITBIPUPRO(30, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_bipu),
|
2021-01-20 16:03:58 +01:00
|
|
|
AMAZFITNEO(31, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_neo),
|
2021-01-26 23:30:43 +01:00
|
|
|
AMAZFITGTS2_MINI(32, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled, R.string.devicetype_amazfit_gts2_mini),
|
2021-01-31 22:41:01 +01:00
|
|
|
ZEPP_E(33, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_zepp_e),
|
2021-02-02 23:06:11 +01:00
|
|
|
AMAZFITGTR2E(34, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_amazfit_gtr2e),
|
2021-02-08 00:06:11 +01:00
|
|
|
AMAZFITGTS2E(35, R.drawable.ic_device_amazfit_bip, R.drawable.ic_device_amazfit_bip_disabled,R.string .devicetype_amazfit_gts2e),
|
|
|
|
AMAZFITX(36, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_amazfit_x),
|
2021-05-09 22:52:36 +02:00
|
|
|
MIBAND6(37, R.drawable.ic_device_miband2, R.drawable.ic_device_miband2_disabled, R.string.devicetype_miband6),
|
2021-06-12 21:19:16 +02:00
|
|
|
AMAZFITTREXPRO(38, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_amazfit_trex_pro),
|
2017-12-11 23:36:39 +01:00
|
|
|
HPLUS(40, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_hplus),
|
|
|
|
MAKIBESF68(41, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_makibes_f68),
|
|
|
|
EXRIZUK8(42, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_exrizu_k8),
|
2018-05-20 19:15:22 +02:00
|
|
|
Q8(43, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_q8),
|
2020-08-27 02:17:17 +02:00
|
|
|
SG2(44, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_sg2),
|
2017-12-11 23:36:39 +01:00
|
|
|
NO1F1(50, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_no1_f1),
|
|
|
|
TECLASTH30(60, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled, R.string.devicetype_teclast_h30),
|
2020-01-04 20:54:46 +01:00
|
|
|
Y5(61, R.drawable.ic_device_h30_h10, R.drawable.ic_device_roidmi_disabled, R.string.devicetype_y5),
|
2018-02-25 12:05:36 +01:00
|
|
|
XWATCH(70, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_xwatch),
|
2018-09-07 13:24:54 +02:00
|
|
|
ZETIME(80, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_mykronoz_zetime),
|
2018-07-14 23:53:47 +02:00
|
|
|
ID115(90, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled, R.string.devicetype_id115),
|
2018-08-05 18:52:44 +02:00
|
|
|
WATCH9(100, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_watch9),
|
2019-11-02 21:24:00 +01:00
|
|
|
WATCHX(101, R.drawable.ic_device_watchxplus, R.drawable.ic_device_watchxplus_disabled, R.string.devicetype_watchx),
|
|
|
|
WATCHXPLUS(102, R.drawable.ic_device_watchxplus, R.drawable.ic_device_watchxplus_disabled, R.string.devicetype_watchxplus),
|
2018-09-01 14:20:38 +02:00
|
|
|
ROIDMI(110, R.drawable.ic_device_roidmi, R.drawable.ic_device_roidmi_disabled, R.string.devicetype_roidmi),
|
|
|
|
ROIDMI3(112, R.drawable.ic_device_roidmi, R.drawable.ic_device_roidmi_disabled, R.string.devicetype_roidmi3),
|
2018-12-28 13:27:03 +01:00
|
|
|
CASIOGB6900(120, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogb6900),
|
2020-11-14 23:15:14 +01:00
|
|
|
CASIOGBX100(121, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogbx100),
|
2020-02-03 19:05:18 +01:00
|
|
|
MISCALE2(131, R.drawable.ic_device_miscale2, R.drawable.ic_device_miscale2_disabled, R.string.devicetype_miscale2),
|
2019-04-02 22:32:16 +02:00
|
|
|
BFH16(140, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_bfh16),
|
2019-10-02 22:57:31 +02:00
|
|
|
MAKIBESHR3(150, R.drawable.ic_device_default, R.drawable.ic_device_hplus_disabled, R.string.devicetype_makibes_hr3),
|
2019-12-15 00:11:21 +01:00
|
|
|
BANGLEJS(160, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_banglejs),
|
2020-02-05 10:48:06 +01:00
|
|
|
FOSSILQHYBRID(170, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_qhybrid),
|
2020-06-29 23:02:38 +02:00
|
|
|
TLW64(180, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_tlw64),
|
2020-08-10 16:02:48 +02:00
|
|
|
PINETIME_JF(190, R.drawable.ic_device_pinetime, R.drawable.ic_device_pinetime_disabled, R.string.devicetype_pinetime_jf),
|
2019-08-02 23:49:14 +02:00
|
|
|
MIJIA_LYWSD02(200, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled, R.string.devicetype_mijia_lywsd02),
|
2020-09-29 04:33:53 +02:00
|
|
|
LEFUN(210, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled, R.string.devicetype_lefun),
|
2021-07-20 12:08:12 +02:00
|
|
|
SMAQ2OSS(220, R.drawable.ic_device_default, R.drawable.ic_device_default, R.string.devicetype_smaq2oss),
|
2021-09-21 16:37:19 +02:00
|
|
|
FITPRO(230, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_fitpro),
|
2020-01-31 18:38:13 +01:00
|
|
|
ITAG(250, R.drawable.ic_device_itag, R.drawable.ic_device_itag_disabled, R.string.devicetype_itag),
|
2020-10-02 01:02:13 +02:00
|
|
|
NUTMINI(251, R.drawable.ic_device_itag, R.drawable.ic_device_itag_disabled, R.string.devicetype_nut_mini),
|
2020-01-04 20:54:46 +01:00
|
|
|
VIBRATISSIMO(300, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled, R.string.devicetype_vibratissimo),
|
2020-09-01 22:15:20 +02:00
|
|
|
SONY_SWR12(310, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_sonyswr12),
|
2021-01-06 10:17:15 +01:00
|
|
|
LIVEVIEW(320, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_liveview),
|
2020-12-23 21:55:23 +01:00
|
|
|
WASPOS(330, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled, R.string.devicetype_waspos),
|
2020-10-10 16:45:34 +02:00
|
|
|
UM25(350, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_um25),
|
2020-09-04 14:45:37 +02:00
|
|
|
DOMYOS_T540(400, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled, R.string.devicetype_domyos_t540),
|
2021-09-30 22:40:18 +02:00
|
|
|
NOTHING_EAR1(410, R.drawable.ic_device_nothingear, R.drawable.ic_device_nothingear_disabled, R.string.devicetype_nothingear1),
|
2021-11-03 22:06:35 +01:00
|
|
|
GALAXY_BUDS_LIVE(419, R.drawable.ic_device_galaxy_buds_live, R.drawable.ic_device_galaxy_buds_live_disabled, R.string.devicetype_galaxybuds_live),
|
2021-10-24 10:02:45 +02:00
|
|
|
GALAXY_BUDS(420, R.drawable.ic_device_galaxy_buds, R.drawable.ic_device_galaxy_buds_disabled, R.string.devicetype_galaxybuds),
|
2021-10-31 16:01:50 +01:00
|
|
|
SONY_WH_1000XM3(430, R.drawable.ic_device_headphones, R.drawable.ic_device_headphones_disabled, R.string.devicetype_sony_wh_1000xm3),
|
2021-12-24 15:20:57 +01:00
|
|
|
SONY_WF_SP800N(431, R.drawable.ic_device_galaxy_buds, R.drawable.ic_device_galaxy_buds_disabled, R.string.devicetype_sony_wf_sp800n),
|
2021-12-27 15:37:04 +01:00
|
|
|
BOSE_QC35(440, R.drawable.ic_device_headphones, R.drawable.ic_device_headphones_disabled, R.string.devicetype_bose_qc35),
|
2021-12-27 15:47:10 +01:00
|
|
|
VESC_NRF(500, R.drawable.ic_devices_other, R.drawable.ic_devices_other, R.string.devicetype_vesc),
|
|
|
|
VESC_HM10(501, R.drawable.ic_devices_other, R.drawable.ic_devices_other, R.string.devicetype_vesc),
|
2017-12-11 23:36:39 +01:00
|
|
|
TEST(1000, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_test);
|
2020-11-30 17:09:29 +01:00
|
|
|
|
2016-08-17 00:34:19 +02:00
|
|
|
private final int key;
|
2017-02-26 22:46:49 +01:00
|
|
|
@DrawableRes
|
|
|
|
private final int defaultIcon;
|
|
|
|
@DrawableRes
|
|
|
|
private final int disabledIcon;
|
2017-12-11 23:36:39 +01:00
|
|
|
@StringRes
|
|
|
|
private final int name;
|
2016-08-17 00:34:19 +02:00
|
|
|
|
2017-12-11 23:36:39 +01:00
|
|
|
DeviceType(int key, int defaultIcon, int disabledIcon, int name) {
|
2016-08-17 00:34:19 +02:00
|
|
|
this.key = key;
|
2017-02-26 22:46:49 +01:00
|
|
|
this.defaultIcon = defaultIcon;
|
|
|
|
this.disabledIcon = disabledIcon;
|
2017-12-11 23:36:39 +01:00
|
|
|
this.name = name;
|
2016-08-17 00:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getKey() {
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
2016-11-27 01:09:20 +01:00
|
|
|
public boolean isSupported() {
|
|
|
|
return this != UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2016-08-17 00:34:19 +02:00
|
|
|
public static DeviceType fromKey(int key) {
|
|
|
|
for (DeviceType type : values()) {
|
|
|
|
if (type.key == key) {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DeviceType.UNKNOWN;
|
|
|
|
}
|
2017-02-26 22:46:49 +01:00
|
|
|
|
2017-12-11 23:36:39 +01:00
|
|
|
@StringRes
|
|
|
|
public int getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2017-02-26 22:46:49 +01:00
|
|
|
@DrawableRes
|
|
|
|
public int getIcon() {
|
|
|
|
return defaultIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
@DrawableRes
|
|
|
|
public int getDisabledIcon() {
|
|
|
|
return disabledIcon;
|
|
|
|
}
|
2015-05-05 00:48:02 +02:00
|
|
|
}
|