mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
Watch X Plus discovery
This commit is contained in:
parent
ff5ebe697b
commit
76427a3848
@ -0,0 +1,154 @@
|
|||||||
|
package nodomain.freeyourgadget.gadgetbridge.devices.watchxplus;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.bluetooth.le.ScanFilter;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.ParcelUuid;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.GBException;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.watch9.Watch9Constants;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.watch9.Watch9PairingActivity;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||||
|
|
||||||
|
public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator {
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
|
// TODO constants for watch x plus
|
||||||
|
//ParcelUuid watchXpService = new ParcelUuid(Watch9Constants.UUID_SERVICE_WATCH9);
|
||||||
|
ScanFilter filter = new ScanFilter.Builder().setDeviceName("Watch XPlus").build();
|
||||||
|
return Collections.singletonList(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBondingStyle(GBDevice device) {
|
||||||
|
return BONDING_STYLE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
|
||||||
|
// TODO constants and mac for watch x plus
|
||||||
|
String macAddress = candidate.getMacAddress().toUpperCase();
|
||||||
|
String deviceName = candidate.getName().toUpperCase();
|
||||||
|
if (candidate.supportsService(Watch9Constants.UUID_SERVICE_WATCH9)) {
|
||||||
|
return DeviceType.WATCHXPLUS;
|
||||||
|
} else if (macAddress.startsWith("1C:87:79")) {
|
||||||
|
return DeviceType.WATCHXPLUS;
|
||||||
|
} else if (deviceName.equals("WATCH XPLUS")) {
|
||||||
|
return DeviceType.WATCHXPLUS;
|
||||||
|
}
|
||||||
|
return DeviceType.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceType getDeviceType() {
|
||||||
|
return DeviceType.WATCHXPLUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Class<? extends Activity> getPairingActivity() {
|
||||||
|
// TODO watch X plus!
|
||||||
|
return Watch9PairingActivity.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsActivityDataFetching() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsActivityTracking() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SampleProvider<? extends ActivitySample> getSampleProvider(GBDevice device, DaoSession session) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InstallHandler findInstallHandler(Uri uri, Context context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsScreenshots() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAlarmSlotCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsSmartWakeup(GBDevice device) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsHeartRateMeasurement(GBDevice device) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getManufacturer() {
|
||||||
|
return "Lenovo";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsAppsManagement() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Activity> getAppsManagementActivity() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsCalendarEvents() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsRealtimeData() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsWeather() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsFindDevice() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -49,6 +49,8 @@ public enum DeviceType {
|
|||||||
ZETIME(80, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_mykronoz_zetime),
|
ZETIME(80, R.drawable.ic_device_zetime, R.drawable.ic_device_zetime_disabled, R.string.devicetype_mykronoz_zetime),
|
||||||
ID115(90, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled, R.string.devicetype_id115),
|
ID115(90, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled, R.string.devicetype_id115),
|
||||||
WATCH9(100, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_watch9),
|
WATCH9(100, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_watch9),
|
||||||
|
WATCHX(101, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_watchx),
|
||||||
|
WATCHXPLUS(102, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_watchxplus),
|
||||||
ROIDMI(110, R.drawable.ic_device_roidmi, R.drawable.ic_device_roidmi_disabled, R.string.devicetype_roidmi),
|
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),
|
ROIDMI3(112, R.drawable.ic_device_roidmi, R.drawable.ic_device_roidmi_disabled, R.string.devicetype_roidmi3),
|
||||||
CASIOGB6900(120, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogb6900),
|
CASIOGB6900(120, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogb6900),
|
||||||
|
@ -62,6 +62,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.pebble.PebbleCoordinator;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.devices.roidmi.Roidmi1Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.roidmi.Roidmi1Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.roidmi.Roidmi3Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.roidmi.Roidmi3Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.vibratissimo.VibratissimoCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.vibratissimo.VibratissimoCoordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.watchxplus.WatchXPlusDeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.watch9.Watch9DeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.watch9.Watch9DeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.xwatch.XWatchCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.xwatch.XWatchCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimeCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimeCoordinator;
|
||||||
@ -217,6 +218,7 @@ public class DeviceHelper {
|
|||||||
result.add(new ZeTimeCoordinator());
|
result.add(new ZeTimeCoordinator());
|
||||||
result.add(new ID115Coordinator());
|
result.add(new ID115Coordinator());
|
||||||
result.add(new Watch9DeviceCoordinator());
|
result.add(new Watch9DeviceCoordinator());
|
||||||
|
result.add(new WatchXPlusDeviceCoordinator());
|
||||||
result.add(new Roidmi1Coordinator());
|
result.add(new Roidmi1Coordinator());
|
||||||
result.add(new Roidmi3Coordinator());
|
result.add(new Roidmi3Coordinator());
|
||||||
result.add(new CasioGB6900DeviceCoordinator());
|
result.add(new CasioGB6900DeviceCoordinator());
|
||||||
|
@ -619,6 +619,8 @@
|
|||||||
<string name="devicetype_mykronoz_zetime">MyKronoz ZeTime</string>
|
<string name="devicetype_mykronoz_zetime">MyKronoz ZeTime</string>
|
||||||
<string name="devicetype_id115">ID115</string>
|
<string name="devicetype_id115">ID115</string>
|
||||||
<string name="devicetype_watch9">Watch 9</string>
|
<string name="devicetype_watch9">Watch 9</string>
|
||||||
|
<string name="devicetype_watchx">Watch X</string>
|
||||||
|
<string name="devicetype_watchxplus">Watch X Plus</string>
|
||||||
<string name="devicetype_roidmi">Roidmi</string>
|
<string name="devicetype_roidmi">Roidmi</string>
|
||||||
<string name="devicetype_roidmi3">Roidmi 3</string>
|
<string name="devicetype_roidmi3">Roidmi 3</string>
|
||||||
<string name="devicetype_casiogb6900">Casio GB-6900</string>
|
<string name="devicetype_casiogb6900">Casio GB-6900</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user