×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    4

    Get RFCOMM Channel

    Hi,

    I'm using RHostResolver to automate discoveries, not RNOTIFIER

    I write this :

    // 1. Connect to the socket server
    RSocketServ socketServ;
    socketServ.Connect();
    TProtocolDesc pInfo;
    TProtocolName protocole = TProtocolName(KBTLinkManager);
    User::LeaveIfError(socketServ.FindProtocol(protocole,pInfo));

    // 2. Create and initialise an RHostResolver
    RHostResolver hr;
    User::LeaveIfError(hr.Open(socketServ,pInfo.iAddrFamily,pInfo.iProtocol));

    // 3. Set up a discovery query and start it
    TInquirySockAddr addr;
    TNameEntry name;
    addr.SetIAC(KGIAC);
    addr.SetAction(KHostResInquiry);
    TRequestStatus status;
    hr.GetByAddress(addr, entry, status);
    User::WaitForRequest(status);

    After if I find a remote device, I try a connection with him :

    RSocket socket;
    TBTSockAddr address;

    TRequestStatus status;
    socket.Open(socketServ,KBTAddrFamily,KSockStream,KRFCOMM));

    address.SetBTAddr(entry().iAddr)
    address.SetPort(Where to get the RFCOMM channel ?)

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

    I don't see how is possible to get the RFCOMM channel ?

    So what is the correct procedure to obtain the RFCOMM channel to the remote device ?

    thanks ced1.

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    3
    Look at the point-to-point example, CMessageServer::StartL()-method.

    .....
    User::LeaveIfError(iSocketServer.Connect());
    TInt result = iListeningSocket.Open(iSocketServer, KServerTransportName);
    if (result != KErrNone)
    {
    iSocketServer.Close();
    User::Leave(result);
    }

    // Get a channel to listen on - same as the socket's port number
    TInt channel;
    User::LeaveIfError(
    iListeningSocket.GetOpt(KRFCOMMGetAvailableServerChannel, KSolBtRFCOMM, channel)
    );
    ......

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    125
    i think this is only for a server software but not for a client one or? how do i check which port is for obex reserved on a remote device so that i can send them a file to it..?!

    I only need a bt adress who i overgive to the sender class and there the sender class find the correct port for boex from remote device so that i connect to them i hope you can kelp me
    txh for help
    Last edited by sblider; 2004-04-18 at 14:40.

  4. #4
    Registered User
    Join Date
    Mar 2004
    Posts
    3
    Take a look at page

    https://www.bluetooth.org/foundry/as...vice_discovery

    where OBEXFileTransfer service ID is 0x1106, and use this as portnumber.

    I'm not sure but, I hope this will help.

  5. #5
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    125
    hm how do i get the service id from a remote deivce!?

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    3

    I think, it is a service ID.

    from Obex example:

    TObexBluetoothProtocolInfo protocolInfo;

    protocolInfo.iTransport.Copy(_L("RFCOMM"));
    protocolInfo.iAddr.SetBTAddr(deviceaddress);
    protocolInfo.iAddr.SetPort(0x1106);

    if (iClient)
    {
    delete iClient;
    iClient = NULL;
    }
    iClient = CObexClient::NewL(protocolInfo);

    iClient->Connect(iStatus);
    SetActive();


    Otherwise you have to do to service discovery
    Last edited by rainerjuha; 2004-04-20 at 15:09.

  7. #7
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    125
    what does 0x1106 says?!? how can i get the remote device obex port from it?!

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Posts
    1,213
    Have a look at the BTObjectExchange coding example in the Series 60 SDK.

    The server requests for an available channel and sets it number in its service record. The client then queries the remote devices SDP database and extracts the port (channel) number.

    In the OBEX example the class ObjectExchangeServiceSearcher makes the query.

    Seppo
    Forum Nokia
    Last edited by seppo_fn; 2004-05-05 at 10:53.

Posting Permissions

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