From 510d13037a06dfe75d6fdeac9eded5408b40e83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Mon, 28 Jan 2019 20:25:16 +0100 Subject: [PATCH] Add alarm configuration and fix a few small bugs --- .../casiogb6900/CasioGB6900Constants.java | 1 + .../CasioGB6900DeviceCoordinator.java | 2 +- .../casiogb6900/CasioGB6900DeviceSupport.java | 28 +++++++++++++++++-- .../casiogb6900/CasioHandlerThread.java | 5 +++- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900Constants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900Constants.java index af779fc2c..52fc0ea49 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900Constants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900Constants.java @@ -74,6 +74,7 @@ public final class CasioGB6900Constants { public static final UUID TX_POWER_LEVEL_CHARACTERISTIC_UUID = UUID.fromString("00002a07-0000-1000-8000-00805f9b34fb"); // Settings public static final UUID CASIO_SETTING_FOR_BLE_CHARACTERISTIC_UUID = UUID.fromString("26eb000f-b012-49a8-b1f8-394fb2032b0f"); + public static final UUID CASIO_SETTING_FOR_ALM_CHARACTERISTIC_UUID = UUID.fromString("26eb0013-b012-49a8-b1f8-394fb2032b0f"); // Notification Types diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900DeviceCoordinator.java index df9986f76..ae44233e0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casiogb6900/CasioGB6900DeviceCoordinator.java @@ -118,7 +118,7 @@ public class CasioGB6900DeviceCoordinator extends AbstractDeviceCoordinator { @Override public int getAlarmSlotCount() { - return 0; // 4 regular and one snooze but not yet implemented + return 5; // 4 regular and one snooze but not yet implemented } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioGB6900DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioGB6900DeviceSupport.java index d82dc19fc..1d82a4c50 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioGB6900DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casiogb6900/CasioGB6900DeviceSupport.java @@ -148,7 +148,6 @@ public class CasioGB6900DeviceSupport extends AbstractBTLEDeviceSupport { mCasioCharacteristics.clear(); mCasioCharacteristics.add(getCharacteristic(CasioGB6900Constants.CASIO_A_NOT_COM_SET_NOT)); mCasioCharacteristics.add(getCharacteristic(CasioGB6900Constants.CASIO_A_NOT_W_REQ_NOT)); - mCasioCharacteristics.add(getCharacteristic(CasioGB6900Constants.FUNCTION_SWITCH_CHARACTERISTIC)); mCasioCharacteristics.add(getCharacteristic(CasioGB6900Constants.ALERT_LEVEL_CHARACTERISTIC_UUID)); mCasioCharacteristics.add(getCharacteristic(CasioGB6900Constants.RINGER_CONTROL_POINT)); } @@ -239,8 +238,8 @@ public class CasioGB6900DeviceSupport extends AbstractBTLEDeviceSupport { LOG.info("Initialization done, setting state to INITIALIZED"); if(mHandlerThread == null) { mHandlerThread = new CasioHandlerThread(getDevice(), getContext(), this); - mHandlerThread.start(); } + mHandlerThread.start(); gbDevice.setState(GBDevice.State.INITIALIZED); gbDevice.sendDeviceUpdateIntent(getContext()); handled = true; @@ -445,7 +444,30 @@ public class CasioGB6900DeviceSupport extends AbstractBTLEDeviceSupport { @Override public void onSetAlarms(ArrayList alarms) { - + int alarmOffset = 4; + byte[] data = new byte[20]; + for(int i=0; i