1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-11 16:04:05 +02:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/WatchAdapter.java

137 lines
4.8 KiB
Java
Raw Normal View History

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;
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;
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;
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;
}
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);
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);
2019-10-24 19:44:35 +02: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);
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() {
}
public void onSetCallState(CallSpec callSpec) {
}
2020-02-16 01:41:14 +01:00
public void onFindDevice(boolean start) {
}
public void onSendWeather(WeatherSpec weatherSpec) {
}
public void setBackgroundImage(byte[] pixels) {
}
2019-10-24 19:44:35 +02:00
}