×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Jul 2003
    Posts
    66

    Some question about bt device

    Dear Experts:
    i have some question about bluetooth application:
    1.How to get all local records just like remote one?
    2.i use RHostResolver to find bt device in order to control bt ui, when i get bt device address succesfully, i use listServiceL() in SDP example to find service, it will show "sdp error XXXX " by printSDPError,what can i do ?
    3.i use RHostResolver to find bt device in a CActive class , when i call GetByAddress(),then i use SetActive() not User::WaitForRequest(iStatus), then i found a error,when there is no bt device ,i can not catch the status, why?

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    2.i use RHostResolver to find bt device in order to control bt ui, when i get bt device address succesfully, i use listServiceL() in SDP example to find service, it will show "sdp error XXXX " by printSDPError,what can i do ?
    You'll have to wait for the inquiry to complete first. Either cancel the resolver request or wait for KErrEof status code.

    3.i use RHostResolver to find bt device in a CActive class , when i call GetByAddress(),then i use SetActive() not User::WaitForRequest(iStatus), then i found a error,when there is no bt device ,i can not catch the status, why?
    I don't know why, but the standard solution is to use a timeout timer to cancel the request if it does not seem to complete in a reasonable amount of time.

    Lauri

  3. #3
    Regular Contributor
    Join Date
    Jul 2003
    Posts
    66

    Thank you for hlp! but i have question yet

    quote:
    --------------------------------------------------------------------------------
    2.i use RHostResolver to find bt device in order to control bt ui, when i get bt device address succesfully, i use listServiceL() in SDP example to find service, it will show "sdp error XXXX " by printSDPError,what can i do ?
    --------------------------------------------------------------------------------
    You'll have to wait for the inquiry to complete first. Either cancel the resolver request or wait for KErrEof status code.
    ---------------------------------------------------------------------------------
    i indeed have finished find bt device because i use async call in cactive obj , when i get bt name in runl(),but i put the addr(i promise it is right) in listservicel() ,it show error, can you help me again,thank you!


    quote:
    --------------------------------------------------------------------------------
    3.i use RHostResolver to find bt device in a CActive class , when i call GetByAddress(),then i use SetActive() not User::WaitForRequest(iStatus), then i found a error,when there is no bt device ,i can not catch the status, why?
    --------------------------------------------------------------------------------
    I don't know why, but the standard solution is to use a timeout timer to cancel the request if it does not seem to complete in a reasonable amount of time.
    ---------------------------------------------------------------------------------
    the problem is it have finish search after time, it can not catch the status like User::WaitForRequest(iStatus), it run "ϵͳ´íÎó£¡"

  4. #4
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    You'll get a call to RunL() for each device that is found. Then, if the status code is not KErrEof, you should reissue your request using RHostResolver::Next(). The device inquiry starts when you issue GetByAddress() or GetByName() and ends when you cancel it, or KErrEof is returned. You can't issue other BT requests when there's an outstanding inquiry.

    the problem is it have finish search after time, it can not catch the status like User::WaitForRequest(iStatus), it run "ϵͳ´íÎó£¡"
    Could you rephrase that, please. I have trouble understanding your problem.

    Lauri

  5. #5
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    1.How to get all local records just like remote one?
    if you mean for example local bt address then look into "bthci" example in the sdk

  6. #6
    Regular Contributor
    Join Date
    Jul 2003
    Posts
    66

    thank you ,but i want to get local service in local sdp by local addr

    thank you ,but i want to get local service in local sdp by local addr,i know hci example ,it can only get local address

  7. #7
    Regular Contributor
    Join Date
    Jul 2003
    Posts
    66

    my source code is here,pls hlp me!thank you!

    //in user function
    User::LeaveIfError(iSocketServer.FindProtocol(_L("BTLinkManager"), protocolInfo));
    User::LeaveIfError(iHr.Open(iSocketServer,protocolInfo.iAddrFamily,protocolInfo.iProtocol));
    iAddr.SetIAC(KGIAC);
    iAddr.SetAction(KHostResName|KHostResInquiry);
    iHr.GetByAddress(iAddr, iRemoteDeviceName, iStatus);
    //User::WaitForRequest(iStatus);
    SetActive();

    //in runl()
    if(iStatus.Int()==KErrNone)
    {
    TPtrC deviceName;
    deviceName.Set(iRemoteDeviceName().iName);
    iReporter.PrintLine(deviceName);
    TBTSockAddr BTSockAddr(iRemoteDeviceName().iAddr);
    //store this addr
    }
    else
    {
    iReporter.error(_L("no bt device found!"));
    }

    //in user function after store addr successfully
    iBTDiscovery->ListServicesL(const TBTDevAddr& aAddress);

    my question is :
    1.when there is btservice,after get addr successfully
    , calling listservice, it will show "sdp errorXXX",why?

    2. when there is no btservice,"no bt device found!" is not show
    i do not know why?

Posting Permissions

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