Monado OpenXR Runtime
android_sensors.h
Go to the documentation of this file.
1// Copyright 2020, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Android sensors driver header.
6 * @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
7 * @ingroup drv_android
8 */
9
10#pragma once
11
12#include <android/sensor.h>
13
14#include "math/m_api.h"
15#include "math/m_imu_pre.h"
16#include "math/m_imu_3dof.h"
17
18#include "xrt/xrt_device.h"
19
20#include "os/os_threading.h"
21
22#include "util/u_logging.h"
23#include "util/u_distortion.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/*!
30 * @implements xrt_device
31 */
33{
34 struct xrt_device base;
35 struct os_thread_helper oth;
36 struct u_cardboard_distortion cardboard;
37
38
39 struct
40 {
41 //! Lock for last and fusion.
42 struct os_mutex lock;
43 struct m_imu_3dof fusion;
44 };
45
46 enum u_logging_level log_level;
47};
48
49
50struct android_device *
51android_device_create(void);
52
53
54/*
55 *
56 * Printing functions.
57 *
58 */
59
60#define ANDROID_TRACE(d, ...) U_LOG_XDEV_IFL_T(&d->base, d->log_level, __VA_ARGS__)
61#define ANDROID_DEBUG(d, ...) U_LOG_XDEV_IFL_D(&d->base, d->log_level, __VA_ARGS__)
62#define ANDROID_INFO(d, ...) U_LOG_XDEV_IFL_I(&d->base, d->log_level, __VA_ARGS__)
63#define ANDROID_WARN(d, ...) U_LOG_XDEV_IFL_W(&d->base, d->log_level, __VA_ARGS__)
64#define ANDROID_ERROR(d, ...) U_LOG_XDEV_IFL_E(&d->base, d->log_level, __VA_ARGS__)
65
66#ifdef __cplusplus
67}
68#endif
u_logging_level
Logging level enum.
Definition: u_logging.h:43
C interface to math library.
A IMU fusion specially made for 3dof devices.
IMU pre filter struct.
Wrapper around OS threading native functions.
Definition: android_sensors.h:33
struct os_mutex lock
Lock for last and fusion.
Definition: android_sensors.h:42
Definition: m_imu_3dof.h:35
A wrapper around a native mutex.
Definition: os_threading.h:55
All in one helper that handles locking, waiting for change and starting a thread.
Definition: os_threading.h:453
Both given and derived values needed for cardboard distortion.
Definition: u_distortion.h:91
A single HMD or input device.
Definition: xrt_device.h:244
Code to handle distortion parameters and fov.
Basic logging functionality.
Header defining an xrt display or controller device.