Powerdown notification
Powerdown notification
- Subject: Powerdown notification
- From: Matthew Mashyna <email@hidden>
- Date: Mon, 16 Mar 2009 09:54:56 -0400
I'm sorry for having to ask a noob question. I posted this to the
Darwin user list last week but didn't get any replies. I have a Cocoa
daemon that needs to monitor system events and relay them to a server.
Using NSWorkspace notification I get sleep and wake messages but I
can't seem to get the power down notification. So, other cocoa
developers pointed me to using IOKit. I tried this from my daemon
void myPowerDownCallback(void *refcon,
io_service_t service,
uint32_t messageType,
void *messageArgument )
{
DLog(@"System shutdown message!");
[gDaemon systemWillPowerOff];
} // myPowerDownCallback
// from my initialization code
{
...
IONotificationPortRef thePortRef;
io_object_t notifier;
io_connect_t c = IORegisterForSystemPower(NULL,
&thePortRef,
myPowerDownCallback,
¬ifier );
}
I don't think the callback gets called. I suppose that it could be
interrupted before it can send its message but I really don't think
I'm getting the callback. I'm a complete noob with it comes to IOKit.
Can someone tell me where I'm going wrong ?
Thanks,
Matt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden