Android-cuttlefish cvd tool
sensors.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 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#pragma once
17
18namespace cuttlefish {
19namespace sensors {
20/*
21 These must align with Goldfish sensor IDs as we reuse Goldfish sensor HAL
22 library for Cuttlefish sensor HAL. (See
23 `device/generic/goldfish/hals/sensors/sensor_list.h`.)
24*/
25inline constexpr int kAccelerationId = 0;
26inline constexpr int kGyroscopeId = 1;
27inline constexpr int kMagneticId = 2;
28inline constexpr int kTemperatureId = 4;
29inline constexpr int kProximityId = 5;
30inline constexpr int kLightId = 6;
31inline constexpr int kPressureId = 7;
32inline constexpr int kHumidityId = 8;
33inline constexpr int kUncalibMagneticId = 9;
34inline constexpr int kUncalibGyroscopeId = 10;
35inline constexpr int kHingeAngle0Id = 11;
36inline constexpr int kUncalibAccelerationId = 17;
37/*
38 This is reserved specifically for Cuttlefish to identify the device
39 orientation relative to the East-North-Up coordinates frame. This is
40 not really a sensor but rather input from web UI for us to calculate
41 IMU readings.
42*/
43inline constexpr int kRotationVecId = 31;
44inline constexpr int kMaxSensorId = 31;
45
46/*
47 Each sensor ID also represent a bit offset for an app to specify sensors
48 via a bitmask.
49*/
50using SensorsMask = int;
51
52inline constexpr char INNER_DELIM = ':';
53inline constexpr char OUTER_DELIM = ' ';
54
55/* Sensors Commands */
56inline constexpr int kUpdateRotationVec = 0;
57inline constexpr int kGetSensorsData = 1;
58inline constexpr int kUpdateHal = 2;
59
60using SensorsCmd = int;
61
62} // namespace sensors
63} // namespace cuttlefish
constexpr int kRotationVecId
Definition: sensors.h:43
constexpr int kMaxSensorId
Definition: sensors.h:44
constexpr int kGetSensorsData
Definition: sensors.h:57
int SensorsCmd
Definition: sensors.h:60
constexpr int kTemperatureId
Definition: sensors.h:28
constexpr int kGyroscopeId
Definition: sensors.h:26
constexpr int kLightId
Definition: sensors.h:30
constexpr int kMagneticId
Definition: sensors.h:27
constexpr int kPressureId
Definition: sensors.h:31
constexpr int kUncalibAccelerationId
Definition: sensors.h:36
constexpr char OUTER_DELIM
Definition: sensors.h:53
constexpr int kAccelerationId
Definition: sensors.h:25
constexpr int kUpdateHal
Definition: sensors.h:58
constexpr int kHingeAngle0Id
Definition: sensors.h:35
constexpr int kUpdateRotationVec
Definition: sensors.h:56
constexpr int kUncalibMagneticId
Definition: sensors.h:33
constexpr char INNER_DELIM
Definition: sensors.h:52
constexpr int kProximityId
Definition: sensors.h:29
constexpr int kUncalibGyroscopeId
Definition: sensors.h:34
int SensorsMask
Definition: sensors.h:50
constexpr int kHumidityId
Definition: sensors.h:32
Definition: alloc_utils.cpp:23