How to disconnect a ObexFileTransferServices connection?
How to disconnect a ObexFileTransferServices connection?
- Subject: How to disconnect a ObexFileTransferServices connection?
- From: Ralf Menssen <email@hidden>
- Date: Fri, 24 Nov 2006 13:46:07 +0100
It seems to be not possible to close an ObexFileTransferServices without
destroying the ObexSession. I am creating an ObexFileTransferServices
using withOBEXSession (relevant code only):
mOBEXSession = [[IOBluetoothOBEXSession withDevice:mBTDevice
channelID:channelID] retain];
mFileTransferService = [[OBEXFileTransferServices
withOBEXSession:mOBEXSession] retain];
then I'm connecting it to FileTransferServices:
status = [mFileTransferService connectToFTPService];
and the delegate function:
- (void)
fileTransferServicesConnectionComplete:(OBEXFileTransferServices
*)inServices error:(OBEXError)inError
is entered with (inError == 0). Everything is fine, I can work with the
device. For some reason I now want to switch to the ObjectPushService,
it behaves differently when sending a file and this other behaviour is
wanted.
So I call:
status = [mFileTransferService disconnect];
and in the call back:
- (void)
fileTransferServicesDisconnectionComplete:(OBEXFileTransferServices*)inServices
error:(OBEXError)inError
{
NSLog ([NSString stringWithFormat:@"DisconnectionComplete: %d",
inError]);
if([mFileTransferService isConnected])
NSLog (@"After Close is still connected");
}
It tells me disconnection was successful (inError == 0), but also that
mFileTransferService is still connected. The now following attempt to
connect to ObjectPushService:
status = [mFileTransferService connectToObjectPushService];
fails in the fileTransferServicesConnectionComplete delegate function
with error -21882 (kOBEXSessionAlreadyConnectedError). Connecting to
FTPServices again would also fail with same error. So to me it looks
like disconnecting does not what it promises to do. Is it necessary to
close the whole OBEXSession here?
Ralf Menssen
_______________________________________________
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