2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-09-03 15:45:10 +00:00

Answer battery status requests

This commit is contained in:
Albert Vaca
2013-08-14 00:02:31 +02:00
parent 53f8af551d
commit b3ca862ba8

View File

@@ -34,7 +34,8 @@ public class BatteryMonitorPackageInterface extends BasePackageInterface {
}
//Only notify if change is meaningful enough
if (lastPackage == null || (
if (lastPackage == null
|| (
isCharging != lastPackage.getBoolean("isCharging")
|| currentCharge != lastPackage.getInt("currentCharge")
)
@@ -63,8 +64,15 @@ public class BatteryMonitorPackageInterface extends BasePackageInterface {
@Override
public boolean onPackageReceived(Device d, NetworkPackage np) {
//Do nothing
return false;
if (!np.getType().equals(NetworkPackage.PACKAGE_TYPE_BATTERY)) return false;
if (np.getBoolean("request")) {
if (lastPackage != null) {
sendPackage(lastPackage);
}
}
return true;
}
@Override