RFCOMMChannel delegate OK, but getting no events\data (+)
RFCOMMChannel delegate OK, but getting no events\data (+)
- Subject: RFCOMMChannel delegate OK, but getting no events\data (+)
- From: "Serge Vasiljev" <email@hidden>
- Date: Tue, 11 Apr 2006 02:17:39 +0200
ups, sorry for double post - wrong button :(
here the complete question.
//////////////////////////////////////////////
hi All,
I'm very new one in Mac world and Objective-C is ... a bit unusual for a while.
I'm trying to write a simple application to send a SMS\dial a number on my mobile via BT connector in my iMac.
main method logic looks like this:
.....
BTConnector *con = [[BTConnector alloc] init];
[con connect];
[con sendMessage: @"ATD01636158713\r"];
sleep(10);
[con disconnect];
....
//////////////////////////////////////////////
connect method:
....
// lookup device via address
IOBluetoothNSStringToDeviceAddress(@"00-0A-D9-EC-0D-28", &btAddress);
btDevice = [IOBluetoothDevice withAddress: &btAddress];
// find service
....
here I'm looking for kBluetoothSDPUUID16ServiceClassDialupNetworking service
is it right one ?
I do not want to use this connection as Internet connection from my mobile to Mac , I would like to call my Mam :)
// open channel
result = [btDevice openRFCOMMChannelSync:&btChannel withChannelID:rfcommChannelID delegate: self];
here I'm putting delegate to self
I'm getting result kIOReturnSuccess
// delegate paranoia...
result = [btChannel setDelegate:self];
....
again result kIOReturnSuccess
[btChannel retain];
.....
/////////////////////////////////////////////
send message to BT device:
// string -> data conversion
[aMessage lossyCString]
.... (do MTU check)
[btChannel writeSync:buffer length:numBytesToSend]
/////////////////////////////////////////////
my delegate implementation:
- (void)rfcommChannelData:(IOBluetoothRFCOMMChannel*)rfcommChannel data:(void *)dataPointer length:(size_t)dataLength;
{
printf("-----------> new data\n");
}
- (void)rfcommChannelClosed:(IOBluetoothRFCOMMChannel*)rfcommChannel;
{
printf("-----------> channel closed\n");
}
- (void)rfcommChannelWriteComplete:(IOBluetoothRFCOMMChannel*)rfcommChannel refcon:(void*)refcon status:(IOReturn)error;
{
printf("-----------> write complete\n");
}
Guys, what is wrong with this code ?
connect to mobile -> no error
open channel -> no error
send message -> no error and as result of this command my mobile produce a very nice BEEEP, but doing nothing :) - ok, could be a wrong command, but
I can't read a return code from mobile.
And I'm getting no message channelOpen \ channelClosed
I've tried to write message in assync mode with -rfcommChannelWriteComplete listener - the same problem
my system:
iMac (Intel)
Mac OS X 10.4.6
Any help very appreciate - I'm quite confused :(.
// Sergey
_______________________________________________
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