Retrieving the List of Devices

This topic shows you how to retrieve the list of devices.

Retrieving the list of devices returns a list of TLbsBtGpsDeviceInfo objects. Each object contains information about a device in the list, for example, its Bluetooth GPS device type. A device's unique key (TLbsBtGpsEntryKey) can also be returned in this way. This key is required to identify a device when performing operations such as moving or removing.

Call CLbsBtGpsConfig::GetDeviceListL(RPointerArray<TLbsBtGpsDeviceInfo>&). This function passes a reference to an empty RPointerArray to be populated with device entries from the list.
// Retrieve the list of devices
iDeviceList.ResetAndDestroy();
iConfig->GetDeviceListL(iDeviceList);

// Loop through the devices
for (TInt index=0; index<iDeviceList.Count(); ++index)
            {
            // Get at the device information from the list
            const TLbsBtGpsDeviceInfo* deviceInfo = iDeviceList[index];
            
            // Do something, for example, display on a GUI

            }

// Destroy the retrieved copy of the list now we have finished using it
iDeviceList.ResetAndDestroy();
}
If the client does not have the required capabilities, KErrPermissionDenied is returned.

The list of devices is returned.