mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-06-18 02:50:21 +02:00
89 lines
2.9 KiB
Java
89 lines
2.9 KiB
Java
/* Copyright (C) 2023 José Rebelo
|
|
|
|
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.amazfitfalcon;
|
|
|
|
import android.bluetooth.BluetoothDevice;
|
|
import android.content.Context;
|
|
import android.net.Uri;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.AbstractHuami2021FWInstallHandler;
|
|
|
|
public class AmazfitFalconCoordinator extends Huami2021Coordinator {
|
|
private static final Logger LOG = LoggerFactory.getLogger(AmazfitFalconCoordinator.class);
|
|
|
|
@Override
|
|
public boolean isExperimental() {
|
|
return true;
|
|
}
|
|
|
|
@NonNull
|
|
@Override
|
|
public DeviceType getSupportedType(final GBDeviceCandidate candidate) {
|
|
try {
|
|
final BluetoothDevice device = candidate.getDevice();
|
|
final String name = device.getName();
|
|
if (name != null && name.startsWith(HuamiConst.AMAZFIT_FALCON_NAME)) {
|
|
return DeviceType.AMAZFITFALCON;
|
|
}
|
|
} catch (final Exception e) {
|
|
LOG.error("unable to check device support", e);
|
|
}
|
|
|
|
return DeviceType.UNKNOWN;
|
|
}
|
|
|
|
@Override
|
|
public DeviceType getDeviceType() {
|
|
return DeviceType.AMAZFITFALCON;
|
|
}
|
|
|
|
@Override
|
|
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
|
|
return new AmazfitFalconFWInstallHandler(uri, context);
|
|
}
|
|
|
|
@Override
|
|
public boolean sendAgpsAsFileTransfer() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean supportsWifiHotspot(final GBDevice device) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean supportsFtpServer(final GBDevice device) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
|
return false;
|
|
}
|
|
}
|