2021-01-10 23:37:09 +01:00
|
|
|
/* Copyright (C) 2017-2021 Andreas Shimokawa, Carsten Pfeiffer, Daniele
|
|
|
|
Gobbetti, João Paulo Barraca, Nephiel, Petr Vaněk
|
2017-08-13 16:31:11 +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/>. */
|
2017-10-23 10:28:54 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip;
|
2017-08-13 16:31:11 +02:00
|
|
|
|
|
|
|
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-08-13 16:31:11 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2019-05-22 00:42:22 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
2017-08-13 16:31:11 +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-08-13 16:31:11 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
|
|
|
2017-10-23 14:46:08 +02:00
|
|
|
public class AmazfitBipCoordinator extends HuamiCoordinator {
|
2017-10-23 10:28:54 +02:00
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipCoordinator.class);
|
2017-08-13 16:31:11 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public DeviceType getDeviceType() {
|
|
|
|
return DeviceType.AMAZFITBIP;
|
|
|
|
}
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@Override
|
|
|
|
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
|
|
|
|
try {
|
|
|
|
BluetoothDevice device = candidate.getDevice();
|
|
|
|
String name = device.getName();
|
2019-10-10 21:21:19 +02:00
|
|
|
if (name != null && (name.equalsIgnoreCase("Amazfit Bip Watch"))) {
|
2017-08-13 16:31:11 +02:00
|
|
|
return DeviceType.AMAZFITBIP;
|
|
|
|
}
|
|
|
|
} catch (Exception ex) {
|
|
|
|
LOG.error("unable to check device support", ex);
|
|
|
|
}
|
|
|
|
return DeviceType.UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public InstallHandler findInstallHandler(Uri uri, Context context) {
|
2017-08-25 00:21:47 +02:00
|
|
|
AmazfitBipFWInstallHandler handler = new AmazfitBipFWInstallHandler(uri, context);
|
|
|
|
return handler.isValid() ? handler : null;
|
2017-08-13 16:31:11 +02:00
|
|
|
}
|
2017-10-23 14:46:08 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsHeartRateMeasurement(GBDevice device) {
|
|
|
|
return true;
|
|
|
|
}
|
2017-10-19 21:52:38 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean supportsActivityTracks() {
|
|
|
|
return true;
|
|
|
|
}
|
2017-12-11 19:30:54 +01:00
|
|
|
|
2017-12-11 19:09:37 +01:00
|
|
|
@Override
|
|
|
|
public boolean supportsWeather() {
|
|
|
|
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_amazfitbip,
|
2020-01-04 23:40:50 +01:00
|
|
|
R.xml.devicesettings_timeformat,
|
2019-10-05 22:35:30 +02:00
|
|
|
R.xml.devicesettings_wearlocation,
|
2022-05-15 23:15:10 +02:00
|
|
|
R.xml.devicesettings_heartrate_sleep,
|
2022-05-14 22:08:32 +02:00
|
|
|
R.xml.devicesettings_goal_notification,
|
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,
|
2022-05-14 22:08:32 +02:00
|
|
|
R.xml.devicesettings_inactivity_dnd,
|
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,
|
2021-12-11 23:19:09 +01:00
|
|
|
R.xml.devicesettings_reserve_reminders_calendar,
|
2020-12-06 00:09:19 +01:00
|
|
|
R.xml.devicesettings_bt_connected_advertisement,
|
2020-01-08 19:58:31 +01:00
|
|
|
R.xml.devicesettings_buttonactions_with_longpress,
|
2020-08-16 22:07:55 +02:00
|
|
|
R.xml.devicesettings_device_actions,
|
2022-09-10 15:35:50 +02:00
|
|
|
R.xml.devicesettings_overwrite_settings_on_connection,
|
2022-11-06 13:13:33 +01:00
|
|
|
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
|
2021-11-03 17:13:22 +01:00
|
|
|
R.xml.devicesettings_transliteration
|
2019-05-22 00:42:22 +02:00
|
|
|
};
|
2019-05-20 16:36:06 +02:00
|
|
|
}
|
2017-08-13 16:31:11 +02:00
|
|
|
}
|