开发者

How can I get the battery status of a magic mouse? (in %)

how can I search for connected bluetooth/wireless device开发者_运维百科s e.g. a Magic Mouse? How can I get the % of the battery??

Please post me some code and explain it because I found somethings but I don't understand it really.

Thank you very much for your help.


I believe this can be answered with the following:

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

Hope it helps. This has been asked a few times as you can see.

Update

I know it's not Obj-C native api's but if you can't figure out IOPowerSources you can do this and parse the results

ioreg -l | grep BatteryPercent

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜