• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Cancelling an OBEXFileTransferServices session before transfer has begun
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cancelling an OBEXFileTransferServices session before transfer has begun


  • Subject: Cancelling an OBEXFileTransferServices session before transfer has begun
  • From: Rick Peacock <email@hidden>
  • Date: Thu, 6 Aug 2009 21:36:31 +0100

Hi,

I'm using OBEXFileTransferServices to upload a file to a mobile phone, using object push. My code is working fine but I'm having problems adding a cancel connection option once the OBEXFileTransferServices is setup with a device. I can cancel an actual transfer operation as the file is being transmitted but I can't cancel the initial connection.


Here's my setup code:

// Get objectpush service record for an IOBluetoothDevice device
IOBluetoothSDPServiceRecord *record;
record = [device getServiceRecordForUUID:[IOBluetoothSDPUUID uuid16:kBluetoothSDPUUID16ServiceClassOBEXObjectPush]];


// Use the record to form an OBEX Session object
mOBEXSession = [IOBluetoothOBEXSession withSDPServiceRecord: record];
[mOBEXSession retain];

// Send the OBEXSession off to FTS
mTransferServices = [OBEXFileTransferServices withOBEXSession: mOBEXSession];
[mTransferServices retain];
[mTransferServices setDelegate: self];

// Connect to the service
OBEXError err = [mTransferServices connectToObjectPushService];




At this stage none of the delegate methods are called - we are waiting for the phone to confirm the connection. It's this point that I'd like to be able to cancel incase the wrong device has been selected. I realise that the operation will naturally timeout but this wouldn't be good for end users of the application.

I've tried [mTransferServices disconnect] which returns kOBEXSessionNotConnectedError, which makes sense - no actual transfer is taking place and the fileTransferServicesConnectionComplete delegate method has not yet been called.

Using [mTransferServices abort] returns kOBEXGeneralError.

I've also tried various disconnect methods on the device and session such as:

if ([mOBEXSession hasOpenTransportConnection]) {
	[mOBEXSession closeTransportConnection];
}

[[mOBEXSession getDevice] closeConnection];


I'm obviously missing something or performing the steps in the wrong order. I know it's possible to achieve this as quitting my app immediately cancels the 'accept connection?' message on the phone. Also using the active connections panel of the Bluetooth explorer utility allows me to both see the connection and cancel it via the disconnect button.



Can anyone offer some advice?


Regards, Rick.

_______________________________________________
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


  • Next by Date: How to find an existing RFCommChannel on device
  • Next by thread: How to find an existing RFCommChannel on device
  • Index(es):
    • Date
    • Thread