- add third_party src.
[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   gfx::Display::Rotation ToDisplayRotation(int rotation) const;
37
38   bool auto_rotation_enabled_;
39   int accel_handle_;
40   int gyro_handle_;
41
42   static void OnEventReceived(unsigned int event_type,
43                               sensor_event_data_t* event_data,
44                               void* udata);
45   static void OnAutoRotationEnabledChanged(keynode_t* node, void* udata);
46
47   DISALLOW_COPY_AND_ASSIGN(TizenPlatformSensor);
48 };
49
50 }  // namespace xwalk
51
52 #endif  // XWALK_TIZEN_MOBILE_SENSOR_TIZEN_PLATFORM_SENSOR_H_