diff --git a/bluetooth1/device.go b/bluetooth1/device.go index 126381626..232dc65fb 100644 --- a/bluetooth1/device.go +++ b/bluetooth1/device.go @@ -54,7 +54,7 @@ type DeviceInfo struct { RSSI int16 Address string - Battery bool + Battery byte } func unmarshalDeviceInfo(data string) (*DeviceInfo, error) { diff --git a/system/bluetooth1/bluetooth.go b/system/bluetooth1/bluetooth.go index e868fee76..4f1a6bacf 100644 --- a/system/bluetooth1/bluetooth.go +++ b/system/bluetooth1/bluetooth.go @@ -557,13 +557,13 @@ func (b *SysBluetooth) updateBatteryForAdd(devPath dbus.ObjectPath) { func (b *SysBluetooth) updateBatteryForRemove(devPath dbus.ObjectPath) { if b.isDeviceExists(devPath) { d, _ := b.getDevice(devPath) - d.Battery = false + d.Battery = 0 // update backup battery b.backupDevicesMu.Lock() idx := b.indexBackupDeviceNoLock(d.AdapterPath, devPath) if idx != -1 { - b.backupDevices[d.AdapterPath][idx].Battery = false + b.backupDevices[d.AdapterPath][idx].Battery = 0 } b.backupDevicesMu.Unlock() diff --git a/system/bluetooth1/device.go b/system/bluetooth1/device.go index c5462d2d4..4472dc754 100644 --- a/system/bluetooth1/device.go +++ b/system/bluetooth1/device.go @@ -72,7 +72,7 @@ type device struct { RSSI int16 Address string - Battery bool + Battery byte connected bool connectedTime time.Time @@ -117,7 +117,7 @@ type backupDevice struct { RSSI int16 Address string - Battery bool + Battery byte } type connectPhase uint32 @@ -497,7 +497,7 @@ func (d *device) connectProperties() { d.blocked = value }) - _ = d.core.Battery().Percentage().ConnectChanged(func(hasValue bool, value bool) { + _ = d.core.Battery().Percentage().ConnectChanged(func(hasValue bool, value byte) { if !hasValue { return }