Looking for Sample Code/Help with openRFCOMMChannelAsync:
Looking for Sample Code/Help with openRFCOMMChannelAsync:
- Subject: Looking for Sample Code/Help with openRFCOMMChannelAsync:
- From: Janice McLaughlin <email@hidden>
- Date: Fri, 21 Jun 2013 19:12:39 -0700
Hi all,
I have some legacy code that I am incorporating into my application. It was originally written as a command line tool and I'm making it work in my NSWindow based application. It works once just fine and connects to the device and transfers data and then things get shut down. But I can't ever connect again to the same device in the same run of the application. The legacy code finished and never made another connection before exiting and so never had to worry about cleaning up properly and now I do. And I must not be doing it "right".
The second time through, the call to:
IOReturn ret = [_selectedDevice openRFCOMMChannelAsync:&_rfCommChannel withChannelID:1 delegate:self];
returns 0 for success, but the callback to:
- (void)rfcommChannelOpenComplete:(IOBluetoothRFCOMMChannel *)channel status:(IOReturn)status;
never happens the second time.
FYI I have tried both doing a retain and not doing a retain on the returned _rfCommChannel and it doesn't appear to make a difference. (The documentation says it's not required but a search shows up that sample code does a retain).
So I'm looking for the referenced sample code "RFCOMMClientSample" and/or "RFCOMM_Open_SPP_Example" to use as guidance for proper shutdown - both initiated from the Mac side and also when initiated from the device side, such that another connection can be made again later. I've looked in developer.apple.com and it's not there and of course there is no Developer/Examples/Bluetooth folder anymore to look in.
Does anyone have this squirreled away that they could send me? Or point me to where it might be located? Or perhaps if you've run into this problem before, give me a push in the right direction as to what I'm doing wrong on cleanup?
Thanks so much!
Janice
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden