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...



I tried both of the syntaxes suggested by Dave and Vincenzo, but on the call to the MyController method from the callback, I get a

Executable “CocoaApp” has exited due to signal 10 (SIGBUS).

Right now I have my USB callbacks defined in my MyController.m file, but outside the @implementation...@end. My USB call looks like:

err = (*intf)->ReadPipeAsync(intf, inPipeRef, (void *) inBuf, size, (IOAsyncCallback1)MyCallBackFunction, (void*) self);

In the callback i've tried the exact syntaxes suggested, but i get the error.

Am I missing anything?

Juan

On May 10, 2005, at 8:01 PM, Dave Camp wrote:

Without looking at the exact API's you are using, it should be something like this...

//You have a cocoa method that is calling a USB manager routine that takes a C function pointer and a user value.
- (void)myCocoaMethod
{
SomeUSBFunctionWithACallback(myCallback, self);
}


// Your C callback looks like this. It casts the user value back into an object pointer and dispatches appropriately
void myCallBack(void *refcon)
{
MyCocoaObject *object = (MyCocoaObject*)refcon;
[object someMethod];
}


Dave

On May 10, 2005, at 3:02 PM, Juan Pablo Pertierra wrote:

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



---
It's not denial. I'm just very particular about the reality I choose to accept. -Calvin



_______________________________________________ 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>)
 >Re: USB Callbacks and Cocoa App... (From: Dave Camp <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.