Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: USB Callbacks and Cocoa App...



The callbacks have a C function interface as you have noticed but contain an
info field which is a void pointer if I remember correctly. Initialize your
C callback functions to pass a pointer to your ObjC controller class in this
info parameter and then dispatch the C function call into a matching ObjC
method invocation, i.e. pass it through to let your object handle it using
the ObjC runtime system. From what I recall these callbacks are dispatched
as events on a runloop so if that's not your main event loop but a second
runloop on a separate thread as your post seems to imply then you will have
to deal with thread synchronization issues when dispatching the event from
the USB thread's runloop to your display (and usually main) thread's
runloop. That's another can of worms ...

-----Original Message-----
From: usb-bounces+vincenzo=email@hidden
[mailto:usb-bounces+vincenzo=email@hidden] On Behalf Of
Juan Pablo Pertierra
Sent: Tuesday, May 10, 2005 6:02 PM
To: email@hidden
Subject: USB Callbacks and Cocoa App...

Hello,

I am calling a separate thread in my Cocoa app to do reading from the 
USB port.  My problem is that the callback functions are not part of My 
Controller class, and i'd like the callback to trigger a function 
within my controller.  Basically i want the callback to the my 
controller that there is new data just received from the USB port to 
display.

Can/should i make the callbacks part of my controller class somehow?  
What should I do/use in this case?

Thanks,
Juan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden

References: 
 >USB Callbacks and Cocoa App... (From: Juan Pablo Pertierra <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.