Android-cuttlefish cvd tool
sensors_hal_proxy.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
17#pragma once
18
19#include <atomic>
20#include <mutex>
21#include <thread>
22
29
30namespace cuttlefish {
31namespace sensors {
32
34 public:
35 SensorsHalProxy(SharedFD control_from_guest_fd, SharedFD control_to_guest_fd,
36 SharedFD data_from_guest_fd, SharedFD data_to_guest_fd,
37 SharedFD kernel_events_fd,
38 SensorsSimulator& sensors_simulator, DeviceType device_type);
39
40 private:
42
50 std::atomic<bool> hal_activated_ = false;
51 std::atomic<bool> running_ = true;
52 std::mutex report_mtx_;
53};
54
55} // namespace sensors
56} // namespace cuttlefish
Definition: shared_fd.h:124
Definition: sensors_hal_proxy.h:33
SensorsHalProxy(SharedFD control_from_guest_fd, SharedFD control_to_guest_fd, SharedFD data_from_guest_fd, SharedFD data_to_guest_fd, SharedFD kernel_events_fd, SensorsSimulator &sensors_simulator, DeviceType device_type)
Definition: sensors_hal_proxy.cpp:161
void ReportToGuest(SensorsMask mask)
Definition: sensors_hal_proxy.cpp:208
std::atomic< bool > hal_activated_
Definition: sensors_hal_proxy.h:50
std::thread reboot_monitor_thread_
Definition: sensors_hal_proxy.h:45
transport::SharedFdChannel control_channel_
Definition: sensors_hal_proxy.h:46
SharedFD kernel_events_fd_
Definition: sensors_hal_proxy.h:48
std::thread req_responder_thread_
Definition: sensors_hal_proxy.h:43
std::mutex report_mtx_
Definition: sensors_hal_proxy.h:52
std::atomic< bool > running_
Definition: sensors_hal_proxy.h:51
SensorsSimulator & sensors_simulator_
Definition: sensors_hal_proxy.h:49
std::thread data_reporter_thread_
Definition: sensors_hal_proxy.h:44
transport::SharedFdChannel data_channel_
Definition: sensors_hal_proxy.h:47
Definition: sensors_simulator.h:38
Definition: channel_sharedfd.h:24
int SensorsMask
Definition: sensors.h:51
Definition: alloc_driver.h:20
DeviceType
Definition: device_type.h:23
__u32 mask
Definition: nl80211.h:0