c9b7b9fe8715e06afdf1a992f640df8ef04b341c
[framework/web/wrt-plugins-common.git] / src / modules / API / Orientation / IOrientation.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  * @file          IOrientation.h
18  * @author      Qi Xiangguo (xiangguo.qi@samsung.com)
19  * @version     0.1
20  * @brief
21  */
22
23 #ifndef WRTDEVICEAPIS_ORIENTATION_IORIENTATION_H_
24 #define WRTDEVICEAPIS_ORIENTATION_IORIENTATION_H_
25
26 #include <dpl/shared_ptr.h>
27 #include <Commons/ThreadPool.h>
28 #include <Orientation/EventOrientationChanged.h>
29
30 namespace WrtDeviceApis {
31 namespace Orientation {
32 namespace Api {
33
34 class EventGetCurrentOrientation;
35 typedef DPL::SharedPtr<EventGetCurrentOrientation>
36             EventGetCurrentOrientationPtr;
37
38 class IOrientation :
39     public Commons::EventRequestReceiver<EventGetCurrentOrientation>
40 {
41   public:
42     virtual ~IOrientation();
43
44     /**
45      * Gets current orientation
46      * @param event @see WrtDeviceApis::Api::Orientation::EventGetCurrentOrientation.
47      * @exception Commons::PlatformException when platform error occurs
48      */
49     virtual void getCurrentOrientation(
50             const EventGetCurrentOrientationPtr& event) = 0;
51
52     /**
53      * Requests sensor module to receive continuously update of current
54      * orientation if the orientation is significantly changed
55      * @param emitter @see WrtDeviceApis::Api::Orientation::EventOrientationChanged.
56      * @param minNotificationInterval
57      * @return An ID of created subscription
58      * @exception Commons::PlatformException when platform error occurs
59      */
60     virtual long watchOrientation(
61             const EventOrientationChangedEmitterPtr& emitter,
62             long minNotificationInterval) = 0;
63
64     /**
65      * Stopping periodic orientation updates started with watchOrientation
66      * @param id An Id of listener subscription.
67      * @exception Commons::PlatformException when platform error occurs
68      */
69     virtual void clearWatch(EventOrientationChangedEmitter::IdType id) = 0;
70
71   protected:
72     IOrientation();
73
74     virtual void OnRequestReceived(const EventGetCurrentOrientationPtr& event)
75         = 0;
76 };
77
78 typedef DPL::SharedPtr<IOrientation> IOrientationPtr;
79 }
80 }
81 }
82
83 #endif // WRTDEVICEAPIS_ORIENTATION_IORIENTATION_H_