open, close and open IOBluetoothRFCOMMChannel again
open, close and open IOBluetoothRFCOMMChannel again
- Subject: open, close and open IOBluetoothRFCOMMChannel again
- From: developerlists <email@hidden>
- Date: Sat, 4 Apr 2009 12:26:51 +0200
Hello List,
I have startet a project and run into a problem I could not solve.
short description:
1. openning the device 2. testing the device- > test is always OK, device is responsive as it should 3. getting address with: getAddress 4. closing device
5. try to open with the obtained address openConnection is OK it fails at openRFCOMMChannelSync with the error: "still exclusive open"
If you have a hint what I am doing wrong…
Thank you very much for help Jürgen
Codeschema:
opening the device with DeviceSelector or IOBluetoothDeviceCreateWithAddress
I select a device with IOBluetoothDeviceSelectorController. [deviceSelector runModal]
get the devices: deviceArray = [deviceSelector getResults];
get the first device: selectedDevice = (IOBluetoothDeviceRef)[deviceArray objectAtIndex:0]; or selectedDevice = IOBluetoothDeviceCreateWithAddress(addr);
get the first service: services = [((IOBluetoothDevice*)selectedDevice) getServices]; theService = [services objectAtIndex:0];
get the channel ID [theService getRFCOMMChannelID:&rfcommChannelID];
then I open the device [((IOBluetoothDevice*)selectedDevice) openConnection]
and get an commchannel status = [((IOBluetoothDevice*)selectedDevice) openRFCOMMChannelSync:&mRFCOMMChannel withChannelID:rfcommChannelID delegate:self];
closing the device:
IOBluetoothDevice *device = [mRFCOMMChannel getDevice]; [mRFCOMMChannel setDelegate:nil]; [mRFCOMMChannel closeChannel];
IOBluetoothObjectRelease((IOBluetoothObjectRef)mRFCOMMChannel); mRFCOMMChannel = nil; [device closeConnection]; IOBluetoothObjectRelease((IOBluetoothObjectRef)device);
|
_______________________________________________
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