tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / DEPRACATED / Geolocation / IGeolocation.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /*
17  * @author      Wojciech Bielawski (w.bielawski@samsung.com)
18  */
19
20 #ifndef WRTPLUGINS_API_IGEOLOCATION_H_
21 #define WRTPLUGINS_API_IGEOLOCATION_H_
22
23 #include "EventPositionChanged.h"
24
25 #include <dpl/shared_ptr.h>
26 #include <platform/commons/ThreadPool.h>
27
28 namespace WrtPlugins {
29 namespace Api {
30 namespace Geolocation {
31 class EventGetCurrentPosition;
32 typedef DPL::SharedPtr<EventGetCurrentPosition> EventGetCurrentPositionPtr;
33
34 class IGeolocation :
35     public Platform::EventRequestReceiver<EventGetCurrentPosition>
36 {
37   public:
38     typedef enum
39     {
40         METHOD_GPS,
41         METHOD_AGPS,
42         METHOD_CPS,
43         METHOD_IPS,
44         METHOD_WPS,
45         METHOD_BEST
46     } ApiLocationMethod;
47
48     virtual ~IGeolocation();
49
50     /**
51      * Gets current position
52      * @param event @see WrtPlugins::Api::Geolocation::EventGetCurrentPosition.
53      * @exception Commons::PlatformException when platform error occurs
54      */
55     virtual void getCurrentPosition(const EventGetCurrentPositionPtr& event) =
56         0;
57
58     /**
59      * Requests location module to receive continuously update of current
60      * position if the position is significantly changed
61      * @param emitter @see WrtPlugins::Api::Geolocation::EventPositionChanged.
62      * @param timeout
63      * @param maximumAge
64      * @param highAccuracy
65      * @return An ID of created subscription
66      * @exception Commons::PlatformException when platform error occurs
67      */
68     virtual long watchPosition(const EventPositionChangedEmitterPtr& emitter,
69             long timeout,
70             long maximumAge,
71             bool highAccuracy) = 0;
72
73     /**
74      * Stopping periodic location updates started with watchPosition
75      * @param id An Id of listener subscription.
76      * @exception Commons::PlatformException when platform error occurs
77      */
78     virtual void clearWatch(EventPositionChangedEmitter::IdType id) = 0;
79
80     /**
81      * Choses location method
82      * @param method A location method
83      * @exception Commons::PlatformException when platform error occurs
84      * @remarks does nothing when executed with the same method as currently used
85      */
86     virtual void changeLocationMethod(ApiLocationMethod method) = 0;
87
88   protected:
89     IGeolocation();
90
91     virtual void OnRequestReceived(const EventGetCurrentPositionPtr& event) = 0;
92 };
93
94 typedef DPL::SharedPtr<IGeolocation> IGeolocationPtr;
95 }
96 }
97 }
98
99 #endif /* WRTPLUGINS_API_IGEOLOCATION_H_ */