public BatteryInfo GetBatteryInfo(long freshness) { if (this.lastBatteryInfo != null && this.lastBatteryCheckTime > (DateTime.Now.AddMilliseconds(-freshness))) { return(this.lastBatteryInfo); } BatteryReceiver receiver = new BatteryReceiver(); ExecuteShellCommand("dumpsys battery", receiver, BATTERY_TIMEOUT); this.lastBatteryInfo = receiver.BatteryInfo; this.lastBatteryCheckTime = DateTime.Now; return(this.lastBatteryInfo); }
public BatteryInfo GetBatteryInfo(long freshness) { if (this.lastBatteryInfo != null && this.lastBatteryCheckTime > (DateTime.Now.AddMilliseconds(-freshness))) { return this.lastBatteryInfo; } BatteryReceiver receiver = new BatteryReceiver(); ExecuteShellCommand("dumpsys battery", receiver, BATTERY_TIMEOUT); this.lastBatteryInfo = receiver.BatteryInfo; this.lastBatteryCheckTime = DateTime.Now; return this.lastBatteryInfo; }