1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

ID115: coordinator

This commit is contained in:
Vadim Kaushan 2018-07-12 15:47:08 +03:00
parent 0e1331f172
commit 26a1f97e43
3 changed files with 170 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package nodomain.freeyourgadget.gadgetbridge.devices.id115;
import java.util.UUID;
import static nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport.BASE_UUID;
public class ID115Constants {
public static final UUID UUID_SERVICE_ID115 = UUID.fromString(String.format(BASE_UUID, "0AF0"));
public static final UUID UUID_CHARACTERISTIC_WRITE_NORMAL = UUID.fromString(String.format(BASE_UUID, "0AF6"));
public static final UUID UUID_CHARACTERISTIC_NOTIFY_NORMAL = UUID.fromString(String.format(BASE_UUID, "0AF7"));
public static final UUID UUID_CHARACTERISTIC_WRITE_HEALTH = UUID.fromString(String.format(BASE_UUID, "0AF1"));
public static final UUID UUID_CHARACTERISTIC_NOTIFY_HEALTH = UUID.fromString(String.format(BASE_UUID, "0AF2"));
public static final byte CMD_ID_WARE_UPDATE = 0x01;
public static final byte CMD_ID_GET_INFO = 0x02;
public static final byte CMD_ID_SETTINGS = 0x03;
public static final byte CMD_ID_BIND_UNBIND = 0x04;
public static final byte CMD_ID_NOTIFY = 0x05;
public static final byte CMD_ID_APP_CONTROL = 0x06;
public static final byte CMD_ID_BLE_CONTROL = 0x07;
public static final byte CMD_ID_HEALTH_DATA = 0x08;
public static final byte CMD_ID_DUMP_STACK = 0x20;
public static final byte CMD_ID_LOG = 0x21;
public static final byte CMD_ID_FACTORY = (byte)0xaa;
public static final byte CMD_ID_DEVICE_RESTART = (byte)0xf0;
// CMD_ID_SETTINGS
public static final byte CMD_KEY_SET_TIME = 0x01;
public static final byte CMD_KEY_SET_DISPLAY_MODE = 0x2B;
// CMD_ID_DEVICE_RESTART
public static final byte CMD_KEY_REBOOT = 0x01;
}

View File

@ -0,0 +1,135 @@
package nodomain.freeyourgadget.gadgetbridge.devices.id115;
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 android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
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.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 ID115Coordinator extends AbstractDeviceCoordinator {
@NonNull
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public Collection<? extends ScanFilter> createBLEScanFilters() {
ParcelUuid service = new ParcelUuid(ID115Constants.UUID_SERVICE_ID115);
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(service).build();
return Collections.singletonList(filter);
}
@Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
}
@NonNull
@Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
if (candidate.supportsService(ID115Constants.UUID_SERVICE_ID115)) {
return DeviceType.ID115;
}
return DeviceType.UNKNOWN;
}
@Override
public int getBondingStyle(GBDevice deviceCandidate){
return BONDING_STYLE_NONE;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.ID115;
}
@Nullable
@Override
public Class<? extends Activity> getPairingActivity() {
return null;
}
@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 boolean supportsAlarmConfiguration() {
return false;
}
@Override
public boolean supportsSmartWakeup(GBDevice device) {
return false;
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
return false;
}
@Override
public String getManufacturer() {
return null;
}
@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;
}
}

View File

@ -50,6 +50,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor.AmazfitCorC
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2HRXCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2.MiBand2HRXCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.TeclastH30Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.jyou.TeclastH30Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.liveview.LiveviewCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.liveview.LiveviewCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst; import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
@ -211,6 +212,7 @@ public class DeviceHelper {
result.add(new EXRIZUK8Coordinator()); result.add(new EXRIZUK8Coordinator());
result.add(new TeclastH30Coordinator()); result.add(new TeclastH30Coordinator());
result.add(new XWatchCoordinator()); result.add(new XWatchCoordinator());
result.add(new ID115Coordinator());
return result; return result;
} }