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: The source file for ReverseGeoCoderPlugin that creates the ReverseGeocoder |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <w32std.h> |
|
20 #include <lbsposition.h> |
|
21 |
|
22 |
|
23 #include "reversegeocoderplugin.h" |
|
24 #include "reversegeocode.h" |
|
25 #include "geotagger.h" |
|
26 #include "locationmanagerdebug.h" |
|
27 |
|
28 |
|
29 // ---------------------------------------------------------------------------- |
|
30 // CReverseGeoCoderPlugin::NewL |
|
31 // Create instance of concrete ECOM interface implementation |
|
32 // ---------------------------------------------------------------------------- |
|
33 // |
|
34 CReverseGeoCoderPlugin* CReverseGeoCoderPlugin::NewL() |
|
35 { |
|
36 LOG( "CReverseGeoCoderPlugin::NewL" ); |
|
37 CReverseGeoCoderPlugin* self = CReverseGeoCoderPlugin::NewLC(); |
|
38 CleanupStack::Pop(self); |
|
39 return self; |
|
40 } |
|
41 |
|
42 |
|
43 // ---------------------------------------------------------------------------- |
|
44 // CReverseGeoCoderPlugin::NewLC |
|
45 // Create instance of concrete ECOM interface implementation |
|
46 // ---------------------------------------------------------------------------- |
|
47 // |
|
48 CReverseGeoCoderPlugin* CReverseGeoCoderPlugin::NewLC() |
|
49 { |
|
50 LOG( "CReverseGeoCoderPlugin::NewLC" ); |
|
51 CReverseGeoCoderPlugin* self = new (ELeave) CReverseGeoCoderPlugin; |
|
52 CleanupStack::PushL (self); |
|
53 self->ConstructL(); |
|
54 return self; |
|
55 } |
|
56 |
|
57 // ---------------------------------------------------------------------------- |
|
58 // CReverseGeoCoderPlugin::CReverseGeoCoderPlugin() |
|
59 // The default constructor |
|
60 // ---------------------------------------------------------------------------- |
|
61 // |
|
62 CReverseGeoCoderPlugin::CReverseGeoCoderPlugin() |
|
63 : iRevGeocoder(NULL), |
|
64 iObserver(NULL) |
|
65 { |
|
66 } |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // CReverseGeoCoderPlugin::ConstructL |
|
70 // Second phase construction. |
|
71 // ---------------------------------------------------------------------------- |
|
72 // |
|
73 void CReverseGeoCoderPlugin::ConstructL() |
|
74 { |
|
75 LOG( "CReverseGeoCoderPlugin::ConstructL" ); |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin |
|
80 // Destructor |
|
81 // ---------------------------------------------------------------------------- |
|
82 // |
|
83 CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin() |
|
84 { |
|
85 LOG( "CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin,begin" ); |
|
86 delete iRevGeocoder; |
|
87 iRevGeocoder = NULL; |
|
88 iObserver = NULL; |
|
89 LOG( "CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin,end" ); |
|
90 } |
|
91 |
|
92 // ---------------------------------------------------------------------------- |
|
93 // CReverseGeoCoderPlugin::CreateReverseGeoCoderL |
|
94 // Creates an instance of the ReverseGeoCoder |
|
95 // ---------------------------------------------------------------------------- |
|
96 // |
|
97 void CReverseGeoCoderPlugin::CreateReverseGeoCoderL() |
|
98 { |
|
99 LOG( "CReverseGeoCoderPlugin::CreateReverseGeoCoderL,begin" ); |
|
100 if(iObserver) |
|
101 { |
|
102 iRevGeocoder = CReverseGeocode::NewL(*iObserver); |
|
103 } |
|
104 LOG( "CReverseGeoCoderPlugin::CreateReverseGeoCoderL,end" ); |
|
105 } |
|
106 |
|
107 // ---------------------------------------------------------------------------- |
|
108 // CReverseGeoCoderPlugin::AddObserverL |
|
109 // Initializes the ReverseGeoCodeObserver |
|
110 // ---------------------------------------------------------------------------- |
|
111 // |
|
112 void CReverseGeoCoderPlugin::AddObserverL(MReverseGeocodeObserver& aObserver) |
|
113 { |
|
114 LOG( "CReverseGeoCoderPlugin::AddObserverL,begin" ); |
|
115 iObserver = &aObserver; |
|
116 |
|
117 if(!iRevGeocoder) |
|
118 { |
|
119 CreateReverseGeoCoderL(); |
|
120 } |
|
121 LOG( "CReverseGeoCoderPlugin::AddObserverL,end" ); |
|
122 } |
|
123 |
|
124 |
|
125 // ---------------------------------------------------------------------------- |
|
126 // CReverseGeoCoderPlugin::GetAddressByCoordinateL |
|
127 // Gets the address for the given geo-coordinaates. |
|
128 // ---------------------------------------------------------------------------- |
|
129 // |
|
130 void CReverseGeoCoderPlugin::GetAddressByCoordinateL( TLocality aLocality, |
|
131 const TConnectionOption aOption ) |
|
132 { |
|
133 LOG( "CReverseGeoCoderPlugin::GetAddressByCoordinateL,begin" ); |
|
134 if(iRevGeocoder) |
|
135 { |
|
136 iRevGeocoder->GetAddressByCoordinateL(aLocality, aOption); |
|
137 } |
|
138 LOG( "CReverseGeoCoderPlugin::GetAddressByCoordinateL,end" ); |
|
139 } |
|
140 |
|
141 |
|
142 // ---------------------------------------------------------------------------- |
|
143 // CReverseGeoCoderPlugin::SilentConnectionAllowed |
|
144 // Wrapper API to check if the ReverseGeoCoder allows a silent connection |
|
145 // ---------------------------------------------------------------------------- |
|
146 // |
|
147 TBool CReverseGeoCoderPlugin::SilentConnectionAllowed() |
|
148 { |
|
149 LOG( "CReverseGeoCoderPlugin::SilentConnectionAllowed,begin" ); |
|
150 TBool ret = EFalse; |
|
151 if(iRevGeocoder) |
|
152 { |
|
153 ret = iRevGeocoder->SilentConnectionAllowed(); |
|
154 } |
|
155 LOG1( "CReverseGeoCoderPlugin::SilentConnectionAllowed,end ret - %d", ret ); |
|
156 return ret; |
|
157 } |
|
158 |
|
159 |
|
160 |
|
161 //End of File |
|
162 |
|