mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 18:45:49 +01:00
fix BatteryInfoProfile NPE, show battery level for Vibratissimo
This commit is contained in:
parent
b2669d6fd7
commit
da01a76594
@ -27,7 +27,7 @@ public class BatteryInfoProfile<T extends AbstractBTLEDeviceSupport> extends Abs
|
|||||||
public static final UUID SERVICE_UUID = GattService.UUID_SERVICE_BATTERY_SERVICE;
|
public static final UUID SERVICE_UUID = GattService.UUID_SERVICE_BATTERY_SERVICE;
|
||||||
|
|
||||||
public static final UUID UUID_CHARACTERISTIC_BATTERY_LEVEL = GattCharacteristic.UUID_CHARACTERISTIC_BATTERY_LEVEL;
|
public static final UUID UUID_CHARACTERISTIC_BATTERY_LEVEL = GattCharacteristic.UUID_CHARACTERISTIC_BATTERY_LEVEL;
|
||||||
private BatteryInfo batteryInfo;
|
private final BatteryInfo batteryInfo = new BatteryInfo();
|
||||||
|
|
||||||
public BatteryInfoProfile(T support) {
|
public BatteryInfoProfile(T support) {
|
||||||
super(support);
|
super(support);
|
||||||
|
@ -57,6 +57,7 @@ public class VibratissimoSupport extends AbstractBTLEDeviceSupport {
|
|||||||
addSupportedService(GattService.UUID_SERVICE_GENERIC_ACCESS);
|
addSupportedService(GattService.UUID_SERVICE_GENERIC_ACCESS);
|
||||||
addSupportedService(GattService.UUID_SERVICE_GENERIC_ATTRIBUTE);
|
addSupportedService(GattService.UUID_SERVICE_GENERIC_ATTRIBUTE);
|
||||||
addSupportedService(GattService.UUID_SERVICE_DEVICE_INFORMATION);
|
addSupportedService(GattService.UUID_SERVICE_DEVICE_INFORMATION);
|
||||||
|
addSupportedService(GattService.UUID_SERVICE_BATTERY_SERVICE);
|
||||||
addSupportedService(UUID.fromString("00001523-1212-efde-1523-785feabcd123"));
|
addSupportedService(UUID.fromString("00001523-1212-efde-1523-785feabcd123"));
|
||||||
|
|
||||||
deviceInfoProfile = new DeviceInfoProfile<>(this);
|
deviceInfoProfile = new DeviceInfoProfile<>(this);
|
||||||
@ -88,6 +89,7 @@ public class VibratissimoSupport extends AbstractBTLEDeviceSupport {
|
|||||||
builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext()));
|
builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext()));
|
||||||
requestDeviceInfo(builder);
|
requestDeviceInfo(builder);
|
||||||
setInitialized(builder);
|
setInitialized(builder);
|
||||||
|
batteryInfoProfile.requestBatteryInfo(builder);
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user