diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/smaq2oss/SMAQ2OSSSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/smaq2oss/SMAQ2OSSSupport.java index 483de4148..ea51e513b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/smaq2oss/SMAQ2OSSSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/smaq2oss/SMAQ2OSSSupport.java @@ -19,13 +19,11 @@ package nodomain.freeyourgadget.gadgetbridge.devices.smaq2oss; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; -import android.net.Uri; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; @@ -34,23 +32,17 @@ import java.nio.ByteBuffer; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl; -import nodomain.freeyourgadget.gadgetbridge.devices.smaq2oss.SMAQ2OSSConstants; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.Weather; import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction; import nodomain.freeyourgadget.gadgetbridge.proto.SMAQ2OSSProtos; -import nodomain.freeyourgadget.gadgetbridge.util.NotificationUtils; import nodomain.freeyourgadget.gadgetbridge.util.StringUtils; import static java.nio.charset.StandardCharsets.UTF_8; @@ -341,4 +333,13 @@ public class SMAQ2OSSSupport extends AbstractBTLEDeviceSupport { return this; } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java index a81eb5e52..f2bf2c071 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java @@ -112,7 +112,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.receivers.GBCallControlRecei import nodomain.freeyourgadget.gadgetbridge.service.receivers.GBMusicControlReceiver; import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.PendingIntentUtils; -import nodomain.freeyourgadget.gadgetbridge.util.Prefs; import nodomain.freeyourgadget.gadgetbridge.util.SilentMode; import nodomain.freeyourgadget.gadgetbridge.util.preferences.DevicePrefs; @@ -187,11 +186,6 @@ public abstract class AbstractDeviceSupport implements DeviceSupport { return this.scanReconnect; } - @Override - public boolean getImplicitCallbackModify() { - return true; - } - @Override public GBDevice getDevice() { return gbDevice; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupport.java index a27165535..ca4d482ed 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupport.java @@ -118,16 +118,6 @@ public interface DeviceSupport extends EventHandler { boolean getScanReconnect(); - /** - * Returns whether the gatt callback should be implicitly set to the one on the transaction, - * even if it was not set directly on the transaction. If true, the gatt callback will always - * be set to the one in the transaction, even if null and not explicitly set to null. - * See https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2912 for more information. - * This should be false by default, but we are making it configurable to avoid breaking - * older devices that rely on this behavior. - */ - boolean getImplicitCallbackModify(); - /** * Returns the associated device this instance communicates with. */ diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/ServiceDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/ServiceDeviceSupport.java index 8d120d42e..ad01d2cb8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/ServiceDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/ServiceDeviceSupport.java @@ -110,11 +110,6 @@ public class ServiceDeviceSupport implements DeviceSupport { return delegate.getScanReconnect(); } - @Override - public boolean getImplicitCallbackModify() { - return delegate.getImplicitCallbackModify(); - } - @Override public void dispose() { delegate.dispose(); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btbr/AbstractBTBRDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btbr/AbstractBTBRDeviceSupport.java index 7e583d891..479a484df 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btbr/AbstractBTBRDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btbr/AbstractBTBRDeviceSupport.java @@ -18,33 +18,28 @@ package nodomain.freeyourgadget.gadgetbridge.service.btbr; import org.slf4j.Logger; -import android.location.Location; - import java.io.IOException; -import java.util.ArrayList; import java.util.UUID; -import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.Logging; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.Reminder; -import nodomain.freeyourgadget.gadgetbridge.model.WorldClock; import nodomain.freeyourgadget.gadgetbridge.service.AbstractDeviceSupport; /** * Abstract base class for devices connected through a serial protocol, like RFCOMM BT or TCP socket. *

- * The connection to the device and all communication is made with a generic {@link BtClassicIo}. + * The connection to the device and all communication is made with a generic + * {@link nodomain.freeyourgadget.gadgetbridge.service.btclassic.BtClassicIoThread}. * Messages to the device are encoded - * sent via {@link BtClassicIo}. + * sent via {@link nodomain.freeyourgadget.gadgetbridge.service.btclassic.BtClassicIoThread}. * - * @see BtClassicIo + * @see nodomain.freeyourgadget.gadgetbridge.service.btclassic.BtClassicIoThread */ public abstract class AbstractBTBRDeviceSupport extends AbstractDeviceSupport implements SocketCallback { private BtBRQueue mQueue; private UUID mSupportedService = null; private int mBufferSize = 1024; - private Logger logger; + private final Logger logger; public AbstractBTBRDeviceSupport(Logger logger) { this.logger = logger; @@ -91,12 +86,12 @@ public abstract class AbstractBTBRDeviceSupport extends AbstractDeviceSupport im /** * Ensures that the device is connected and (only then) performs the actions of the given * transaction builder. - * + *

* In contrast to {@link #performInitialized(String)}, no initialization sequence is performed * with the device, only the actions of the given builder are executed. * @param transaction - * @throws IOException - * @see {@link #performInitialized(String)} + * @throws IOException if connection to the device fails + * @see #performInitialized(String) */ public void performConnected(Transaction transaction) throws IOException { if (!isConnected()) { @@ -115,7 +110,7 @@ public abstract class AbstractBTBRDeviceSupport extends AbstractDeviceSupport im * Subclasses should call this method to add services they support. * Only supported services will be queried for characteristics. * - * @param aSupportedService + * @param aSupportedService the supported service uuid */ protected void addSupportedService(UUID aSupportedService) { mSupportedService = aSupportedService; @@ -135,11 +130,9 @@ public abstract class AbstractBTBRDeviceSupport extends AbstractDeviceSupport im /** * Utility method that may be used to log incoming messages when we don't know how to deal with them yet. - * - * @param value */ public void logMessageContent(byte[] value) { - logger.info("RECEIVED DATA WITH LENGTH: " + ((value != null) ? value.length : "(null)")); + logger.info("RECEIVED DATA WITH LENGTH: {}", (value != null) ? value.length : "(null)"); Logging.logBytes(logger, value); } @@ -158,29 +151,4 @@ public abstract class AbstractBTBRDeviceSupport extends AbstractDeviceSupport im } } } - - @Override - public void onFindPhone(boolean start) {} - - @Override - public void onSetFmFrequency(float frequency) {} - - @Override - public void onSetLedColor(int color) {} - - @Override - public void onSetGpsLocation(Location location) {} - - @Override - public void onSetWorldClocks(ArrayList clocks) {} - - @Override - public void onPowerOff() {} - - @Override - public void onSetPhoneVolume(final float volume) {} - - @Override - public void onSetReminders(ArrayList reminders) {} - } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/AbstractBTLEDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/AbstractBTLEDeviceSupport.java index ba21acf8b..9d22ec9ff 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/AbstractBTLEDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/AbstractBTLEDeviceSupport.java @@ -22,7 +22,6 @@ import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattService; -import android.os.Bundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,7 +60,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im private Map mAvailableCharacteristics; private final Set mSupportedServices = new HashSet<>(4); private final Set mSupportedServerServices = new HashSet<>(4); - private Logger logger; + private final Logger logger; private final List> mSupportedProfiles = new ArrayList<>(); public static final String BASE_UUID = "0000%s-0000-1000-8000-00805f9b34fb"; //this is common for all BTLE devices. see http://stackoverflow.com/questions/18699251/finding-out-android-bluetooth-le-gatt-profiles @@ -92,17 +91,29 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im } } + /** + * Returns whether the gatt callback should be implicitly set to the one on the transaction, + * even if it was not set directly on the transaction. If true, the gatt callback will always + * be set to the one in the transaction, even if null and not explicitly set to null. + * See #2912 for + * more information. This is false by default, but we are making it configurable to avoid breaking + * older devices that rely on this behavior, so all older devices got this overridden to true. + */ + public boolean getImplicitCallbackModify() { + return false; + } + /** * Whether to send a write request response to the device, if requested. The standard actually - * expects this to happen, but Gadgetbridge did not originally support it. This is set to false - * to prevent breaking devices that are somehow not expecting the response. + * expects this to happen, but Gadgetbridge did not originally support it. This is set to true + * on all older devices that were not confirmed to handle the response well after this was introduced. *

- * See also: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2831#issuecomment-941568 + * See also: #2831#issuecomment-941568 * * @return whether to send write request responses, if a response is requested */ public boolean getSendWriteRequestResponse() { - return false; + return true; } @Override @@ -116,7 +127,6 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im /** * Subclasses should populate the given builder to initialize the device (if necessary). * - * @param builder * @return the same builder as passed as the argument */ protected TransactionBuilder initializeDevice(TransactionBuilder builder) { @@ -183,12 +193,11 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im /** * Ensures that the device is connected and (only then) performs the actions of the given * transaction builder. - * + *

* In contrast to {@link #performInitialized(String)}, no initialization sequence is performed * with the device, only the actions of the given builder are executed. - * @param transaction - * @throws IOException - * @see {@link #performInitialized(String)} + * @throws IOException if unable to connect to the device + * @see #performInitialized(String) */ public void performConnected(Transaction transaction) throws IOException { if (!isConnected()) { @@ -203,7 +212,6 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im * Performs the actions of the given transaction as soon as possible, * that is, before any other queued transactions, but after the actions * of the currently executing transaction. - * @param builder */ public void performImmediately(TransactionBuilder builder) throws IOException { if (!isConnected()) { @@ -220,7 +228,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im * Subclasses should call this method to add services they support. * Only supported services will be queried for characteristics. * - * @param aSupportedService + * @param aSupportedService supported service uuid * @see #getCharacteristic(UUID) */ protected void addSupportedService(UUID aSupportedService) { @@ -233,7 +241,6 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im /** * Subclasses should call this method to add server services they support. - * @param service */ protected void addSupportedServerService(BluetoothGattService service) { mSupportedServerServices.add(service); @@ -243,7 +250,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im * Returns the characteristic matching the given UUID. Only characteristics * are returned whose service is marked as supported. * - * @param uuid + * @param uuid characteristic uuid * @return the characteristic for the given UUID or null * @see #addSupportedService(UUID) */ @@ -265,16 +272,16 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im Map newCharacteristics = new HashMap<>(); for (BluetoothGattService service : discoveredGattServices) { if (supportedServices.contains(service.getUuid())) { - logger.debug("discovered supported service: " + BleNamesResolver.resolveServiceName(service.getUuid().toString()) + ": " + service.getUuid()); + logger.debug("discovered supported service: {}: {}", BleNamesResolver.resolveServiceName(service.getUuid().toString()), service.getUuid()); List characteristics = service.getCharacteristics(); if (characteristics == null || characteristics.isEmpty()) { - logger.warn("Supported LE service " + service.getUuid() + "did not return any characteristics"); + logger.warn("Supported LE service {} did not return any characteristics", service.getUuid()); continue; } HashMap intmAvailableCharacteristics = new HashMap<>(characteristics.size()); for (BluetoothGattCharacteristic characteristic : characteristics) { intmAvailableCharacteristics.put(characteristic.getUuid(), characteristic); - logger.info(" characteristic: " + BleNamesResolver.resolveCharacteristicName(characteristic.getUuid().toString()) + ": " + characteristic.getUuid()); + logger.info(" characteristic: {}: {}", BleNamesResolver.resolveCharacteristicName(characteristic.getUuid().toString()), characteristic.getUuid()); } newCharacteristics.putAll(intmAvailableCharacteristics); @@ -282,7 +289,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im mAvailableCharacteristics = newCharacteristics; } } else { - logger.debug("discovered unsupported service: " + BleNamesResolver.resolveServiceName(service.getUuid().toString()) + ": " + service.getUuid()); + logger.debug("discovered unsupported service: {}: {}", BleNamesResolver.resolveServiceName(service.getUuid().toString()), service.getUuid()); } } } @@ -293,18 +300,16 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im /** * Utility method that may be used to log incoming messages when we don't know how to deal with them yet. - * - * @param value */ public void logMessageContent(byte[] value) { - logger.info("RECEIVED DATA WITH LENGTH: " + ((value != null) ? value.length : "(null)")); + logger.info("RECEIVED DATA WITH LENGTH: {}", (value != null) ? value.length : "(null)"); Logging.logBytes(logger, value); } // default implementations of event handler methods (gatt callbacks) @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { - for (AbstractBleProfile profile : mSupportedProfiles) { + for (AbstractBleProfile profile : mSupportedProfiles) { profile.onConnectionStateChange(gatt, status, newState); } } @@ -323,7 +328,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im @Override public boolean onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { - for (AbstractBleProfile profile : mSupportedProfiles) { + for (AbstractBleProfile profile : mSupportedProfiles) { if (profile.onCharacteristicRead(gatt, characteristic, status)) { return true; } @@ -334,7 +339,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im @Override public boolean onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { - for (AbstractBleProfile profile : mSupportedProfiles) { + for (AbstractBleProfile profile : mSupportedProfiles) { if (profile.onCharacteristicWrite(gatt, characteristic, status)) { return true; } @@ -344,7 +349,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im @Override public boolean onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { - for (AbstractBleProfile profile : mSupportedProfiles) { + for (AbstractBleProfile profile : mSupportedProfiles) { if (profile.onDescriptorRead(gatt, descriptor, status)) { return true; } @@ -354,7 +359,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im @Override public boolean onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { - for (AbstractBleProfile profile : mSupportedProfiles) { + for (AbstractBleProfile profile : mSupportedProfiles) { if (profile.onDescriptorWrite(gatt, descriptor, status)) { return true; } @@ -362,15 +367,10 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im return false; } - @Override - public void onSleepAsAndroidAction(String action, Bundle extras) { - - } - @Override public boolean onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { - for (AbstractBleProfile profile : mSupportedProfiles) { + for (AbstractBleProfile profile : mSupportedProfiles) { if (profile.onCharacteristicChanged(gatt, characteristic)) { return true; } @@ -380,7 +380,7 @@ public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport im @Override public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) { - for (AbstractBleProfile profile : mSupportedProfiles) { + for (AbstractBleProfile profile : mSupportedProfiles) { profile.onReadRemoteRssi(gatt, rssi, status); } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/asteroidos/AsteroidOSDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/asteroidos/AsteroidOSDeviceSupport.java index b33cfca09..33c1f7d35 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/asteroidos/AsteroidOSDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/asteroidos/AsteroidOSDeviceSupport.java @@ -276,4 +276,13 @@ public class AsteroidOSDeviceSupport extends AbstractBTLEDeviceSupport { evaluateGBDeviceEvent(event); } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java index eef4a9958..54e6d84ba 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java @@ -82,7 +82,6 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; -import java.util.Collection; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; @@ -1897,6 +1896,16 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport { return image; } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } + public enum BangleJSBitmapStyle { MONOCHROME, // 1bpp MONOCHROME_TRANSPARENT, // 1bpp, black = transparent diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/binary_sensor/BinarySensorBaseSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/binary_sensor/BinarySensorBaseSupport.java index 9154edf10..4e6e33935 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/binary_sensor/BinarySensorBaseSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/binary_sensor/BinarySensorBaseSupport.java @@ -16,21 +16,8 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.service.devices.binary_sensor; -import android.net.Uri; - import org.slf4j.Logger; -import java.util.ArrayList; -import java.util.UUID; - -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; public class BinarySensorBaseSupport extends AbstractBTLEDeviceSupport { @@ -42,4 +29,14 @@ public class BinarySensorBaseSupport extends AbstractBTLEDeviceSupport { public boolean useAutoConnect() { return false; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/CasioSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/CasioSupport.java index 8f3ff85fb..6baa6b9b8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/CasioSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/CasioSupport.java @@ -16,8 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.service.devices.casio; -import android.net.Uri; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,4 +53,14 @@ public abstract class CasioSupport extends AbstractBTLEDeviceSupport { gbDevice.setState(GBDevice.State.INITIALIZED); gbDevice.sendDeviceUpdateIntent(getContext()); } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/cmfwatchpro/CmfWatchProSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/cmfwatchpro/CmfWatchProSupport.java index 826777cfc..920906e02 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/cmfwatchpro/CmfWatchProSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/cmfwatchpro/CmfWatchProSupport.java @@ -111,17 +111,6 @@ public class CmfWatchProSupport extends AbstractBTLEDeviceSupport implements Cmf public boolean useAutoConnect() { return true; } - - @Override - public boolean getImplicitCallbackModify() { - return false; - } - - @Override - public boolean getSendWriteRequestResponse() { - return true; - } - @Override protected TransactionBuilder initializeDevice(final TransactionBuilder builder) { builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext())); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/cycling_sensor/support/CyclingSensorBaseSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/cycling_sensor/support/CyclingSensorBaseSupport.java index 805248032..cdf419724 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/cycling_sensor/support/CyclingSensorBaseSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/cycling_sensor/support/CyclingSensorBaseSupport.java @@ -13,4 +13,14 @@ public class CyclingSensorBaseSupport extends AbstractBTLEDeviceSupport { public boolean useAutoConnect() { return false; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/domyos/DomyosT540Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/domyos/DomyosT540Support.java index ec62b3306..8e62743ff 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/domyos/DomyosT540Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/domyos/DomyosT540Support.java @@ -19,26 +19,16 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.domyos; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Intent; -import android.net.Uri; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import java.util.ArrayList; import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -311,4 +301,14 @@ public class DomyosT540Support extends AbstractBTLEDeviceSupport { builder.queue(getQueue()); } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/femometer/FemometerVinca2DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/femometer/FemometerVinca2DeviceSupport.java index 55c4ff48c..8f50da02f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/femometer/FemometerVinca2DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/femometer/FemometerVinca2DeviceSupport.java @@ -296,4 +296,14 @@ public class FemometerVinca2DeviceSupport extends AbstractBTLEDeviceSupport { LOG.error("Error acquiring database", e); } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/fitpro/FitProDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/fitpro/FitProDeviceSupport.java index c9641dd45..61460d2da 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/fitpro/FitProDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/fitpro/FitProDeviceSupport.java @@ -89,7 +89,6 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.fitpro.FitProConstant import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Intent; -import android.net.Uri; import android.widget.Toast; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -134,12 +133,8 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.DeviceService; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.Weather; import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; @@ -1452,4 +1447,14 @@ public class FitProDeviceSupport extends AbstractBTLEDeviceSupport { date.set(year, month - 1, day, 0, 0, 0); return date; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } \ No newline at end of file diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/flipper/zero/support/FlipperZeroBaseSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/flipper/zero/support/FlipperZeroBaseSupport.java index d631561f2..628c83e3c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/flipper/zero/support/FlipperZeroBaseSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/flipper/zero/support/FlipperZeroBaseSupport.java @@ -16,21 +16,8 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.service.devices.flipper.zero.support; -import android.net.Uri; - import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.UUID; - -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; public class FlipperZeroBaseSupport extends AbstractBTLEDeviceSupport { @@ -42,4 +29,14 @@ public class FlipperZeroBaseSupport extends AbstractBTLEDeviceSupport { public boolean useAutoConnect() { return false; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/hama/fit6900/HamaFit6900DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/hama/fit6900/HamaFit6900DeviceSupport.java index 7191ed31b..c05cf186b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/hama/fit6900/HamaFit6900DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/hama/fit6900/HamaFit6900DeviceSupport.java @@ -622,4 +622,14 @@ public final class HamaFit6900DeviceSupport extends AbstractBTLEDeviceSupport { event.level = level; evaluateGBDeviceEvent(event); */ } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/hplus/HPlusSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/hplus/HPlusSupport.java index 0e6f63846..3a281fa95 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/hplus/HPlusSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/hplus/HPlusSupport.java @@ -24,7 +24,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.hplus; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; -import android.net.Uri; import android.widget.Toast; import org.apache.commons.lang3.ArrayUtils; @@ -48,13 +47,10 @@ import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusWeatherCode; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.GenericItem; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; @@ -906,4 +902,13 @@ public class HPlusSupport extends AbstractBTLEDeviceSupport { } } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java index 8d4cebbc4..06da6e0c3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java @@ -26,8 +26,6 @@ import android.bluetooth.BluetoothGattCharacteristic; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; import android.location.Location; import android.net.Uri; import android.os.Handler; @@ -4313,4 +4311,14 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements protected void handleRawSensorData(final byte[] value) { LOG.warn("handleRawSensorData not implemented for HuamiSupport"); } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppos/ZeppOsSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppos/ZeppOsSupport.java index 702db42c2..ac9a8ff3a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppos/ZeppOsSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/zeppos/ZeppOsSupport.java @@ -240,7 +240,8 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer /** * Do not reset the gatt callback implicitly, as that would interrupt operations. - * See https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2912 for more information. + * See #2912 for more + * information. */ @Override public boolean getImplicitCallbackModify() { @@ -557,6 +558,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer @Override public void onSetContacts(ArrayList contacts) { + //noinspection unchecked contactsService.setContacts((List) contacts); } @@ -643,6 +645,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer // Write the agps epo update to a temporary file in cache, so we can reuse the firmware update operation final File cacheDir = getContext().getCacheDir(); final File agpsCacheDir = new File(cacheDir, "zepp-os-agps"); + //noinspection ResultOfMethodCallIgnored agpsCacheDir.mkdir(); final File uihhFile = new File(agpsCacheDir, "epo-agps.uihh"); @@ -1048,6 +1051,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer final String timeFormat = gbPrefs.getTimeFormat(); // FIXME: This "works", but the band does not update when the setting changes, so we don't do anything + //noinspection ConstantValue if (true) { LOG.warn("setDateTime is disabled"); return this; @@ -1519,6 +1523,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer } protected void handle2021Weather(final byte[] payload) { + //noinspection SwitchStatementWithTooFewBranches switch (payload[0]) { case WEATHER_CMD_DEFAULT_LOCATION_ACK: LOG.info("Weather default location ACK, status = {}", payload[1]); @@ -1546,6 +1551,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer } protected void handle2021UserInfo(final byte[] payload) { + //noinspection SwitchStatementWithTooFewBranches switch (payload[0]) { case USER_INFO_CMD_SET_ACK: LOG.info("Got user info set ack, status = {}", payload[1]); @@ -1571,7 +1577,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer case STEPS_CMD_REALTIME_NOTIFICATION: LOG.info("Got steps notification"); if (payload.length != 14) { - LOG.error("Unexpected steps reply payload length {}", payload.length); + LOG.error("Unexpected realtime notification payload length {}", payload.length); return; } handleRealtimeSteps(subarray(payload, 1, 14)); @@ -1582,6 +1588,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer } protected void handle2021VibrationPatterns(final byte[] payload) { + //noinspection SwitchStatementWithTooFewBranches switch (payload[0]) { case VIBRATION_PATTERN_ACK: LOG.info("Vibration Patterns ACK, status = {}", payload[1]); @@ -1669,6 +1676,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer try { final String validFilename = FileUtils.makeValidFileName(filename); final File targetFolder = new File(FileUtils.getExternalFilesDir(), fileDownloadsDir); + //noinspection ResultOfMethodCallIgnored targetFolder.mkdirs(); targetFile = new File(targetFolder, validFilename); } catch (final IOException e) { @@ -1678,6 +1686,7 @@ public class ZeppOsSupport extends HuamiSupport implements ZeppOsFileTransferSer try (FileOutputStream outputStream = new FileOutputStream(targetFile)) { final File targetFolder = new File(FileUtils.getExternalFilesDir(), fileDownloadsDir); + //noinspection ResultOfMethodCallIgnored targetFolder.mkdirs(); outputStream.write(data); } catch (final IOException e) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiLESupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiLESupport.java index 4d30cfd75..ff5fb9a42 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiLESupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiLESupport.java @@ -187,4 +187,14 @@ public class HuaweiLESupport extends AbstractBTLEDeviceSupport { public void onTestNewFunction() { supportProvider.onTestNewFunction(); } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/id115/ID115Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/id115/ID115Support.java index 1e07990f1..753ebb194 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/id115/ID115Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/id115/ID115Support.java @@ -18,30 +18,21 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.id115; import android.bluetooth.BluetoothGattCharacteristic; -import android.net.Uri; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.ArrayList; import java.util.Calendar; import java.util.TimeZone; -import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst; import nodomain.freeyourgadget.gadgetbridge.devices.id115.ID115Constants; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -237,4 +228,14 @@ public class ID115Support extends AbstractBTLEDeviceSupport { LOG.warn("Unable to stop call notification", e); } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/itag/ITagSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/itag/ITagSupport.java index d132160e7..b7f9eea61 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/itag/ITagSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/itag/ITagSupport.java @@ -18,31 +18,16 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.itag; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; -import android.content.BroadcastReceiver; -import android.content.Context; import android.content.Intent; -import android.content.IntentFilter; -import android.net.Uri; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo; import nodomain.freeyourgadget.gadgetbridge.devices.itag.ITagConstants; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -160,4 +145,14 @@ public class ITagSupport extends AbstractBTLEDeviceSupport { LOG.info("Unhandled characteristic read: " + characteristicUUID); return false; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/BFH16DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/BFH16DeviceSupport.java index 3751e3734..d85d7378f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/BFH16DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/BFH16DeviceSupport.java @@ -53,7 +53,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.jyou; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; -import android.net.Uri; import android.widget.Toast; import org.slf4j.Logger; @@ -71,13 +70,8 @@ import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInf import nodomain.freeyourgadget.gadgetbridge.devices.jyou.BFH16Constants; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.util.AlarmUtils; @@ -546,4 +540,13 @@ public class BFH16DeviceSupport extends AbstractBTLEDeviceSupport { return null; } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/JYouSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/JYouSupport.java index 59325f1a7..a70f20f44 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/JYouSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/JYouSupport.java @@ -18,7 +18,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.jyou; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; -import android.net.Uri; import android.widget.Toast; import org.slf4j.Logger; @@ -28,20 +27,14 @@ import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Calendar; -import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo; import nodomain.freeyourgadget.gadgetbridge.devices.jyou.JYouConstants; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.util.AlarmUtils; @@ -333,4 +326,14 @@ public class JYouSupport extends AbstractBTLEDeviceSupport { } return null; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java index ccd055f41..66d6af641 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java @@ -21,7 +21,6 @@ import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Intent; import android.content.SharedPreferences; -import android.net.Uri; import android.text.format.DateFormat; import android.widget.Toast; @@ -36,7 +35,6 @@ import java.util.Calendar; import java.util.Collections; import java.util.List; import java.util.Queue; -import java.util.UUID; import java.util.concurrent.ConcurrentLinkedQueue; import de.greenrobot.dao.query.Query; @@ -64,15 +62,10 @@ import nodomain.freeyourgadget.gadgetbridge.entities.LefunSleepSample; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.DeviceService; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -1028,4 +1021,14 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport { } } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lenovo/watchxplus/WatchXPlusDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lenovo/watchxplus/WatchXPlusDeviceSupport.java index 41d820308..b0f82db23 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lenovo/watchxplus/WatchXPlusDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lenovo/watchxplus/WatchXPlusDeviceSupport.java @@ -24,7 +24,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; -import android.net.Uri; import android.os.Handler; import android.widget.Toast; @@ -71,11 +70,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; @@ -2094,6 +2089,15 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport { } } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } private static class Conversion { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/makibeshr3/MakibesHR3DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/makibeshr3/MakibesHR3DeviceSupport.java index f06234a2d..0ea67e376 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/makibeshr3/MakibesHR3DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/makibeshr3/MakibesHR3DeviceSupport.java @@ -32,7 +32,6 @@ import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Intent; import android.content.SharedPreferences; -import android.net.Uri; import android.os.CountDownTimer; import android.os.Handler; import android.widget.Toast; @@ -70,14 +69,9 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.DeviceService; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol; @@ -1063,4 +1057,14 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement return this; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java index e749df26b..ff2cf979d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/MiBandSupport.java @@ -64,17 +64,12 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarEvent; import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarManager; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.DeviceService; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationType; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions; import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEAction; @@ -1279,4 +1274,14 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport { } } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/mijia_lywsd/MijiaLywsdSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/mijia_lywsd/MijiaLywsdSupport.java index 688c43b4d..5bac80878 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/mijia_lywsd/MijiaLywsdSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/mijia_lywsd/MijiaLywsdSupport.java @@ -210,4 +210,14 @@ public class MijiaLywsdSupport extends AbstractBTLEDeviceSupport { GB.toast("Error setting configuration", Toast.LENGTH_LONG, GB.ERROR, e); } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miscale2/MiScale2DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miscale2/MiScale2DeviceSupport.java index ef81950a5..9d11bcbc1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miscale2/MiScale2DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miscale2/MiScale2DeviceSupport.java @@ -20,13 +20,11 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.miscale2; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Intent; -import android.net.Uri; import android.widget.Toast; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -34,14 +32,6 @@ import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattCharacteristic; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; @@ -159,4 +149,14 @@ public class MiScale2DeviceSupport extends AbstractBTLEDeviceSupport { public boolean useAutoConnect() { return false; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/no1f1/No1F1Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/no1f1/No1F1Support.java index e4bbf413d..ac0bccf4b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/no1f1/No1F1Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/no1f1/No1F1Support.java @@ -20,7 +20,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.no1f1; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; -import android.net.Uri; import android.text.format.DateFormat; import android.widget.Toast; @@ -49,13 +48,8 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceBusyAction; @@ -595,4 +589,14 @@ public class No1F1Support extends AbstractBTLEDeviceSupport { } } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/nut/NutSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/nut/NutSupport.java index cb22d2078..ce128ec18 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/nut/NutSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/nut/NutSupport.java @@ -20,14 +20,12 @@ import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Intent; import android.content.SharedPreferences; -import android.net.Uri; import android.widget.Toast; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.math.BigInteger; -import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.util.UUID; @@ -38,14 +36,6 @@ import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInf import nodomain.freeyourgadget.gadgetbridge.devices.nut.NutConstants; import nodomain.freeyourgadget.gadgetbridge.devices.nut.NutKey; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction; @@ -485,4 +475,14 @@ public class NutSupport extends AbstractBTLEDeviceSupport { builder.read(characteristic); builder.queue(getQueue()); } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pinetime/PineTimeJFSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pinetime/PineTimeJFSupport.java index fd474ea99..355526da1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pinetime/PineTimeJFSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pinetime/PineTimeJFSupport.java @@ -1262,4 +1262,14 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL LOG.debug(logMessage); //GB.toast(getContext(), toastMessage, Toast.LENGTH_LONG, GB.WARN); } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridBaseSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridBaseSupport.java index 38fd2911f..fe731096a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridBaseSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridBaseSupport.java @@ -16,21 +16,8 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid; -import android.net.Uri; - import org.slf4j.Logger; -import java.util.ArrayList; -import java.util.UUID; - -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; class QHybridBaseSupport extends AbstractBTLEDeviceSupport { @@ -43,4 +30,13 @@ class QHybridBaseSupport extends AbstractBTLEDeviceSupport { return false; } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/soflow/SoFlowSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/soflow/SoFlowSupport.java index 8f3e19d75..170ac736c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/soflow/SoFlowSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/soflow/SoFlowSupport.java @@ -39,7 +39,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -372,4 +371,14 @@ public class SoFlowSupport extends AbstractBTLEDeviceSupport { GB.toast("Error setting configuration", Toast.LENGTH_LONG, GB.ERROR, e); } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wena3/SonyWena3DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wena3/SonyWena3DeviceSupport.java index 57cfc356a..9d0d5512c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wena3/SonyWena3DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/wena3/SonyWena3DeviceSupport.java @@ -1068,4 +1068,14 @@ public class SonyWena3DeviceSupport extends AbstractBTLEDeviceSupport { GB.toast("Failed to send settings update", Toast.LENGTH_SHORT, GB.ERROR); } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sonyswr12/SonySWR12DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sonyswr12/SonySWR12DeviceSupport.java index 6c90ea247..37e501f48 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sonyswr12/SonySWR12DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sonyswr12/SonySWR12DeviceSupport.java @@ -19,7 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Intent; -import android.net.Uri; import android.widget.Toast; import org.slf4j.Logger; @@ -36,13 +35,6 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHelper; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -241,4 +233,14 @@ public class SonySWR12DeviceSupport extends AbstractBTLEDeviceSupport { LOG.error("failed to send config " + config, exc); } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/supercars/SuperCarsSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/supercars/SuperCarsSupport.java index 7cdceacfd..0e3238888 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/supercars/SuperCarsSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/supercars/SuperCarsSupport.java @@ -22,28 +22,18 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.net.Uri; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo; import nodomain.freeyourgadget.gadgetbridge.devices.supercars.SuperCarsConstants; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction; @@ -221,5 +211,14 @@ public class SuperCarsSupport extends AbstractBTLEDeviceSupport { LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(commandReceiver); } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/tlw64/TLW64Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/tlw64/TLW64Support.java index 5c3f3ff81..e76c49272 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/tlw64/TLW64Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/tlw64/TLW64Support.java @@ -585,4 +585,14 @@ public class TLW64Support extends AbstractBTLEDeviceSupport { GB.updateTransferNotification(null, getContext().getString(R.string.busy_task_fetch_activity_data), true, progress, getContext()); } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25BaseSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25BaseSupport.java index 8f236956f..3677fa0d7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25BaseSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25BaseSupport.java @@ -16,21 +16,8 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.service.devices.um25.Support; -import android.net.Uri; - import org.slf4j.Logger; -import java.util.ArrayList; -import java.util.UUID; - -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; public class UM25BaseSupport extends AbstractBTLEDeviceSupport { @@ -42,4 +29,14 @@ public class UM25BaseSupport extends AbstractBTLEDeviceSupport { public boolean useAutoConnect() { return false; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vesc/VescBaseDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vesc/VescBaseDeviceSupport.java index 00ed75ee2..7c7f0453d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vesc/VescBaseDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vesc/VescBaseDeviceSupport.java @@ -16,21 +16,9 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.service.devices.vesc; -import android.net.Uri; - -import java.util.ArrayList; -import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; public class VescBaseDeviceSupport extends AbstractBTLEDeviceSupport { @@ -44,4 +32,14 @@ public class VescBaseDeviceSupport extends AbstractBTLEDeviceSupport { public boolean useAutoConnect() { return false; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vibratissimo/VibratissimoSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vibratissimo/VibratissimoSupport.java index 45a017fa3..1aa6ad2e7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vibratissimo/VibratissimoSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vibratissimo/VibratissimoSupport.java @@ -20,25 +20,15 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.vibratissimo; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Intent; -import android.net.Uri; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -159,4 +149,14 @@ public class VibratissimoSupport extends AbstractBTLEDeviceSupport { LOG.info("Unhandled characteristic read: " + characteristicUUID); return false; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/waspos/WaspOSDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/waspos/WaspOSDeviceSupport.java index 9884c2679..e4bd4043d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/waspos/WaspOSDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/waspos/WaspOSDeviceSupport.java @@ -19,8 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.waspos; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; -import android.content.Context; -import android.net.Uri; import android.text.format.DateFormat; import android.widget.Toast; @@ -34,10 +32,8 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Calendar; -import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.GBApplication; -import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone; @@ -47,9 +43,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.waspos.WaspOSConstants; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; @@ -399,4 +393,14 @@ public class WaspOSDeviceSupport extends AbstractBTLEDeviceSupport { LOG.info("JSONException: " + e.getLocalizedMessage()); } } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/watch9/Watch9DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/watch9/Watch9DeviceSupport.java index 3b888b2bb..47346b24b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/watch9/Watch9DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/watch9/Watch9DeviceSupport.java @@ -24,7 +24,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.net.Uri; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,13 +45,8 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; @@ -478,6 +472,16 @@ public class Watch9DeviceSupport extends AbstractBTLEDeviceSupport { super.dispose(); } + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } + private static class Conversion { static byte[] toByteArr16(int value) { return new byte[]{(byte) (value >> 8), (byte) value}; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/withingssteelhr/WithingsSteelHRDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/withingssteelhr/WithingsSteelHRDeviceSupport.java index 997067b24..3bd6f451a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/withingssteelhr/WithingsSteelHRDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/withingssteelhr/WithingsSteelHRDeviceSupport.java @@ -16,8 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr; -import static nodomain.freeyourgadget.gadgetbridge.GBApplication.getContext; - import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; @@ -48,17 +46,13 @@ import java.util.List; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity; -import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusConstants; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationType; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.ServerTransactionBuilder; @@ -186,12 +180,6 @@ public class WithingsSteelHRDeviceSupport extends AbstractBTLEDeviceSupport { LocalBroadcastManager.getInstance(GBApplication.getContext()).registerReceiver(commandReceiver, commandFilter); } - @Override - public boolean getSendWriteRequestResponse() { - return true; - } - - @Override protected TransactionBuilder initializeDevice(TransactionBuilder builder) { logger.debug("Starting initialization..."); @@ -757,4 +745,8 @@ public class WithingsSteelHRDeviceSupport extends AbstractBTLEDeviceSupport { } } + @Override + public boolean getImplicitCallbackModify() { + return true; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiBleSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiBleSupport.java index 105bb27e9..1f3e2bbbb 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiBleSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiBleSupport.java @@ -207,11 +207,6 @@ public class XiaomiBleSupport extends XiaomiConnectionSupport { return false; } - @Override - public boolean getImplicitCallbackModify() { - return mXiaomiSupport.getImplicitCallbackModify(); - } - @Override public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) { super.onMtuChanged(gatt, mtu, status); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiSupport.java index bbab2636f..bb200fd6d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/XiaomiSupport.java @@ -122,11 +122,6 @@ public class XiaomiSupport extends AbstractDeviceSupport { } } - @Override - public boolean getImplicitCallbackModify() { - return false; - } - private DeviceCoordinator.ConnectionType getForcedConnectionTypeFromPrefs() { final String connTypeAuto = getContext().getString(R.string.pref_force_connection_type_auto_value); String connTypePref = getDevicePrefs().getString(PREF_FORCE_CONNECTION_TYPE, connTypeAuto); @@ -415,6 +410,7 @@ public class XiaomiSupport extends AbstractDeviceSupport { @Override public void onSetContacts(ArrayList contacts) { + //noinspection unchecked phonebookService.setContacts((List) contacts); } @@ -521,7 +517,7 @@ public class XiaomiSupport extends AbstractDeviceSupport { LOG.warn("Failed to parse {}", fileId); } } catch (final Exception ex) { - LOG.error("Exception while parsing " + fileId, ex); + LOG.error("Exception while parsing {}", fileId, ex); } } } catch (final Exception e) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xwatch/XWatchSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xwatch/XWatchSupport.java index bda8fa765..bc67f2aa1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xwatch/XWatchSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xwatch/XWatchSupport.java @@ -21,7 +21,6 @@ import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.Context; import android.media.AudioManager; -import android.net.Uri; import android.view.KeyEvent; import android.widget.Toast; @@ -48,13 +47,8 @@ import nodomain.freeyourgadget.gadgetbridge.entities.XWatchActivitySample; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State; import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.Alarm; -import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; -import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction; @@ -484,4 +478,14 @@ public class XWatchSupport extends AbstractBTLEDeviceSupport { return timestamp; } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java index cbe08bbaa..e32e93ebd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java @@ -21,7 +21,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.zetime; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.SharedPreferences; -import android.net.Uri; import android.widget.Toast; import org.slf4j.Logger; @@ -59,7 +58,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.BatteryState; import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec; import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarEvent; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; @@ -2230,4 +2228,14 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { } sendMsgToWatch(builder, languageMsg); } + + @Override + public boolean getImplicitCallbackModify() { + return true; + } + + @Override + public boolean getSendWriteRequestResponse() { + return false; + } }