2021-01-10 23:37:09 +01:00
|
|
|
/* Copyright (C) 2017-2021 Andreas Shimokawa, Daniele Gobbetti, João
|
2019-02-13 20:43:30 +01:00
|
|
|
Paulo Barraca, Matthieu Baerts
|
2017-10-23 11:28:51 +02: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/>. */
|
|
|
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor;
|
|
|
|
|
|
|
|
import android.bluetooth.BluetoothDevice;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.net.Uri;
|
|
|
|
|
2019-05-02 22:40:28 +02:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
2017-10-23 11:28:51 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2019-05-22 00:42:22 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
2017-10-23 11:28:51 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
2017-10-23 14:46:08 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
2017-10-23 11:28:51 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
|
|
|
2017-10-23 14:46:08 +02:00
|
|
|
public class AmazfitCorCoordinator extends HuamiCoordinator {
|
2017-10-23 11:28:51 +02:00
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCorCoordinator.class);
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public DeviceType getDeviceType() {
|
|
|
|
return DeviceType.AMAZFITCOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@Override
|
|
|
|
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
|
|
|
|
try {
|
|
|
|
BluetoothDevice device = candidate.getDevice();
|
|
|
|
String name = device.getName();
|
2019-05-09 12:42:59 +02:00
|
|
|
if (name != null && (name.equalsIgnoreCase("Amazfit Band") || name.equalsIgnoreCase("Amazfit Cor"))) {
|
2017-10-23 11:28:51 +02:00
|
|
|
return DeviceType.AMAZFITCOR;
|
|
|
|
}
|
|
|
|
} catch (Exception ex) {
|
|
|
|
LOG.error("unable to check device support", ex);
|
|
|
|
}
|
|
|
|
return DeviceType.UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public InstallHandler findInstallHandler(Uri uri, Context context) {
|
2017-10-24 22:01:25 +02:00
|
|
|
AmazfitCorFWInstallHandler handler = new AmazfitCorFWInstallHandler(uri, context);
|
|
|
|
return handler.isValid() ? handler : null;
|
2017-10-23 11:28:51 +02:00
|
|
|
}
|
2017-10-23 14:46:08 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsHeartRateMeasurement(GBDevice device) {
|
|
|
|
return true;
|
|
|
|
}
|
2017-12-11 19:09:37 +01:00
|
|
|
|
2020-09-01 20:05:06 +02:00
|
|
|
@Override
|
|
|
|
public boolean supportsActivityTracks() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-12-11 19:09:37 +01:00
|
|
|
@Override
|
|
|
|
public boolean supportsWeather() {
|
|
|
|
return true;
|
|
|
|
}
|
2018-08-07 12:44:00 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsMusicInfo() {
|
|
|
|
return true;
|
|
|
|
}
|
2018-11-25 23:56:52 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsUnicodeEmojis() { return true; }
|
2019-05-20 16:36:06 +02:00
|
|
|
|
|
|
|
@Override
|
2019-05-22 00:42:22 +02:00
|
|
|
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
|
|
|
return new int[]{
|
|
|
|
R.xml.devicesettings_amazfitcor,
|
2019-10-05 22:35:30 +02:00
|
|
|
R.xml.devicesettings_wearlocation,
|
2020-01-04 23:40:50 +01:00
|
|
|
R.xml.devicesettings_timeformat,
|
2019-09-14 00:05:39 +02:00
|
|
|
R.xml.devicesettings_custom_emoji_font,
|
2019-06-05 16:00:18 +02:00
|
|
|
R.xml.devicesettings_liftwrist_display,
|
2019-05-22 00:42:22 +02:00
|
|
|
R.xml.devicesettings_disconnectnotification,
|
2020-02-24 14:19:06 +01:00
|
|
|
R.xml.devicesettings_sync_calendar,
|
2020-12-06 00:09:19 +01:00
|
|
|
R.xml.devicesettings_bt_connected_advertisement,
|
2020-08-26 10:00:06 +02:00
|
|
|
R.xml.devicesettings_device_actions,
|
2019-08-27 11:13:45 +02:00
|
|
|
R.xml.devicesettings_pairingkey
|
|
|
|
};
|
2019-05-20 16:36:06 +02:00
|
|
|
}
|
2017-10-23 11:28:51 +02:00
|
|
|
}
|