Tizen 2.1 base
[framework/osp/uix.git] / inc / FUixSensorISensorEventListener.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file     FUixSensorISensorEventListener.h
20  * @brief    This is the header file for the %ISensorEventListener interface.
21  *
22  * This header file contains the declarations of the %ISensorEventListener interface.
23  */
24
25 #ifndef _FUIX_SENSOR_ISENSOR_EVENT_LISTENER_H_
26 #define _FUIX_SENSOR_ISENSOR_EVENT_LISTENER_H_
27
28 #include <FUixSensorSensorData.h>
29 #include <FBaseDataType.h>
30 #include <FBaseRtIEventListener.h>
31
32 namespace Tizen { namespace Uix { namespace Sensor
33 {
34
35 /**
36  * @interface    ISensorEventListener
37  * @brief        This interface is an event listener used to receive sensor data asynchronously.
38  *
39  * @since        2.0
40  *
41  * @remarks      @b Header @b %file: @b \#include @b <FUix.h> @n
42  *               @b Library : @b osp-uix
43  *
44  * The %ISensorEventListener interface is an event listener used to receive sensor data asynchronously.
45  * It provides methods that are invoked when the sensor data is received from the device.
46  * @n
47  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/uix/sensor_manager.htm">Sensor Manager</a>.
48  */
49 class _OSP_EXPORT_ ISensorEventListener
50         : virtual public Tizen::Base::Runtime::IEventListener
51 {
52 // Lifecycle
53 public:
54         /**
55         * This is the destructor for this class.
56         *
57         * @since    2.0
58         */
59         virtual ~ISensorEventListener(void){}
60
61 // Operation
62 public:
63         /**
64         * Called when the sensor data is sensed after every sensor interval or when the sensor data is changed from the previous interval.
65         *
66         * @since        2.0
67         *
68         * @param[in]    sensorType        The sensor type
69         * @param[in]    sensorData        The array of sensor data
70         * @param[in]    r                 The error code
71         * @exception    E_SUCCESS         The method is successful.
72         * @exception    E_INVALID_DATA    The sensor data is invalid.
73         * @remarks     Calling of the application methods (including UI) must be handled in the main application thread, that is outside the sensor event handler %OnDataReceived().
74         * @see          Tizen::Uix::Sensor::AccelerationDataKey
75         * @see                  Tizen::Uix::Sensor::MagneticDataKey
76         * @see                  Tizen::Uix::Sensor::ProximityDataKey
77         * @see                  Tizen::Uix::Sensor::TiltDataKey
78         *
79         * The following example demonstrates how to use the %OnDataReceived() method.
80         *
81         * @code
82         * // Sample code for SensorSample.h
83         * #include <FUix.h>
84         * #include <FUi.h>
85         *
86         * class SensorSample :
87         *     public Tizen::Ui::Controls::Form,
88         *     public Tizen::Uix::Sensor::ISensorEventListener
89         * {
90         * public:
91         *         virtual result OnDraw();
92         *         void OnDataReceived(SensorType sensorType, SensorData& sensorData , result r);
93         *         //...
94         * }
95         *
96         * // Sample code for SensorSample.cpp
97         * #include "SensorSample.h"
98         *
99         * using namespace Tizen::Uix::Sensor;
100         *
101         * void
102         * SensorSample::OnDataReceived(SensorType sensorType, SensorData& sensorData , result r)
103         * {
104         *     // ...
105         * }
106         *
107         * result
108         * SensorSample::OnDraw()
109         * {
110         *     // ...
111         * }
112         * @endcode
113         */
114         virtual void OnDataReceived(SensorType sensorType, SensorData& sensorData, result r) = 0;
115
116 protected:
117         //
118         // This method is for internal use only. Using this method can cause behavioral, security-related,
119         // and consistency-related issues in the application.
120         //
121         virtual void ISensorEventListener_Reserved1(void) {}
122
123         //
124         // This method is for internal use only. Using this method can cause behavioral, security-related,
125         // and consistency-related issues in the application.
126         //
127         virtual void ISensorEventListener_Reserved2(void) {}
128
129         //
130         // This method is for internal use only. Using this method can cause behavioral, security-related,
131         // and consistency-related issues in the application.
132         //
133         virtual void ISensorEventListener_Reserved3(void) {}
134
135 }; // ISensorEventListener
136
137 } } }// Tizen::Uix::Sensor
138
139 #endif // _FUIX_SENSOR_ISENSOR_EVENT_LISTENER_H_