• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Callbacks from IOKit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Callbacks from IOKit


  • Subject: Re: Callbacks from IOKit
  • From: Florent Pillet <email@hidden>
  • Date: Tue, 22 Apr 2008 12:53:03 +0200

Rick Mann wrote:
I'm doing some stuff with USB, and the example code I'm using uses IOServiceAddMatchingNotification() to add a pointer to a C callback to get notified when things happen on the USB bus.

In C++, one typically uses the refcon parameter in these APIs to pass a pointer to the C++ object responsible for handling the callback, and a pointer to a static C++ member function that massages the call into a method dispatch.

You will do the same in Cocoa, and in your callback function, use the refcon as your object id and call a method of your object.


Just make sure that the object in question is not autoreleased, otherwise you'll have some weird and difficult to debug issues.

Florent
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Callbacks from IOKit (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: [Ann] DMG Canvas
  • Next by Date: Re: Programmatically placing an item in the dock
  • Previous by thread: Callbacks from IOKit
  • Next by thread: vertically resize NSTextField frame
  • Index(es):
    • Date
    • Thread