2011-01-07 71 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