OBEXFileTransferServices delegate method trouble
OBEXFileTransferServices delegate method trouble
- Subject: OBEXFileTransferServices delegate method trouble
- From: "Daniel Klevebring" <email@hidden>
- Date: Mon, 31 Dec 2007 02:11:39 +0100
Dear list,
I am trying to use OBEXFileTransferServices to connect to my device of interest (like my mobile phone) and get a file listing over bluetooth. For scripting purposes i want it to be command-line based.
I have my main method like so:
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int channelID = 7;
...
NSString * inAddressString = [[NSString alloc] initWithCString: argv[1] ];
status = IOBluetoothNSStringToDeviceAddress( inAddressString , &deviceAddress );
mOBEXSession = [IOBluetoothOBEXSession
withDevice:[IOBluetoothDevice withAddress:&deviceAddress]
channelID:channelID];
// check that mOBEXSession object is OK (exists)
if( !mOBEXSession ){
NSLog( [NSString stringWithFormat:@"An error occurred(1.5): 0x%x\n", status ]);
return 1;
}
//create a FileTransferrer object using mOBEXSession
FileTransferrer * mFileTranferrer = [[FileTransferrer alloc] initWithOBEXSession: mOBEXSession];
[pool release];
return 0;
}
... and here's my FileTransferrer.h/m
Header:
#import <IOBluetooth/objc/OBEXFileTransferServices.h>
@interface FileTransferrer : NSObject {
OBEXFileTransferServices * mFileTranfer;
}
@end
Implementation:
#import "FileTransferrer.h"
@implementation FileTransferrer
- (FileTransferrer *) initWithOBEXSession: (IOBluetoothOBEXSession *) inOBEXSession {
self = [super init];
// create object and set delegate to self
mFileTranfer = [[OBEXFileTransferServices alloc] initWithOBEXSession: inOBEXSession];
[mFileTranfer setDelegate: self];
// connectToFTPService should call the delegate function fileTransferServicesConnectionComplete
[mFileTranfer connectToFTPService];
NSLog(@"initializing file transfer.");
return self;
}
- (void) fileTransferServicesConnectionComplete:(OBEXFileTransferServices*)inServices error:(OBEXError)inError{
NSLog(@"...fileTransferServicesConnectionComplete...");
}
@end
However, the delegate function never gets called (it produces no output).
Am I setting the delegate in a correct way?
Best regards
Daniel K
_______________________________________________
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