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 18 namespace cuttlefish { 19 namespace 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 */ 25 inline constexpr int kAccelerationId = 0; 26 inline constexpr int kGyroscopeId = 1; 27 inline constexpr int kMagneticId = 2; 28 inline constexpr int kUncalibMagneticId = 9; 29 inline constexpr int kUncalibGyroscopeId = 10; 30 inline constexpr int kUncalibAccelerationId = 17; 31 /* 32 This is reserved specifically for Cuttlefish to identify the device 33 orientation relative to the East-North-Up coordinates frame. This is 34 not really a sensor but rather input from web UI for us to calculate 35 IMU readings. 36 */ 37 inline constexpr int kRotationVecId = 31; 38 inline constexpr int kMaxSensorId = 31; 39 40 /* 41 Each sensor ID also represent a bit offset for an app to specify sensors 42 via a bitmask. 43 */ 44 using SensorsMask = int; 45 46 inline constexpr char INNER_DELIM = ':'; 47 inline constexpr char OUTER_DELIM = ' '; 48 49 /* Sensors Commands */ 50 inline constexpr int kUpdateRotationVec = 0; 51 inline constexpr int kGetSensorsData = 1; 52 53 using SensorsCmd = int; 54 55 } // namespace sensors 56 } // namespace cuttlefish 57