antalkerekes
antalkerekes

Reputation: 2128

determining the power source used (Macintosh)

For a Mac application, I would need to test what kind of power source the computer is using at the moment, and get notified when that power source changes (i.e. switching to battery power).

Is there a way to do this? I haven't found anything like that in the documentation.

Upvotes: 0

Views: 216

Answers (1)

John Parker
John Parker

Reputation: 54445

I believe you can use the I/O Kit framework for this, specifically the IOPowerSources.h functions. (The IOPSNotificationCreateRunLoopSource callback will let you know if a power source has been connected/disconnected.)

Upvotes: 1

Related Questions