0

I found this in my travels:

http://www.opensource.apple.com/source/IOKitUser/IOKitUser-502/ps.subproj/IOPSKeys.h

How would I get the values (as a number) of:

#define kIOPSMaxCapacityKey "Max Capacity"

and

#define kIOPSDesignCapacityKey "DesignCapacity"

I want to be able to use them throughout my app. What do I need to add to my project and how do extract the numbers?

Many thanks,

Stuart

Stumf
  • 941
  • 1
  • 11
  • 26
  • Note that this is a Mac-specific header file, and doesn't apply to the iPhone. – Brad Larson Feb 08 '10 at 23:14
  • Thanks for the heads up Brad. Do you know of a similar header for use with an iPhone? Or is it not capable of returning such values? – Stumf Feb 15 '10 at 01:38

1 Answers1

1

Once you know where the actual dictionary is that it's storing these values, you can access the value from the dictionary using the following call:

CFDictionaryGetValue (
   CFDictionaryRef theDict,
   const void *key
);

Further examination of the directory http://www.opensource.apple.com/source/IOKitUser/IOKitUser-502/ps.subproj/ would probably allow you to figure out which objects/methods to call to get the dictionary, and the documentation within the class states what it points to (in your two previously mentioned keys, they point to CFNumbers, so in that case CFDictionaryGetValue will return a CFNumber.

Ryan
  • 2,460
  • 1
  • 21
  • 22