2020-01-09 10:44:32 +01:00
|
|
|
/* Copyright (C) 2019-2020 Daniel Dakhno
|
2019-12-06 22:49:44 +01: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/>. */
|
2019-10-24 19:44:35 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter;
|
|
|
|
|
|
|
|
import android.bluetooth.BluetoothGatt;
|
|
|
|
import android.bluetooth.BluetoothGattCharacteristic;
|
|
|
|
import android.content.Context;
|
2020-04-10 00:48:46 +02:00
|
|
|
import android.net.Uri;
|
2019-10-24 19:44:35 +02:00
|
|
|
|
2019-11-20 00:56:09 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2019-10-28 12:35:22 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.NotificationConfiguration;
|
2019-11-20 00:56:09 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
2020-02-02 03:16:48 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
|
2019-12-31 15:25:30 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec;
|
2020-02-16 22:56:43 +01:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
2019-10-24 19:44:35 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.misfit.PlayNotificationRequest;
|
|
|
|
|
|
|
|
public abstract class WatchAdapter {
|
|
|
|
private QHybridSupport deviceSupport;
|
|
|
|
|
|
|
|
public WatchAdapter(QHybridSupport deviceSupport){
|
|
|
|
this.deviceSupport = deviceSupport;
|
|
|
|
}
|
|
|
|
|
2019-10-27 23:24:02 +01:00
|
|
|
public QHybridSupport getDeviceSupport(){
|
2019-10-24 19:44:35 +02:00
|
|
|
return this.deviceSupport;
|
|
|
|
}
|
|
|
|
|
2019-10-30 02:50:00 +01:00
|
|
|
public Context getContext(){
|
2019-10-24 19:44:35 +02:00
|
|
|
return getDeviceSupport().getContext();
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract void initialize();
|
|
|
|
|
|
|
|
public abstract void playPairingAnimation();
|
2019-10-28 12:35:22 +01:00
|
|
|
public abstract void playNotification(NotificationConfiguration config);
|
2019-10-24 19:44:35 +02:00
|
|
|
public abstract void setTime();
|
2019-11-24 00:44:14 +01:00
|
|
|
public abstract void overwriteButtons(String buttonConfigJson);
|
2019-10-24 19:44:35 +02:00
|
|
|
public abstract void setActivityHand(double progress);
|
|
|
|
public abstract void setHands(short hour, short minute);
|
|
|
|
public abstract void vibrate(PlayNotificationRequest.VibrationType vibration);
|
2019-10-25 19:13:55 +02:00
|
|
|
public abstract void vibrateFindMyDevicePattern();
|
2019-10-24 19:44:35 +02:00
|
|
|
public abstract void requestHandsControl();
|
|
|
|
public abstract void releaseHandsControl();
|
|
|
|
public abstract void setStepGoal(int stepGoal);
|
|
|
|
public abstract void setVibrationStrength(short strength);
|
2019-10-30 02:50:00 +01:00
|
|
|
public abstract void syncNotificationSettings();
|
2019-10-27 23:24:02 +01:00
|
|
|
public abstract void onTestNewFunction();
|
2019-11-20 18:59:13 +01:00
|
|
|
public abstract void setTimezoneOffsetMinutes(short offset);
|
2020-04-10 00:48:46 +02:00
|
|
|
public abstract void onInstallApp(Uri uri);
|
2019-10-24 19:44:35 +02:00
|
|
|
|
2019-11-04 02:47:38 +01:00
|
|
|
public abstract boolean supportsFindDevice();
|
2019-10-25 19:13:55 +02:00
|
|
|
public abstract boolean supportsExtendedVibration();
|
|
|
|
public abstract boolean supportsActivityHand();
|
2019-11-21 22:17:42 +01:00
|
|
|
|
|
|
|
public String getModelName() {
|
|
|
|
String modelNumber = getDeviceSupport().getDevice().getModel();
|
|
|
|
switch (modelNumber) {
|
|
|
|
case "HW.0.0":
|
|
|
|
return "Q Commuter";
|
|
|
|
case "HL.0.0":
|
|
|
|
return "Q Activist";
|
|
|
|
case "DN.1.0":
|
|
|
|
return "Hybrid HR Collider";
|
|
|
|
}
|
|
|
|
return "unknwon Q";
|
|
|
|
}
|
2019-10-25 19:13:55 +02:00
|
|
|
|
|
|
|
public abstract void onFetchActivityData();
|
|
|
|
|
2019-11-20 00:56:09 +01:00
|
|
|
public abstract void onSetAlarms(ArrayList<? extends Alarm> alarms);
|
|
|
|
|
2020-03-15 00:23:06 +01:00
|
|
|
public abstract void onSendConfiguration(String config);
|
|
|
|
|
2019-10-24 19:44:35 +02:00
|
|
|
public abstract boolean onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic);
|
2019-11-14 04:56:34 +01:00
|
|
|
public void onMtuChanged(BluetoothGatt gatt, int mtu, int status){};
|
2019-10-27 23:24:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
public String arrayToString(byte[] bytes) {
|
|
|
|
if (bytes.length == 0) return "";
|
|
|
|
StringBuilder s = new StringBuilder();
|
|
|
|
final String chars = "0123456789ABCDEF";
|
|
|
|
for (byte b : bytes) {
|
|
|
|
s.append(chars.charAt((b >> 4) & 0xF)).append(chars.charAt(b & 0xF)).append(" ");
|
|
|
|
}
|
|
|
|
return s.substring(0, s.length() - 1) + "\n";
|
|
|
|
}
|
2019-12-31 03:14:20 +01:00
|
|
|
|
|
|
|
public void setCommuteMenuMessage(String message, boolean finished) {
|
|
|
|
}
|
2019-12-31 15:25:30 +01:00
|
|
|
|
|
|
|
public void setMusicInfo(MusicSpec musicSpec) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMusicState(MusicStateSpec stateSpec) {
|
|
|
|
}
|
2020-01-03 02:33:47 +01:00
|
|
|
|
2020-01-04 00:24:29 +01:00
|
|
|
public void setWidgetContent(String widgetID, String content, boolean render) {
|
2020-01-03 02:33:47 +01:00
|
|
|
}
|
2020-01-19 04:01:57 +01:00
|
|
|
|
|
|
|
public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public void updateWidgets() {
|
|
|
|
}
|
2020-02-02 03:16:48 +01:00
|
|
|
|
|
|
|
public void onSetCallState(CallSpec callSpec) {
|
|
|
|
}
|
2020-02-16 01:41:14 +01:00
|
|
|
|
|
|
|
public void onFindDevice(boolean start) {
|
|
|
|
}
|
2020-02-16 22:56:43 +01:00
|
|
|
|
|
|
|
public void onSendWeather(WeatherSpec weatherSpec) {
|
|
|
|
}
|
2020-04-08 02:12:14 +02:00
|
|
|
|
|
|
|
public void setBackgroundImage(byte[] pixels) {
|
|
|
|
}
|
2019-10-24 19:44:35 +02:00
|
|
|
}
|