|
2013-02-14
, 10:47
|
|
Posts: 2,021 |
Thanked: 1,060 times |
Joined on Apr 2010
@ Hong Kong
|
#612
|
|
2013-02-14
, 11:19
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#613
|
qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/bme org.freedesktop.Hal.Device.GetAllProperties
|
2013-02-14
, 11:22
|
|
Posts: 644 |
Thanked: 480 times |
Joined on Jul 2012
@ Finland
|
#614
|
#!/usr/bin/python import QmSystem batt = QmSystem.QmBattery() time = batt.getRemainingChargingTime() hours,mod = divmod(time,3600) mins,secs = divmod(mod,60) result = '' if hours>0: result+=str(hours)+'h ' if mins>0: result+=str(mins)+'min' if batt.getChargingState()==1: print result else: print ""
|
2013-02-14
, 11:30
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#615
|
if batt.getChargingState()==1: print "charging" else: print "not charging"
The Following User Says Thank You to coderus For This Useful Post: | ||
|
2013-02-14
, 11:50
|
Posts: 59 |
Thanked: 168 times |
Joined on Mar 2010
@ Finland
|
#616
|
@jpel tryCode:qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/bme org.freedesktop.Hal.Device.GetAllProperties
#!/usr/bin/python import QmSystem batt = QmSystem.QmBattery() idle = batt.getAverageIdleCurrent(QmSystem.QmBattery.NormalMode) active = batt.getAverageActiveCurrent(QmSystem.QmBattery.NormalMode) print "Active:",active,"mA"," ","Idle:",idle,"mA"
startCurrentMeasurement (Period rate)
stopCurrentMeasurement ()
|
2013-02-14
, 12:17
|
Posts: 277 |
Thanked: 319 times |
Joined on Jan 2010
|
#617
|
#!/usr/bin/python import QmSystem psm = QmSystem.QmDeviceMode() psmstate = psm.getPSMState() if psmstate == psm.PSMStateOff: print 'PSM off' if psmstate == psm.PSMStateOn: print 'PSM on'
|
2013-02-14
, 12:21
|
Posts: 277 |
Thanked: 319 times |
Joined on Jan 2010
|
#618
|
I was thinking if there was an easy way of getting all this information from battery usage app that has already all needed data gathered since the last recharge.
|
2013-02-14
, 15:16
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#619
|
#!/usr/bin/python import QmSystem batt = QmSystem.QmBattery() if batt.getChargingState()==1: time = batt.getRemainingChargingTime() else: mode = QmSystem.QmBattery.NormalMode if QmSystem.QmDeviceMode().getPSMState() == 0 else QmSystem.QmBattery.PowersaveMode time = batt.getRemainingIdleTime(mode) time += batt.getRemainingTalkTime(mode) time = time/2 hours,mod = divmod(time,3600) mins,secs = divmod(mod,60) result = [] if hours == 1: result.append('%d hour' % hours) elif hours > 0: result.append('%d hours' % hours) if mins == 1: result.append('%d minute' % mins) elif mins > 0 or not result: result.append('%d minutes' % mins) print ' '.join(result)
The Following User Says Thank You to coderus For This Useful Post: | ||
|
2013-02-14
, 16:58
|
Posts: 87 |
Thanked: 14 times |
Joined on Jan 2012
|
#620
|
https://github.com/harmattan/billboa...mit/babeb97e06