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