Skip navigation.
 
mlProblem sending notification from C callback function
FROM : Sandro Noel
DATE : Fri Jan 09 02:57:32 2009

Greetings.

I'm having a little problem due to lack of knowledge here.

I have this callback from DiskArbritation framework
and I would like to send a notification to my app.
but it does not seem to work.

the callback is registered like this.
daSession  = DASessionCreate(kCFAllocatorSystemDefault);         
DASessionScheduleWithRunLoop(daSession, [[NSRunLoop currentRunLoop] 
getCFRunLoop], kCFRunLoopCommonModes);
DARegisterDiskDisappearedCallback(daSession, NULL, 
&DiskDisappearedCallback, (void *)self);


the callback is defined like this.
void DiskDisappearedCallback(DADiskRef disk, void *context){
   CFDictionaryRef diskDescription = DADiskCopyDescription(disk);
   NSDictionary *nsDiskDescription = (NSDictionary *)diskDescription;
   
   NSString *name = [nsDiskDescription valueForKey:@"DAVolumeName"];
   NSString *type = [nsDiskDescription valueForKey:@"DAVolumeKind"];
   NSString *path = [nsDiskDescription valueForKey:@"DAVolumePath"];    

   [[NSNotificationCenter defaultCenter] 
postNotificationName:ADD_REMOVE_NOTIFICATION object:nil userInfo:nil];
}

Obviously, default center does not exist in the callback, but i cant 
seem to typecast the context to
my object type and retrieve the notification center from the object. i 
just do not know how to do it.

could someone enlighten me please ?

thank you Sandro Noel.

Related mailsAuthorDate
mlProblem sending notification from C callback function Sandro Noel Jan 9, 02:57
mlRe: Problem sending notification from C callback function Sean McBride Jan 9, 03:45
mlRe: Problem sending notification from C callback function Ken Thomases Jan 9, 08:09
mlRe: Problem sending notification from C callback function Sandro Noel Jan 9, 16:17