2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-09-04 16:15:09 +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 //Only notify if change is meaningful enough
if (lastPackage == null || ( if (lastPackage == null
|| (
isCharging != lastPackage.getBoolean("isCharging") isCharging != lastPackage.getBoolean("isCharging")
|| currentCharge != lastPackage.getInt("currentCharge") || currentCharge != lastPackage.getInt("currentCharge")
) )
@@ -63,8 +64,15 @@ public class BatteryMonitorPackageInterface extends BasePackageInterface {
@Override @Override
public boolean onPackageReceived(Device d, NetworkPackage np) { public boolean onPackageReceived(Device d, NetworkPackage np) {
//Do nothing if (!np.getType().equals(NetworkPackage.PACKAGE_TYPE_BATTERY)) return false;
return false;
if (np.getBoolean("request")) {
if (lastPackage != null) {
sendPackage(lastPackage);
}
}
return true;
} }
@Override @Override