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:
- Host Controller Interface (HCI) version and revision
- Link Manager Protocol (LMP) version and subversion
- Manufacturer code
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.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bluetooth game runs in emulator, not on phone | PakesBakesCakes | Mobile Java Networking & Messaging & Security | 4 | 2005-11-07 17:13 |
| Difference between pairing and connecting bluetooth headset | binurajbinu | Bluetooth Technology | 7 | 2006-12-06 13:40 |
| Smart Messaging with Bluetooth | jefryGSM | Smart Messaging | 1 | 2002-07-22 07:35 |
| Bluetooth and Digital Pen | nicenouman | Mobile Java General | 3 | 2006-08-02 05:59 |
| Two applications communicating via bluetooth in same mobile phone. | duran | Mobile Java Networking & Messaging & Security | 3 | 2006-11-02 12:49 |
