2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @author Wojciech Bielawski (w.bielawski@samsung.com)
22 #ifndef WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_
23 #define WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_
26 #include <API/Geolocation/IGeolocation.h>
27 #include <API/Geolocation/GeolocationFactory.h>
28 #include <API/Geolocation/EventPositionChanged.h>
29 #include <dpl/shared_ptr.h>
30 #include <dpl/noncopyable.h>
31 #include <location/location.h>
32 #include <platform/commons/Emitters.h>
34 namespace WrtPlugins {
36 namespace Geolocation {
37 class Geolocation : public Api::Geolocation::IGeolocation
39 LocationObject *m_location;
41 Api::Geolocation::IGeolocation::ApiLocationMethod m_currentLocationMethod;
43 friend class WrtPlugins::Api::Geolocation::GeolocationFactory;
46 virtual ~Geolocation();
49 * @See: IGelocation::getCurrentPosition
51 virtual void getCurrentPosition(
52 const Api::Geolocation::EventGetCurrentPositionPtr& event);
55 * @See: IGelocation::watchPosition
57 virtual long watchPosition(
58 const Api::Geolocation::EventPositionChangedEmitterPtr& emitter,
64 * @See: IGelocation::clearWatch
66 virtual void clearWatch(
67 Api::Geolocation::EventPositionChangedEmitter::IdType id);
70 * @See: IGelocation::changeLocationMethod
72 virtual void changeLocationMethod(ApiLocationMethod method);
75 * Method to run from platform's callback function
77 void positionHasChanged(LocationObject *obj,
84 virtual void OnRequestReceived(
85 const Api::Geolocation::EventGetCurrentPositionPtr& event);
88 typedef Emitters<Api::Geolocation::EventPositionChangedEmitter>
89 PositionChangedEmitters;
95 LocationMethod convertMethodToPlatform(ApiLocationMethod method) const;
97 PositionChangedEmitters m_positionEmitters;
98 DPL::Mutex m_initializationMutex;
105 #endif /* WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_ */