×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    30

    Bluetooth RSocket

    The code below is part of an attempt to connect to a bluetooth phone from the emulator. I lookup info about the phone via RHostResolver and that works fine, address is correct. socket.open works to but socket.connect wont work. Status returns -34 and it wont connect. Anyone have a clue what goes wrong?

    ..
    ..
    RSocket socket;
    User::LeaveIfError(socket.Open (socketServ,pInfo.iAddrFamily,KSockSeqPacket,KL2CAP));

    socket.Connect(sockAddr,status);
    User::WaitForRequest(status);

    if (status != KErrNone)
    return;
    Last edited by Gixxer2; 2008-09-26 at 21:47.

  2. #2
    Registered User
    Join Date
    Jun 2008
    Posts
    30

    Re: Bluetooth RSocket

    I printed the address to make sure it was correct and it seems ok. I get the MAC address of the phone. So what am i missing? Why am i not able to connect?

    ..
    ..
    TBTDevAddr devAddr = static_cast<TBTSockAddr>(entry().iAddr).BTAddr();

    TBTSockAddr sockAddr;
    sockAddr.SetBTAddr(devAddr);

    TBuf<25> tBufAddr;
    devAddr.GetReadable(tBufAddr);
    console->Printf(tBufAddr);

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Bluetooth RSocket

    Make sure that your BT configuration really works (for example send something with the built-in tools from the emulator).
    Are you sure about that you should use L2CAP?

  4. #4
    Registered User
    Join Date
    Jun 2008
    Posts
    30

    Re: Bluetooth RSocket

    Using the emulator i can scan for my phone and find it. I can add it to my BT devices and set it up with PIN and everything. So the BT config seems ok.

    And progamatically i can find the phone and receive information from it using RHostresolver, example below

    ..
    RHostResolver hr;
    User::LeaveIfError(hr.Open (socketServ,pInfo.iAddrFamily,pInfo.iProtocol));

    TRequestStatus status;
    hr.GetByAddress(addr, entry, status);
    User::WaitForRequest(status);

    Regarding L2Cap. I suppose i could use RFCOMM but then i would have to specify a port.

    All i really want is to connect to my phone and eventually exchange PIN etc.
    Is there any other way to do this using something else than RSocket?
    Last edited by Gixxer2; 2008-09-27 at 11:25.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Bluetooth RSocket

    Quote Originally Posted by Gixxer2 View Post
    Regarding L2Cap. I suppose i could use RFCOMM but then i would have to specify a port.
    Those two protocols are not interchangable. You have to know which one to use, and use that one.
    For finding the channel you have to use SDP indeed, BT examples show how to do that (S60 2nd edition: S[eries]60Ex\BTPointToPoint, S60 3rd edition: S60Ex\Chat).

  6. #6
    Registered User
    Join Date
    Jun 2008
    Posts
    30

    Re: Bluetooth RSocket

    RFCOMM communicates over L2CAP, right? That is, L2CAP is "lower" in the BT stack?

    As a note, i tried this:
    User::LeaveIfError(socket.Open(socketServ,KBTAddrFamily,KSockSeqPacket,KBTLinkManager));

    Using the BTLinkManager protocol i seem to get a connection but i am not really sure why, and for that matter what BTLinkManager is.
    Last edited by Gixxer2; 2008-09-27 at 14:41.

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Bluetooth RSocket

    Switching to a lower level protocol does not eliminate the need for knowledge of the target protocol. You simply get the task of assembling "RFComm packets" for yourself, "manually". And that "RFComm packet" still contains channel information, and you still need that in order to communicate successfully.

  8. #8
    Registered User
    Join Date
    Jun 2008
    Posts
    30

    Re: Bluetooth RSocket

    Of course, but im forced to connect on the L2CAP level in the stack.
    But what i cant understand is why I am able to connect using BTLinkManager protocol but not the L2CAP protocol.
    BTLinkmanager is ever further down in the stack than L2CAP, right?

Similar Threads

  1. Bluesoleil Software
    By kencooper in forum Bluetooth Technology
    Replies: 9
    Last Post: 2008-08-29, 19:46
  2. Bluetooth RSocket security issue
    By scoe in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 2
    Last Post: 2006-12-11, 16:59
  3. RSocket n Bluetooth
    By Shilpa13 in forum Symbian User Interface
    Replies: 1
    Last Post: 2006-08-05, 23:42
  4. Bluetooth using RSocket - sending data
    By VigenIssahhanjan in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2006-04-20, 23:23
  5. Nokia 7650 support Bluetooth audo?
    By ovjo12 in forum Bluetooth Technology
    Replies: 5
    Last Post: 2003-07-17, 18:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×