Diligent Engine API Reference: D:/GitHub/DiligentEngine/DiligentCore/External/Android/ndk_helper/include/sensorManager.h Source File

Diligent Engine API Reference

sensorManager.h
1 /*
2 * Copyright 2013 The Android Open Source Project
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 //--------------------------------------------------------------------------------
18 // sensorManager.h
19 //--------------------------------------------------------------------------------
20 #ifndef SENSORMANAGER_H_
21 #define SENSORMANAGER_H_
22
23 #include <android/sensor.h>
24 #include "JNIHelper.h"
25
26 namespace ndk_helper {
27 //--------------------------------------------------------------------------------
28 // Constants
29 //--------------------------------------------------------------------------------
30 enum ORIENTATION {
31 ORIENTATION_UNKNOWN = -1,
32 ORIENTATION_PORTRAIT = 0,
33 ORIENTATION_LANDSCAPE = 1,
34 ORIENTATION_REVERSE_PORTRAIT = 2,
35 ORIENTATION_REVERSE_LANDSCAPE = 3,
36 };
37
38 /*
39 * Helper to handle sensor inputs such as accelerometer.
40 * The helper also check for screen rotation
41 *
42 */
43 class SensorManager {
44 ASensorManager *sensorManager_;
45 const ASensor *accelerometerSensor_;
46 ASensorEventQueue *sensorEventQueue_;
47
48 protected:
49 public:
50 SensorManager();
51 ~SensorManager();
52 void Init(android_app *state);
53 void Process(const int32_t id);
54 void Suspend();
55 void Resume();
56 };
57
58 /*
59 * AcquireASensorManagerInstance(android_app* app)
60 * Workaround ASensorManager_getInstance() deprecation false alarm
61 * for Android-N and before, when compiling with NDK-r15
62 */
63 ASensorManager* AcquireASensorManagerInstance(android_app* app);
64 } // namespace ndkHelper
65 #endif /* SENSORMANAGER_H_ */
ndk_helper
Definition: gestureDetector.h:32
android_app
Definition: android_native_app_glue.h:111