2021-01-10 23:37:09 +01:00
|
|
|
/* Copyright (C) 2015-2021 Andreas Shimokawa, Carsten Pfeiffer, Daniele
|
|
|
|
Gobbetti, Dmitry Markin, José Rebelo, Matthieu Baerts, Nephiel, Petr Vaněk,
|
|
|
|
Taavi Eomäe
|
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-10-24 23:28:02 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.devices;
|
|
|
|
|
2023-09-11 11:17:04 +02:00
|
|
|
import static nodomain.freeyourgadget.gadgetbridge.GBApplication.getPrefs;
|
|
|
|
|
2020-05-24 23:25:52 +02:00
|
|
|
import android.app.Activity;
|
2016-06-28 00:35:50 +02:00
|
|
|
import android.bluetooth.BluetoothClass;
|
|
|
|
import android.bluetooth.BluetoothDevice;
|
2016-11-27 01:09:20 +01:00
|
|
|
import android.bluetooth.le.ScanFilter;
|
2023-09-29 00:32:57 +02:00
|
|
|
import android.content.Context;
|
|
|
|
import android.net.Uri;
|
2016-06-28 00:35:50 +02:00
|
|
|
|
2023-09-27 23:11:02 +02:00
|
|
|
import androidx.annotation.DrawableRes;
|
2020-02-27 13:36:53 +01:00
|
|
|
import androidx.annotation.NonNull;
|
2020-05-24 23:25:52 +02:00
|
|
|
import androidx.annotation.Nullable;
|
2020-02-27 13:36:53 +01:00
|
|
|
|
2022-06-14 18:05:41 +02:00
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
2016-06-28 00:35:50 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2021-05-29 16:42:32 +02:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
2022-08-25 11:07:23 +02:00
|
|
|
import java.util.Arrays;
|
2016-11-27 01:09:20 +01:00
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collections;
|
2023-08-20 04:14:06 +02:00
|
|
|
import java.util.EnumSet;
|
2022-08-25 11:07:23 +02:00
|
|
|
import java.util.List;
|
2023-09-29 17:50:32 +02:00
|
|
|
import java.util.regex.Pattern;
|
2016-11-27 01:09:20 +01:00
|
|
|
|
2016-10-24 20:02:44 +02:00
|
|
|
import de.greenrobot.dao.query.QueryBuilder;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.GBException;
|
2022-06-14 18:05:41 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
2021-11-28 01:34:29 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
|
2022-08-25 11:07:23 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
|
2022-07-05 20:29:16 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
|
2016-10-24 20:02:44 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
2019-09-04 21:29:56 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
|
2021-09-19 17:52:08 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.AlarmDao;
|
2021-07-03 09:15:07 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.BatteryLevelDao;
|
2016-10-24 20:02:44 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.DeviceAttributesDao;
|
2015-10-24 23:28:02 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
2016-08-17 00:53:16 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
2023-09-23 12:31:41 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.AbstractNotificationPattern;
|
2023-09-29 00:32:57 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
2022-09-18 13:19:23 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser;
|
2021-10-31 17:36:04 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.BatteryConfig;
|
2023-09-27 23:11:02 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
2023-05-27 19:59:12 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.HeartRateSample;
|
2023-05-27 20:02:01 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.PaiSample;
|
2023-05-27 20:03:43 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.SleepRespiratoryRateSample;
|
2023-05-21 00:34:10 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.Spo2Sample;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.StressSample;
|
2023-10-15 15:37:41 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.TemperatureSample;
|
2023-08-20 04:14:06 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.service.ServiceDeviceSupport;
|
2019-09-04 21:29:56 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
2020-02-27 13:36:53 +01:00
|
|
|
|
2015-10-24 23:28:02 +02:00
|
|
|
public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
|
2016-06-28 00:35:50 +02:00
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(AbstractDeviceCoordinator.class);
|
|
|
|
|
2023-09-29 17:50:32 +02:00
|
|
|
private Pattern supportedDeviceName = null;
|
|
|
|
/**
|
|
|
|
* This method should return a ReGexp pattern that will matched against a found device
|
|
|
|
* to check whether this coordinator supports that device.
|
|
|
|
* If more sophisticated logic is needed to determine device support, the supports(GBDeviceCandidate)
|
|
|
|
* should be overridden.
|
|
|
|
*
|
|
|
|
* @return Pattern
|
|
|
|
* */
|
|
|
|
protected Pattern getSupportedDeviceName(){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-11-27 01:09:20 +01:00
|
|
|
@Override
|
2023-09-29 17:50:32 +02:00
|
|
|
public boolean supports(GBDeviceCandidate candidate) {
|
|
|
|
if(supportedDeviceName == null){
|
|
|
|
supportedDeviceName = getSupportedDeviceName();
|
|
|
|
}
|
|
|
|
if(supportedDeviceName == null){
|
|
|
|
throw new RuntimeException(getClass() + " should either override getSupportedDeviceName or supports(GBDeviceCandidate)");
|
|
|
|
}
|
|
|
|
|
|
|
|
return supportedDeviceName.matcher(candidate.getName()).matches();
|
2016-11-27 01:09:20 +01:00
|
|
|
}
|
2016-08-17 00:53:16 +02:00
|
|
|
|
2022-06-14 18:05:41 +02:00
|
|
|
@Override
|
|
|
|
public ConnectionType getConnectionType() {
|
|
|
|
return ConnectionType.BOTH;
|
|
|
|
}
|
|
|
|
|
2016-11-27 01:09:20 +01:00
|
|
|
@NonNull
|
|
|
|
@Override
|
|
|
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
|
|
|
|
2016-08-17 00:53:16 +02:00
|
|
|
@Override
|
2023-09-27 23:11:02 +02:00
|
|
|
public GBDevice createDevice(GBDeviceCandidate candidate, DeviceType deviceType) {
|
|
|
|
GBDevice gbDevice = new GBDevice(candidate.getDevice().getAddress(), candidate.getName(), null, null, deviceType);
|
2021-11-06 08:08:20 +01:00
|
|
|
for (BatteryConfig batteryConfig : getBatteryConfig()) {
|
|
|
|
gbDevice.setBatteryIcon(batteryConfig.getBatteryIcon(), batteryConfig.getBatteryIndex());
|
|
|
|
gbDevice.setBatteryLabel(batteryConfig.getBatteryLabel(), batteryConfig.getBatteryIndex());
|
|
|
|
}
|
|
|
|
return gbDevice;
|
2016-08-17 00:53:16 +02:00
|
|
|
}
|
|
|
|
|
2016-10-24 20:02:44 +02:00
|
|
|
@Override
|
2023-10-02 10:48:10 +02:00
|
|
|
public final void deleteDevice(final GBDevice gbDevice) throws GBException {
|
2016-10-24 20:02:44 +02:00
|
|
|
LOG.info("will try to delete device: " + gbDevice.getName());
|
|
|
|
if (gbDevice.isConnected() || gbDevice.isConnecting()) {
|
2022-08-01 23:04:41 +02:00
|
|
|
GBApplication.deviceService(gbDevice).disconnect();
|
2016-10-24 20:02:44 +02:00
|
|
|
}
|
2019-09-04 21:29:56 +02:00
|
|
|
Prefs prefs = getPrefs();
|
2020-08-26 04:28:03 +02:00
|
|
|
|
2023-09-11 11:17:04 +02:00
|
|
|
String lastDevice = prefs.getPreferences().getString("last_device_address", "");
|
2020-08-26 04:28:03 +02:00
|
|
|
if (gbDevice.getAddress().equals(lastDevice)) {
|
2019-09-07 08:41:42 +02:00
|
|
|
LOG.debug("#1605 removing last device");
|
|
|
|
prefs.getPreferences().edit().remove("last_device_address").apply();
|
2019-09-04 21:29:56 +02:00
|
|
|
}
|
2020-08-26 04:28:03 +02:00
|
|
|
|
2023-09-11 11:17:04 +02:00
|
|
|
String macAddress = prefs.getPreferences().getString(MiBandConst.PREF_MIBAND_ADDRESS, "");
|
2020-08-26 04:28:03 +02:00
|
|
|
if (gbDevice.getAddress().equals(macAddress)) {
|
2019-09-07 08:41:42 +02:00
|
|
|
LOG.debug("#1605 removing devel miband");
|
|
|
|
prefs.getPreferences().edit().remove(MiBandConst.PREF_MIBAND_ADDRESS).apply();
|
2019-09-04 21:29:56 +02:00
|
|
|
}
|
2020-08-26 04:28:03 +02:00
|
|
|
|
2021-09-18 22:27:15 +02:00
|
|
|
GBApplication.deleteDeviceSpecificSharedPrefs(gbDevice.getAddress());
|
|
|
|
|
2016-10-24 20:02:44 +02:00
|
|
|
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
|
|
|
DaoSession session = dbHandler.getDaoSession();
|
|
|
|
Device device = DBHelper.findDevice(gbDevice, session);
|
|
|
|
if (device != null) {
|
|
|
|
deleteDevice(gbDevice, device, session);
|
|
|
|
QueryBuilder<?> qb = session.getDeviceAttributesDao().queryBuilder();
|
|
|
|
qb.where(DeviceAttributesDao.Properties.DeviceId.eq(device.getId())).buildDelete().executeDeleteWithoutDetachingEntities();
|
2021-07-03 09:15:07 +02:00
|
|
|
QueryBuilder<?> batteryLevelQueryBuilder = session.getBatteryLevelDao().queryBuilder();
|
|
|
|
batteryLevelQueryBuilder.where(BatteryLevelDao.Properties.DeviceId.eq(device.getId())).buildDelete().executeDeleteWithoutDetachingEntities();
|
2021-09-19 17:52:08 +02:00
|
|
|
QueryBuilder<?> alarmDeviceQueryBuilder = session.getAlarmDao().queryBuilder();
|
|
|
|
alarmDeviceQueryBuilder.where(AlarmDao.Properties.DeviceId.eq(device.getId())).buildDelete().executeDeleteWithoutDetachingEntities();
|
2016-10-24 20:02:44 +02:00
|
|
|
session.getDeviceDao().delete(device);
|
|
|
|
} else {
|
|
|
|
LOG.info("device to delete not found in db: " + gbDevice);
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new GBException("Error deleting device: " + e.getMessage(), e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hook for subclasses to perform device-specific deletion logic, e.g. db cleanup.
|
2020-08-28 15:38:18 +02:00
|
|
|
*
|
2016-10-24 20:02:44 +02:00
|
|
|
* @param gbDevice the GBDevice
|
2020-08-28 15:38:18 +02:00
|
|
|
* @param device the corresponding database Device
|
|
|
|
* @param session the session to use
|
2016-10-24 20:02:44 +02:00
|
|
|
* @throws GBException
|
|
|
|
*/
|
|
|
|
protected abstract void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException;
|
|
|
|
|
2016-10-11 20:23:25 +02:00
|
|
|
@Override
|
2015-10-24 23:28:02 +02:00
|
|
|
public boolean allowFetchActivityData(GBDevice device) {
|
|
|
|
return device.isInitialized() && !device.isBusy() && supportsActivityDataFetching();
|
|
|
|
}
|
2016-06-28 00:35:50 +02:00
|
|
|
|
2023-09-29 00:32:57 +02:00
|
|
|
@Override
|
|
|
|
public SampleProvider<? extends ActivitySample> getSampleProvider(final GBDevice device, final DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-05-21 00:34:10 +02:00
|
|
|
@Override
|
|
|
|
public TimeSampleProvider<? extends StressSample> getStressSampleProvider(GBDevice device, DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-10-15 15:37:41 +02:00
|
|
|
@Override
|
|
|
|
public TimeSampleProvider<? extends TemperatureSample> getTemperatureSampleProvider(GBDevice device, DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-05-21 00:34:10 +02:00
|
|
|
@Override
|
|
|
|
public TimeSampleProvider<? extends Spo2Sample> getSpo2SampleProvider(GBDevice device, DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-05-27 19:59:12 +02:00
|
|
|
@Override
|
|
|
|
public TimeSampleProvider<? extends HeartRateSample> getHeartRateMaxSampleProvider(GBDevice device, DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TimeSampleProvider<? extends HeartRateSample> getHeartRateRestingSampleProvider(GBDevice device, DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TimeSampleProvider<? extends HeartRateSample> getHeartRateManualSampleProvider(GBDevice device, DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-05-27 20:02:01 +02:00
|
|
|
@Override
|
|
|
|
public TimeSampleProvider<? extends PaiSample> getPaiSampleProvider(GBDevice device, DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-05-27 20:03:43 +02:00
|
|
|
@Override
|
|
|
|
public TimeSampleProvider<? extends SleepRespiratoryRateSample> getSleepRespiratoryRateSampleProvider(GBDevice device, DaoSession session) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-09-18 13:19:23 +02:00
|
|
|
@Override
|
|
|
|
@Nullable
|
|
|
|
public ActivitySummaryParser getActivitySummaryParser(final GBDevice device) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-06-28 00:35:50 +02:00
|
|
|
public boolean isHealthWearable(BluetoothDevice device) {
|
2023-09-11 11:17:04 +02:00
|
|
|
BluetoothClass bluetoothClass;
|
|
|
|
try {
|
|
|
|
bluetoothClass = device.getBluetoothClass();
|
|
|
|
} catch (SecurityException se) {
|
|
|
|
LOG.warn("missing bluetooth permission: ", se);
|
|
|
|
return false;
|
|
|
|
}
|
2016-06-28 00:35:50 +02:00
|
|
|
if (bluetoothClass == null) {
|
|
|
|
LOG.warn("unable to determine bluetooth device class of " + device);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (bluetoothClass.getMajorDeviceClass() == BluetoothClass.Device.Major.WEARABLE
|
2020-08-28 15:38:18 +02:00
|
|
|
|| bluetoothClass.getMajorDeviceClass() == BluetoothClass.Device.Major.UNCATEGORIZED) {
|
2016-06-28 00:35:50 +02:00
|
|
|
int deviceClasses =
|
|
|
|
BluetoothClass.Device.HEALTH_BLOOD_PRESSURE
|
2020-08-28 15:38:18 +02:00
|
|
|
| BluetoothClass.Device.HEALTH_DATA_DISPLAY
|
|
|
|
| BluetoothClass.Device.HEALTH_PULSE_RATE
|
|
|
|
| BluetoothClass.Device.HEALTH_WEIGHING
|
|
|
|
| BluetoothClass.Device.HEALTH_UNCATEGORIZED
|
|
|
|
| BluetoothClass.Device.HEALTH_PULSE_OXIMETER
|
|
|
|
| BluetoothClass.Device.HEALTH_GLUCOSE;
|
2016-06-28 00:35:50 +02:00
|
|
|
|
|
|
|
return (bluetoothClass.getDeviceClass() & deviceClasses) != 0;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2017-04-06 23:47:35 +02:00
|
|
|
|
2021-05-29 16:42:32 +02:00
|
|
|
@Override
|
|
|
|
public File getAppCacheDir() throws IOException {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getAppCacheSortFilename() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getAppFileExtension() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsAppListFetching() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-07-06 23:09:36 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsFlashing() { return false; }
|
|
|
|
|
2023-09-29 00:32:57 +02:00
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsScreenshots() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getAlarmSlotCount(final GBDevice device) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsSmartWakeup(final GBDevice device) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-05-29 16:42:32 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsAppReordering() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-09-29 00:32:57 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsAppsManagement(final GBDevice device) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-10-22 12:06:27 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsCachedAppManagement(final GBDevice device) {
|
|
|
|
try {
|
|
|
|
return supportsAppsManagement(device) && getAppCacheDir() != null;
|
|
|
|
} catch (final Exception e) {
|
|
|
|
// we failed, but still tried, so it's supported..
|
|
|
|
LOG.error("Failed to get app cache dir", e);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsInstalledAppManagement(final GBDevice device) {
|
|
|
|
return supportsAppsManagement(device);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsWatchfaceManagement(final GBDevice device) {
|
|
|
|
return supportsAppsManagement(device);
|
|
|
|
}
|
|
|
|
|
2023-09-29 00:32:57 +02:00
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public Class<? extends Activity> getAppsManagementActivity() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-06-20 14:17:18 +02:00
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public Class<? extends Activity> getWatchfaceDesignerActivity() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2017-04-06 23:47:35 +02:00
|
|
|
@Override
|
2019-10-12 19:44:45 +02:00
|
|
|
public int getBondingStyle() {
|
2017-04-06 23:47:35 +02:00
|
|
|
return BONDING_STYLE_ASK;
|
|
|
|
}
|
2017-10-19 21:52:38 +02:00
|
|
|
|
2023-08-18 00:14:40 +02:00
|
|
|
@Override
|
|
|
|
public boolean isExperimental() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-09-29 00:32:57 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsCalendarEvents() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsActivityDataFetching() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsActivityTracking() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-10-19 21:52:38 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsActivityTracks() {
|
|
|
|
return false;
|
|
|
|
}
|
2018-08-07 12:44:00 +02:00
|
|
|
|
2023-05-21 00:34:10 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsStressMeasurement() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsSpo2() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-05-27 19:59:12 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsHeartRateStats() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-05-27 20:02:01 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsPai() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-05-27 20:03:43 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsSleepRespiratoryRate() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-01-12 08:12:21 +01:00
|
|
|
@Override
|
|
|
|
public boolean supportsAlarmSnoozing() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-04-24 10:39:32 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsAlarmDescription(GBDevice device) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-08-07 12:44:00 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsMusicInfo() {
|
|
|
|
return false;
|
|
|
|
}
|
2018-07-28 17:23:58 +02:00
|
|
|
|
2020-01-12 08:12:21 +01:00
|
|
|
@Override
|
2018-07-28 17:23:58 +02:00
|
|
|
public boolean supportsLedColor() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-04 16:55:09 +01:00
|
|
|
public int getMaximumReminderMessageLength() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-10-22 21:53:45 +02:00
|
|
|
public int getReminderSlotCount(final GBDevice device) {
|
2021-12-04 16:55:09 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-05-09 20:47:08 +02:00
|
|
|
@Override
|
|
|
|
public int getWorldClocksSlotCount() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getWorldClocksLabelLength() {
|
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
|
2022-10-31 13:09:36 +01:00
|
|
|
@Override
|
|
|
|
public boolean supportsDisabledWorldClocks() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-05-18 00:43:29 +02:00
|
|
|
@Override
|
|
|
|
public int getContactsSlotCount(final GBDevice device) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-12-04 16:55:09 +01:00
|
|
|
@Override
|
2018-07-28 17:23:58 +02:00
|
|
|
public boolean supportsRgbLedColor() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-10-12 19:44:45 +02:00
|
|
|
@NonNull
|
2018-07-28 17:23:58 +02:00
|
|
|
@Override
|
|
|
|
public int[] getColorPresets() {
|
|
|
|
return new int[0];
|
|
|
|
}
|
2018-11-25 23:56:52 +01:00
|
|
|
|
2022-08-18 23:03:28 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsHeartRateMeasurement(final GBDevice device) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-09-10 15:22:46 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsManualHeartRateMeasurement(final GBDevice device) {
|
|
|
|
return supportsHeartRateMeasurement(device);
|
|
|
|
}
|
|
|
|
|
2023-09-29 00:32:57 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsRealtimeData() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-08-24 12:21:59 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsRemSleep() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-08-18 23:03:28 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsWeather() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-09-29 00:32:57 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsFindDevice() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-11-25 23:56:52 +01:00
|
|
|
@Override
|
2020-08-28 15:38:18 +02:00
|
|
|
public boolean supportsUnicodeEmojis() {
|
|
|
|
return false;
|
|
|
|
}
|
2019-04-21 15:59:39 +02:00
|
|
|
|
2022-06-14 18:05:41 +02:00
|
|
|
@Override
|
|
|
|
public int[] getSupportedDeviceSpecificConnectionSettings() {
|
|
|
|
int[] settings = new int[0];
|
|
|
|
ConnectionType connectionType = getConnectionType();
|
|
|
|
|
|
|
|
if(connectionType.usesBluetoothLE()){
|
|
|
|
settings = ArrayUtils.insert(0, settings, R.xml.devicesettings_reconnect_ble);
|
|
|
|
}
|
|
|
|
if(connectionType.usesBluetoothClassic()){
|
|
|
|
settings = ArrayUtils.insert(0, settings, R.xml.devicesettings_reconnect_bl_classic);
|
|
|
|
}
|
|
|
|
|
|
|
|
return settings;
|
|
|
|
}
|
2022-06-19 16:03:37 +02:00
|
|
|
@Override
|
|
|
|
public int[] getSupportedDeviceSpecificApplicationSettings() {
|
|
|
|
return new int[0];
|
|
|
|
}
|
2022-06-14 18:05:41 +02:00
|
|
|
|
2019-04-21 15:59:39 +02:00
|
|
|
@Override
|
2019-05-22 00:42:22 +02:00
|
|
|
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
2022-06-14 18:05:41 +02:00
|
|
|
return new int[0];
|
2019-04-21 21:18:08 +02:00
|
|
|
}
|
2020-05-24 23:25:52 +02:00
|
|
|
|
2022-06-19 16:03:37 +02:00
|
|
|
@Override
|
|
|
|
public int[] getSupportedDeviceSpecificAuthenticationSettings() {
|
|
|
|
return new int[0];
|
|
|
|
}
|
|
|
|
|
2021-11-28 01:34:29 +01:00
|
|
|
@Override
|
|
|
|
public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(GBDevice device) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-10-07 14:32:09 +02:00
|
|
|
@Override
|
|
|
|
public String[] getSupportedLanguageSettings(GBDevice device) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-09-29 00:32:57 +02:00
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public Class<? extends Activity> getPairingActivity() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-05-24 23:25:52 +02:00
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public Class<? extends Activity> getCalibrationActivity() {
|
|
|
|
return null;
|
|
|
|
}
|
2021-10-16 22:40:30 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getBatteryCount() {
|
|
|
|
return 1;
|
|
|
|
} //multiple battery support, default is 1, maximum is 3, 0 will disable the battery in UI
|
2021-10-31 17:36:04 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public BatteryConfig[] getBatteryConfig() {
|
|
|
|
return new BatteryConfig[0];
|
|
|
|
}
|
|
|
|
|
2021-12-24 15:20:57 +01:00
|
|
|
@Override
|
|
|
|
public boolean supportsPowerOff() {
|
|
|
|
return false;
|
|
|
|
}
|
2022-07-05 20:29:16 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public PasswordCapabilityImpl.Mode getPasswordCapability() {
|
|
|
|
return PasswordCapabilityImpl.Mode.NONE;
|
|
|
|
}
|
2022-08-25 11:07:23 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals() {
|
|
|
|
return Arrays.asList(
|
|
|
|
HeartRateCapability.MeasurementInterval.OFF,
|
|
|
|
HeartRateCapability.MeasurementInterval.MINUTES_1,
|
|
|
|
HeartRateCapability.MeasurementInterval.MINUTES_5,
|
|
|
|
HeartRateCapability.MeasurementInterval.MINUTES_10,
|
|
|
|
HeartRateCapability.MeasurementInterval.MINUTES_30,
|
|
|
|
HeartRateCapability.MeasurementInterval.HOUR_1
|
|
|
|
);
|
|
|
|
}
|
2021-11-18 13:36:57 +01:00
|
|
|
|
2022-08-05 23:43:39 +02:00
|
|
|
public boolean supportsNavigation() {
|
2021-11-18 13:36:57 +01:00
|
|
|
return false;
|
|
|
|
}
|
2023-08-20 04:14:06 +02:00
|
|
|
|
2023-09-27 23:11:02 +02:00
|
|
|
@Override
|
|
|
|
public int getOrderPriority(){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-08-20 04:14:06 +02:00
|
|
|
@Override
|
|
|
|
public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() {
|
|
|
|
return EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING);
|
|
|
|
}
|
2023-09-23 12:31:41 +02:00
|
|
|
|
2023-09-27 23:11:02 +02:00
|
|
|
@Override
|
|
|
|
@DrawableRes
|
|
|
|
public int getDefaultIconResource() {
|
|
|
|
return R.drawable.ic_device_default;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@DrawableRes
|
|
|
|
public int getDisabledIconResource() {
|
|
|
|
return R.drawable.ic_device_default_disabled;
|
|
|
|
}
|
|
|
|
|
2023-12-02 11:59:34 +01:00
|
|
|
@Override
|
2023-09-23 12:31:41 +02:00
|
|
|
public boolean supportsNotificationVibrationPatterns() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-12-02 11:59:34 +01:00
|
|
|
@Override
|
2023-09-23 12:31:41 +02:00
|
|
|
public boolean supportsNotificationVibrationRepetitionPatterns() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-12-02 11:59:34 +01:00
|
|
|
@Override
|
2023-09-23 12:31:41 +02:00
|
|
|
public boolean supportsNotificationLedPatterns() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-12-02 11:59:34 +01:00
|
|
|
@Override
|
2023-09-23 12:31:41 +02:00
|
|
|
public AbstractNotificationPattern[] getNotificationVibrationPatterns() {
|
|
|
|
return new AbstractNotificationPattern[0];
|
|
|
|
}
|
|
|
|
|
2023-12-02 11:59:34 +01:00
|
|
|
@Override
|
2023-09-23 12:31:41 +02:00
|
|
|
public AbstractNotificationPattern[] getNotificationVibrationRepetitionPatterns() {
|
|
|
|
return new AbstractNotificationPattern[0];
|
|
|
|
}
|
|
|
|
|
2023-12-02 11:59:34 +01:00
|
|
|
@Override
|
2023-09-23 12:31:41 +02:00
|
|
|
public AbstractNotificationPattern[] getNotificationLedPatterns() {
|
|
|
|
return new AbstractNotificationPattern[0];
|
|
|
|
}
|
2023-12-02 11:59:34 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean validateAuthKey(final String authKey) {
|
|
|
|
return !(authKey.getBytes().length < 34 || !authKey.startsWith("0x"));
|
|
|
|
}
|
2015-10-24 23:28:02 +02:00
|
|
|
}
|