Not sure though that having called IOCancelPowerChange(,) wether it
can be revoked before the 30 secs are up.
Perhaps a call to IOAllowPowerChange() will be effective.
The above is garbled nonsense
I can achieve the desired goal by NOT calling either
IOCancelPowerChange() or IOAllowPowerChange() immediately.
All that is necessary is to have registered for the IOKit notification.
Having done so I have 30 seconds in which to respond with either
IOCancelPowerChange() or IOAllowPowerChange().
So I can trigger my network comms in
void MGSSleepCallBack( void * refCon, io_service_t service, natural_t
messageType, void * messageArgument )
and when done simply call IOAllowPowerChange() to initiate sleep.