|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Class used by client applications to convert data |
|
15 * such as such as WlanInfo or CellIds into TLocality position information |
|
16 * |
|
17 */ |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedPartner |
|
22 @prototype |
|
23 */ |
|
24 |
|
25 #ifndef LBS_LOCATIONRESOLVER_H |
|
26 #define LBS_LOCATIONRESOLVER_H |
|
27 |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <lbs/lbslocationcommon.h> |
|
31 #include <lbs/lbslocationinfo.h> |
|
32 #include <lbs/lbslocationinfoconvertercommon.h> |
|
33 |
|
34 |
|
35 class MLbsLocationResolverObserver |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Gets the current version of the observer interface. |
|
42 * Derived classes should not change the implementation. |
|
43 * |
|
44 * @return Version number (currently 1.0.0) |
|
45 */ |
|
46 IMPORT_C virtual TVersion Version() const; |
|
47 |
|
48 /** |
|
49 * The callback is used by the LBS subsystem to inform a client application |
|
50 * that a simple CLbsLocationResolver conversion process initiated through the |
|
51 * CLbsLocationResolver::ResolveLocationL method has been finished. |
|
52 * |
|
53 * @param aStatus status of conversion, KErrNone for success, standard system error code |
|
54 * in other cases. Note that in the event of a cancellation this method will not execute. |
|
55 * @param aBasicLocationInfo the location conversion that was requested. |
|
56 * If the conversion has failed the values will be uninitialised |
|
57 */ |
|
58 virtual void OnResolveLocationComplete(TInt aStatus, const TLocality& aLocality) = 0; |
|
59 |
|
60 }; |
|
61 |
|
62 |
|
63 NONSHARABLE_CLASS(CLbsLocationResolver) : public CBase |
|
64 { |
|
65 |
|
66 public: |
|
67 |
|
68 /** |
|
69 * Allocates and construct a new CLbsLocationResolver |
|
70 * @param[in] aObserver An observer for location conversion event. |
|
71 * @param[in] aConverterModuleId UID of the conversion plugin to be used. |
|
72 */ |
|
73 IMPORT_C static CLbsLocationResolver* NewL(MLbsLocationResolverObserver& aObserver, |
|
74 const TUid aConverterModuleId); |
|
75 |
|
76 /** |
|
77 * Allocates and construct a new CLbsLocationResolver |
|
78 * @param[in] aObserver An observer for location conversion event. |
|
79 */ |
|
80 IMPORT_C static CLbsLocationResolver* NewL(MLbsLocationResolverObserver& aObserver); |
|
81 |
|
82 /** |
|
83 * Destructor. |
|
84 */ |
|
85 IMPORT_C ~CLbsLocationResolver(); |
|
86 |
|
87 /** |
|
88 * A simple function that converts a single Location Info into a TLocality |
|
89 * No preferences or masks may be set. |
|
90 * The result is returned in the MLbsLocationResolverObserver |
|
91 * callback via OnResolveLocationComplete |
|
92 * |
|
93 * Only one outstanding conversion can be open at a time for each client. |
|
94 * Attempting to perform more than one will result in a leave with KErrInUse |
|
95 * |
|
96 * @param[in] aLocationInfo the information to be converted into a location. |
|
97 */ |
|
98 IMPORT_C void ResolveLocationL(const CLbsLocationInfo& aLocationInfo); |
|
99 |
|
100 /** |
|
101 * Cancels an ongoing conversion operation. |
|
102 * If there is no ongoing conversion the cancellation request is ignored. |
|
103 * |
|
104 * The MLbsLocationResolverObserver callback will not be invoked |
|
105 * if cancellation is successful. |
|
106 */ |
|
107 IMPORT_C void CancelResolveLocation(); |
|
108 |
|
109 protected: |
|
110 /** |
|
111 * Default constructor |
|
112 */ |
|
113 CLbsLocationResolver(); |
|
114 |
|
115 /** |
|
116 * Symbian 2nd phase constructor. |
|
117 */ |
|
118 void ConstructL(MLbsLocationResolverObserver& aObserver, const TUid aConverterModuleId); |
|
119 |
|
120 |
|
121 private: |
|
122 /** |
|
123 * Copy constructor. Restricted by default. |
|
124 */ |
|
125 CLbsLocationResolver(CLbsLocationResolver&); |
|
126 |
|
127 /** |
|
128 * Overloaded assignment operator. Restricted by default. |
|
129 */ |
|
130 CLbsLocationResolver& operator=(CLbsLocationResolver&); |
|
131 |
|
132 private: |
|
133 |
|
134 /** |
|
135 * Pointer to implementation class |
|
136 */ |
|
137 TAny* iLocationResolverImpl; |
|
138 |
|
139 }; |
|
140 |
|
141 |
|
142 #endif // LBS_LOCATIONRESOLVER_H |