Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 19:56, 30 October 2007.

How to get local bluetooth device information

From Forum Nokia Wiki

The following code gets information for the local bluetooth device:

void CBTInfo::GetBTDevInfoL(TDes& aBTHCIVersion, 
    TDes& aBTHCIRevision, TDes& aBTLMPVersion, 
    TDes& aBTLMPSubversion, TDes& aBTManufacturerName)
    {
    RSocket socket;
    RSocketServ socketServer;
    TRequestStatus status;
    THCILocalVersionBuf lvb;
 
    User::LeaveIfError(socketServer.Connect());
    CleanupClosePushL<RSocketServ>(socketServer);
 
    User::LeaveIfError(socket.Open(socketServer, 
        KBTAddrFamily, KSockSeqPacket, KL2CAP));
    CleanupClosePushL<RSocket>(socket);
 
    socket.Ioctl(KHCILocalVersionIoctl, status, &lvb, KSolBtHCI);
    User::WaitForRequest(status);
    //User::LeaveIfError(status.Int());
 
    CleanupStack::PopAndDestroy(2); // socketServer, socket
 
    aBTHCIVersion.AppendNum(lvb().iHCIVersion);
    aBTHCIRevision.AppendNum(lvb().iHCIRevision);
    aBTLMPVersion.AppendNum(lvb().iLMPVersion);
    aBTLMPSubversion.AppendNum(lvb().iLMPSubversion);
    aBTManufacturerName.AppendNum(lvb().iManufacturerName);
    }

Note: The above variables (e.g. iHCIVersion) are officially deprecated on S60 3rd edition devices. Therefore if you uncomment the line "User::LeaveIfError(status.Int());" in the code above, the application will exit with error '-5' (KErrNotSupported). If you comment the line, the according values should be reliable anyway.

 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZbluetoothQ
     qfnZtopicQUqfnTopicZconnectivityQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX