Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / xwalk / tizen / mobile / sensor / tizen_platform_sensor.h
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Part of codes are copied from libslp-sensor with original copyright
6 // and license as below.
7 //
8 // Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15
16 #ifndef XWALK_TIZEN_MOBILE_SENSOR_TIZEN_PLATFORM_SENSOR_H_
17 #define XWALK_TIZEN_MOBILE_SENSOR_TIZEN_PLATFORM_SENSOR_H_
18
19 #include <sensor.h>
20 #include <vconf.h>
21
22 #include "base/native_library.h"
23 #include "xwalk/tizen/mobile/sensor/sensor_provider.h"
24
25 namespace xwalk {
26
27 class TizenPlatformSensor : public SensorProvider {
28  public:
29   TizenPlatformSensor();
30   virtual ~TizenPlatformSensor();
31
32   virtual bool Initialize() OVERRIDE;
33   virtual void Finish() OVERRIDE;
34
35  private:
36   bool auto_rotation_enabled_;
37   int accel_handle_;
38   int gyro_handle_;
39
40   static void OnEventReceived(unsigned int event_type,
41       sensor_event_data_t* event_data, void* udata);
42   static void OnAutoRotationEnabledChanged(keynode_t* node, void* udata);
43
44   DISALLOW_COPY_AND_ASSIGN(TizenPlatformSensor);
45 };
46
47 }  // namespace xwalk
48
49 #endif  // XWALK_TIZEN_MOBILE_SENSOR_TIZEN_PLATFORM_SENSOR_H_