2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FUixSensorISensorEventListener.h
20 * @brief This is the header file for the %ISensorEventListener interface.
22 * This header file contains the declarations of the %ISensorEventListener interface.
25 #ifndef _FUIX_SENSOR_ISENSOR_EVENT_LISTENER_H_
26 #define _FUIX_SENSOR_ISENSOR_EVENT_LISTENER_H_
28 #include <FUixSensorSensorData.h>
29 #include <FBaseDataType.h>
30 #include <FBaseRtIEventListener.h>
32 namespace Tizen { namespace Uix { namespace Sensor
36 * @interface ISensorEventListener
37 * @brief This interface is an event listener used to receive sensor data asynchronously.
41 * @remarks @b Header @b %file: @b \#include @b <FUix.h> @n
42 * @b Library : @b osp-uix
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.
47 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/uix/sensor_manager.htm">Sensor Manager</a>.
49 class _OSP_EXPORT_ ISensorEventListener
50 : virtual public Tizen::Base::Runtime::IEventListener
55 * This is the destructor for this class.
59 virtual ~ISensorEventListener(void){}
64 * Called when the sensor data is sensed after every sensor interval or when the sensor data is changed from the previous interval.
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
79 * The following example demonstrates how to use the %OnDataReceived() method.
82 * // Sample code for SensorSample.h
86 * class SensorSample :
87 * public Tizen::Ui::Controls::Form,
88 * public Tizen::Uix::Sensor::ISensorEventListener
91 * virtual result OnDraw();
92 * void OnDataReceived(SensorType sensorType, SensorData& sensorData , result r);
96 * // Sample code for SensorSample.cpp
97 * #include "SensorSample.h"
99 * using namespace Tizen::Uix::Sensor;
102 * SensorSample::OnDataReceived(SensorType sensorType, SensorData& sensorData , result r)
108 * SensorSample::OnDraw()
114 virtual void OnDataReceived(SensorType sensorType, SensorData& sensorData, result r) = 0;
118 // This method is for internal use only. Using this method can cause behavioral, security-related,
119 // and consistency-related issues in the application.
121 virtual void ISensorEventListener_Reserved1(void) {}
124 // This method is for internal use only. Using this method can cause behavioral, security-related,
125 // and consistency-related issues in the application.
127 virtual void ISensorEventListener_Reserved2(void) {}
130 // This method is for internal use only. Using this method can cause behavioral, security-related,
131 // and consistency-related issues in the application.
133 virtual void ISensorEventListener_Reserved3(void) {}
135 }; // ISensorEventListener
137 } } }// Tizen::Uix::Sensor
139 #endif // _FUIX_SENSOR_ISENSOR_EVENT_LISTENER_H_