1 /* |
|
2 * Copyright (c) 2006-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: Implementaion class for the CReverseGeocode class. |
|
15 */ |
|
16 #ifndef _INTERNALREVERSEGEOCODE_H_ |
|
17 #define _INTERNALREVERSEGEOCODE_H_ |
|
18 |
|
19 #include <coemain.h> |
|
20 |
|
21 #include "reversegeocode.h" |
|
22 #include "xmlhandler.h" |
|
23 #include "clientengine.h" |
|
24 #include "connectiontimerhandler.h" |
|
25 |
|
26 |
|
27 /* |
|
28 * Internal implementation class for the CReverseGeocode class. |
|
29 */ |
|
30 NONSHARABLE_CLASS( CInternalReverseGeocode ) : public CReverseGeocode, |
|
31 public MClientObserver, |
|
32 public MXmlHandlerObserver, |
|
33 public MConnectionTimeoutHandlerInterface |
|
34 { |
|
35 public: |
|
36 /** |
|
37 * Factory function to create the instance |
|
38 * @param aObserver The observer instance that is to be notified when reverse geocoding is over |
|
39 * @return A pointer to the CInternalReverseGeocode instance |
|
40 */ |
|
41 static CInternalReverseGeocode* NewL( MReverseGeocodeObserver& aObserver ); |
|
42 |
|
43 /** |
|
44 * Gets the address for the given geo-coordinaates. |
|
45 * @param aLocality The locality information |
|
46 * aOption The connection option whether its silent or not |
|
47 */ |
|
48 virtual void GetAddressByCoordinateL( TLocality aLocality, const TConnectionOption aOption ); |
|
49 |
|
50 /** |
|
51 * Checks if a silent connection is allowed |
|
52 * @return ETrue If silentconnection is allowed |
|
53 */ |
|
54 virtual TBool SilentConnectionAllowed(); |
|
55 |
|
56 /** |
|
57 * Helper function to get the appropriate language for the request. |
|
58 * @param aLanguage The language for the request |
|
59 */ |
|
60 void GetLanguageForTheRequest( TDes8& aLanguage ); |
|
61 |
|
62 |
|
63 /** |
|
64 * destructor |
|
65 * |
|
66 */ |
|
67 ~CInternalReverseGeocode(); |
|
68 |
|
69 // MConnectionTimeoutHandlerInterface |
|
70 /** |
|
71 * Closes the connection once it times out |
|
72 * @param aErrorCode The Error code |
|
73 */ |
|
74 void HandleTimedoutEvent(TInt aErrorCode); |
|
75 |
|
76 #ifdef REVERSEGEOCODE_UNIT_TESTCASE |
|
77 public: |
|
78 #else |
|
79 protected: |
|
80 #endif |
|
81 |
|
82 /** |
|
83 * Second phase construction |
|
84 */ |
|
85 void ConstructL(); |
|
86 |
|
87 /** |
|
88 * First phase construction. |
|
89 * @param aObserver The observer instance that is to be notified when reverse geocoding is over |
|
90 */ |
|
91 CInternalReverseGeocode( MReverseGeocodeObserver& aObserver ); |
|
92 |
|
93 //From MClientObserver |
|
94 /** |
|
95 * callback which notifies progess of HTTP request |
|
96 * @param aEvent The Httpstatus |
|
97 */ |
|
98 void ClientEvent( const THttpStatus& aEvent ); |
|
99 |
|
100 /** |
|
101 * callback through which the HTTP body data is recieved. |
|
102 * @param aBodyData The body recieved |
|
103 */ |
|
104 void ClientBodyReceived(const TDesC8& aBodyData); |
|
105 |
|
106 /* |
|
107 * Get registrer network country code |
|
108 * |
|
109 * @return current register n/w info |
|
110 */ |
|
111 RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw(); |
|
112 |
|
113 //From MXmlHandlerObserver |
|
114 /** |
|
115 * callback which notifys the completion of parsing. |
|
116 * @param aError The err code |
|
117 * aAddressInfo The address info obtained after parsing |
|
118 */ |
|
119 void OnParseCompletedL( TInt aError, MAddressInfo& aAddressInfo ); |
|
120 |
|
121 /* |
|
122 * UE is registered to home network? |
|
123 * |
|
124 * @return ETrue if UE is registered at home network else EFalse |
|
125 */ |
|
126 TBool IsRegisteredAtHomeNetwork(); |
|
127 |
|
128 |
|
129 /* |
|
130 * Get home network country code |
|
131 * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse |
|
132 * @return user home n/w info |
|
133 */ |
|
134 const RMobilePhone::TMobilePhoneNetworkInfoV1& |
|
135 GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag); |
|
136 |
|
137 #ifdef REVERSEGEOCODE_UNIT_TESTCASE |
|
138 public: |
|
139 #else |
|
140 private: |
|
141 #endif |
|
142 |
|
143 /** |
|
144 * Starts the timer |
|
145 */ |
|
146 void StartTimer(); |
|
147 |
|
148 /** |
|
149 * Closes the http connection and notifies the observer |
|
150 */ |
|
151 void CloseConnection(); |
|
152 |
|
153 #ifdef REVERSEGEOCODE_UNIT_TESTCASE |
|
154 public: |
|
155 #else |
|
156 private: |
|
157 #endif |
|
158 CXmlHandler *iXmlHandler; |
|
159 CClientEngine *iClientEngine; |
|
160 CInternalAddressInfo *iAddressInfo; |
|
161 HBufC8* iXMLBuf; |
|
162 MReverseGeocodeObserver& iObserver; |
|
163 CConnectionTimerHandler* iTimer; |
|
164 |
|
165 |
|
166 TBuf8<KMaxFileName> iQueryString; |
|
167 TBuf8<KMaxFileName> iLang; |
|
168 TBool iStartTimerFlag; |
|
169 }; |
|
170 |
|
171 #endif //_INTERNALREVERSEGEOCODE_H_ |
|
172 |
|
173 // End of file |
|