class CLbsBtGpsConfig : public CBase |
LBS Bluetooth GPS Configuration API
API used to configure Bluetooth GPS devices for use with LBS, allowing a preferred list of devices to be maintined. When required, the LBS Bluetooth positioning plugin will attempt to connect to each device in the list in order, until a succesful connection to a GPS device is made.
Through this API an application can read, add to, remove from, and reorder the list of preferred Bluetooth GPS devices. Accessing this API requires the LocalServices capability, in addition, calling any methods which can modify the configuration requires the WriteDeviceData capability.
class CLbsBtGpsConfigExample : public CActive, public MLbsBtGpsConfigObserver { public: CLbsBtGpsConfigExample() : CActive(CActive::EPriorityStandard) { CActiveScheduler::Add(this); // Create an instance of the API // NOTE: Our class implements the observer interface MLbsBtGpsConfigObserver iConfig = CLbsBtGpsConfig::NewL(*this); // ... } ~CLbsBtGpsConfigExample() { delete iConfig; iDeviceList.ResetAndDestroy(); iDeviceList.Close(); } void ExampleCode() { // Add a new device at the start of the list TInt err; TBTDevAddr deviceAddress; TLbsBtGpsEntryKey key; err = iConfig->AddDevice(deviceAddress, 0, key); // NOTE: key contains the unique device key, used to identify the device // Move the device around in the list // This will move it into 8th place (index is zero based), or, if there are // currently less than 8 devices in the list, it will move it to the end. iConfig->ReorderDevice(key, 7); // Remove the device from the list iConfig->RemoveDevice(key); } virtual void OnDeviceListUpdate() { test.Printf(_L(" --- OnDeviceListUpdate ---\n")); // 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 (e.g. display on a GUI) } // Destroy the retrieved copy of the list now we have finished using it iDeviceList.ResetAndDestroy(); } private: CLbsBtGpsConfig* iConfig; RPointerArray<TLbsBtGpsDeviceInfo> iDeviceList; // ... };
An application must wait for the RunL of the class implementing the MLbsBtGpsConfigObserver interface to return before calling any other public methods on this class.
Public Member Functions | |
---|---|
~CLbsBtGpsConfig () | |
IMPORT_C TInt | AddDevice (const TBTDevAddr &, TInt , TLbsBtGpsEntryKey &) |
IMPORT_C TInt | EmptyDeviceList () |
IMPORT_C TInt | GetDeviceCount ( TInt &) |
IMPORT_C void | GetDeviceListL ( RPointerArray < TLbsBtGpsDeviceInfo > &) |
IMPORT_C CLbsBtGpsConfig * | NewL () |
IMPORT_C CLbsBtGpsConfig * | NewL ( MLbsBtGpsConfigObserver &) |
IMPORT_C TInt | RemoveDevice ( TLbsBtGpsEntryKey ) |
IMPORT_C TInt | ReorderDevice ( TLbsBtGpsEntryKey , TInt ) |
Protected Member Functions | |
---|---|
CLbsBtGpsConfig () | |
void | ConstructL ( MLbsBtGpsConfigObserver *) |
Private Member Functions | |
---|---|
CLbsBtGpsConfig (const CLbsBtGpsConfig &) | |
IMPORT_C TAny * | ExtendedInterface ( TInt , TAny *, TAny *) |
CLbsBtGpsConfig & | operator= (const CLbsBtGpsConfig &) |
Protected Attributes | |
---|---|
CLbsBtGpsConfigImpl * | iImpl |
CLbsBtGpsConfig | ( | const CLbsBtGpsConfig & | ) | [private] |
Prohibit copy constructor
const CLbsBtGpsConfig & |
IMPORT_C TInt | AddDevice | ( | const TBTDevAddr & | aAddress, |
TInt | aPosition, | |||
TLbsBtGpsEntryKey & | aKey | |||
) |
Adds a new device at the specified position index within the list
The new device will assume the specified position in the list, shifting exsiting devices at this position or below one place towards the end of the list in order to achieve this.
Specifying aPosition = 0 will result in the device being added to the start of the list. Specifying aPosition >= DeviceCount() will result in the device being added to the end of the list.
const TBTDevAddr & aAddress | [In] Address of the new device. |
TInt aPosition | [In] Position in the list at which to add the device (where 0 indicates the start of the list). |
TLbsBtGpsEntryKey & aKey | [Out] Recieves the unique key assigned to identify the new device. |
void | ConstructL | ( | MLbsBtGpsConfigObserver * | aObserver | ) | [protected] |
Second phase constructor
MLbsBtGpsConfigObserver * aObserver | [IN] Optional observer, which will recieve update notifications. |
IMPORT_C TInt | EmptyDeviceList | ( | ) |
Empties the device list, removing all device entries
IMPORT_C TAny * | ExtendedInterface | ( | TInt | aFunctionNumber, |
TAny * | aPtr1, | |||
TAny * | aPtr2 | |||
) | [private, virtual] |
This methods is reserved for future expansion and should not be used
IMPORT_C TInt | GetDeviceCount | ( | TInt & | aCount | ) |
Returns the number of devices present in the list
TInt & aCount | [Out] Revieves the number of devices in the list. |
IMPORT_C void | GetDeviceListL | ( | RPointerArray < TLbsBtGpsDeviceInfo > & | aList | ) |
Retrieves the list of devices
The passed list is populated with TLbsBtGpsDeviceInfo objects containing information for each device in the list. Ownership of these objects is returned, so they should be deleted by the client when they are no longer needed (this can be done easily using RPointerArray::ResetAndDestroy ).
RPointerArray < TLbsBtGpsDeviceInfo > & aList | [Out] Reference to an empty RPointerArray to populate with device entries from the list. |
IMPORT_C CLbsBtGpsConfig * | NewL | ( | ) | [static] |
Static constructor (without observer) Creates an instance of the LBS Bluetooth GPS Configuration API. This version is for clients that do not require configuration update notifications.
IMPORT_C CLbsBtGpsConfig * | NewL | ( | MLbsBtGpsConfigObserver & | aObserver | ) | [static] |
Static constructor (with observer) Creates an instance of the LBS Bluetooth GPS Configuration API, specifying a callback to recieve update notifications.
MLbsBtGpsConfigObserver & aObserver | [IN] Observer which will recieve update notifications. |
IMPORT_C TInt | RemoveDevice | ( | TLbsBtGpsEntryKey | aKey | ) |
Removes a device from the list
TLbsBtGpsEntryKey aKey | [In] The key identifying the device. |
IMPORT_C TInt | ReorderDevice | ( | TLbsBtGpsEntryKey | aKey, |
TInt | aNewPosition | |||
) |
Reorders a device in the list by specifying a new position index
The device identified by the key will assume the specified position in the list, shifting exsiting devices as required in order to achieve this.
Specifying aNewPosition = 0 will result in the device being moved to the start of the list. Specifying aNewPosition >= DeviceCount() will result in the device being moved to the end of the list.
When a device is moved towards the start of the list, other devices located between the old and new positions will be shifted towards the end of the list by one place. For example, starting with a list {A,B,C,D,E}, moving device D to position 1 would result in {A,D,B,C,E}.
Similarly, when a device is moved towards the end of the list, other devices located between the old and new positions will be shifted towards the start of the list by one place. For example, starting with a list {A,B,C,D,E}, moving device B to position 3 would result in {A,C,D,B,E}
TLbsBtGpsEntryKey aKey | [In] The key identifying the device. |
TInt aNewPosition | [In] New position index for the device in the list (where 0 indicates the start of the list). |
CLbsBtGpsConfig & | operator= | ( | const CLbsBtGpsConfig & | ) | [private] |
Prohibit assigment operator
const CLbsBtGpsConfig & |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.