IOPSCreateLimitedPowerNotification

Function IOPSCreateLimitedPowerNotification 

Source
pub unsafe extern "C-unwind" fn IOPSCreateLimitedPowerNotification(
    callback: IOPowerSourceCallbackType,
    context: *mut c_void,
) -> Option<CFRetained<CFRunLoopSource>>
Available on crate feature ps only.
Expand description

Returns a CFRunLoopSourceRef that notifies the caller when power source changes from an unlimited power source (like attached to wall, car, or airplane power), to a limited power source (like a battery or UPS).

Returns a CFRunLoopSourceRef for scheduling with your CFRunLoop. If your project does not use a CFRunLoop, you can alternatively receive this notification via notify.h using the name

 kIOPSNotifyPowerSource

Parameter callback: A function to be called whenever the power source changes from AC to DC..

Parameter context: Any user-defined pointer, passed to the IOPowerSource callback.

Returns: Returns NULL if an error was encountered, otherwise a CFRunLoopSource. Caller must release the CFRunLoopSource.

ยงSafety

  • callback must be implemented correctly.
  • context must be a valid pointer.