Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to get and set the local device name

Each Blutetooth device has a name, for identifying the device to users etc. The local device name is read and set through the RHostResolver functions GetHostName() and SetHostName() respectively.

Example

The following code shows how to get the local name:

// 1. Connect to the socket server
RSocketServ socketServ;
socketServ.Connect();
TProtocolDesc pInfo;
_LIT(KL2Cap, "L2CAP");
socketServ.FindProtocol(KL2Cap,pInfo);

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

// 3. Get the local device name
THostName name;
TInt ret=hr.GetHostName(name);

Note

THostName is a descriptor buffer of a suitable minimum size.