Re: RFCOMM Event listener using C
Hello Tommy, Can you tell me more about the problem ? Is it that rfcommEventListener is never called ? Or is it called but with no data ? If it is not called ever I would check if your code runs in a runloop (usully this involves calling CFRunloopRun() at the end of your main()). If it gets called with no data, or if the data does not make sense I would check the sender, maybe the problem lies there. ... Marco On Thursday, January 23, 2003, at 01:16 AM, Tommy Gunnarsson wrote: Hello. I'm trying to use the RFCOMM event listener with pure C but I have some problems. I'm using this C API:s to open a RFCOMM Channel: extern IOReturn IOBluetoothDeviceOpenRFCOMMChannel(...); extern IOReturn IOBluetoothRFCOMMChannelRegisterIncomingEventListener(...); But how can I use the listener? I tried to use the following example but I can't get it working. How should I make the event handling in Carbon? What does the IOBluetoothRFCOMMChannelIncomingEventListener do and how should I use it? Is it possible to use this API:s in pure C or must this be done in the objC language? I'm little confused right now. I hope someone with more knowledge has time to give a guide line. /Tommy void rfcommEventListener (IOBluetoothRFCOMMChannelRef rfcommChannel, void *refCon, IOBluetoothRFCOMMChannelEvent *event) { switch (event->eventType) { case kIOBluetoothRFCOMMNewDataEvent: // In thise case: // event->u.newData.dataPtr is a pointer to the block of data received. // event->u.newData.dataSize is the size of the block of data. break; case kIOBluetoothRFCOMMFlowControlChangedEvent: // In thise case: // event->u.flowStatus is the status of flow control (see IOBluetoothRFCOMMFlowControlStatus for current restrictions) break; case kIOBluetoothRFCOMMChannelTerminatedEvent: // In this case: // event->u.terminatedChannel is the channel that was terminated. It can be converted in an IOBluetoothRFCOMMChannel // object with [IOBluetoothRFCOMMChannel withRFCOMMChannelRef:]. (see below). break; } } typedef void (*IOBluetoothRFCOMMChannelIncomingEventListener)(IOBluetoothRFCOMMChann e lRef rfcommChannel, void *refCon, IOBluetoothRFCOMMChannelEvent *event); _______________________________________________ bluetooth-dev mailing list | bluetooth-dev@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/bluetooth-dev Do not post admin requests to the list. They will be ignored. _______________________________________________ bluetooth-dev mailing list | bluetooth-dev@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/bluetooth-dev Do not post admin requests to the list. They will be ignored.
participants (1)
-
Marco Pontil