RFCOMM Event listener using C
RFCOMM Event listener using C
- Subject: RFCOMM Event listener using C
- From: Tommy Gunnarsson <email@hidden>
- Date: Thu, 23 Jan 2003 10:16:27 +0100
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)(IOBluetoothRFCOMMChanne
lRef rfcommChannel, void *refCon, IOBluetoothRFCOMMChannelEvent *event);
_______________________________________________
bluetooth-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/bluetooth-dev
Do not post admin requests to the list. They will be ignored.