2011-01-07 69 views

回答

1

我相信这可以通过回答以下几点:

How to get the battery life of mac os x macbooks programatically?

Battery status in OSX?

Getting iPhone's battery level

How to get the Battery Charge Level specifically in mWh (not percentage) for Mac (Cocoa or C)

http://developer.apple.com/library/mac/#documentation/DeviceDrivers/Reference/IOBluetoothUI/index.html#//apple_ref/doc/uid/TP30000813

希望它有帮助。你已经问过几次了,你可以看到。

更新

我知道这不是对象 - 原生API的,但如果你不能找出IOPowerSources你可以做到这一点,并解析结果

ioreg -l | grep BatteryPercent

+0

现在的问题是如何我可以得到鼠标的状态吗? 4.链接帮助了我一点,但我怎么能得到鼠标? – cocos2dbeginner 2011-01-07 16:39:57