Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A while ago I wrote a program called iox that is similar to ioreg, except it makes it easier for me to translate back to IOKit calls. When I run that on my laptop, I see the following with a battery level.</p> <pre><code>AppleSmartBattery - IOService:/AppleACPIPlatformExpert/SMB0/AppleECSMBusController/AppleSmartBatteryManager/AppleSmartBattery CurrentCapacity = 11678 FullyCharged = YES DesignCapacity = 13000 MaxCapacity = 11910 ... </code></pre> <p>In code, that is</p> <pre><code>IOServiceNameMatching( "AppleSmartBattery" ); </code></pre> <p>I have no idea if the name would be the same on iOS, but I would try either finding a program like ioreg that you can run on the iPhone, or writing something simple to log the equivalent.</p> <p>ioreg is part of <a href="http://www.opensource.apple.com/source/IOKitTools/IOKitTools-78/" rel="noreferrer">IOKitTools</a> and it should just compile on iPhone.</p> <p>Edit:</p> <pre><code>CFMutableDictionaryRef matching , properties = NULL; io_registry_entry_t entry = 0; matching = IOServiceMatching( "IOPMPowerSource" ); //matching = IOServiceNameMatching( "AppleSmartBattery" ); entry = IOServiceGetMatchingService( kIOMasterPortDefault , matching ); IORegistryEntryCreateCFProperties( entry , &amp;properties , NULL , 0 ); NSLog( @"%@" , properties ); CFRelease( properties ); IOObjectRelease( entry ); </code></pre> <p>Add some safety checks. Once you figure out the specific properties you want, you can get them directly instead of using IORegistryEntryCreateCFProperties to get them all at once.</p> <p>IOKit represents everything as a big tree. IOPMPowerSource may not directly have the attributes you want, in which case you would need to iterate through the children. Using something like ioreg can tell you what you are looking for before you start coding.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload