Android-cuttlefish cvd tool
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
cuttlefish::webrtc_streaming::SensorsHandler Class Reference

#include <sensors_handler.h>

Collaboration diagram for cuttlefish::webrtc_streaming::SensorsHandler:
Collaboration graph
[legend]

Public Types

using MotionUpdatedCallback = std::function< void(const uint8_t *, size_t)>
 

Public Member Functions

 SensorsHandler (SharedFD sensors_fd)
 
 ~SensorsHandler ()
 
Result< void > SetMotion (double x, double y, double z)
 
Result< void > SetHingeAngle (double angle)
 
int AddMotionUpdatedCallback (MotionUpdatedCallback callback)
 
void RemoveMotionUpdatedCallback (int subscriber_id)
 

Private Member Functions

Result< void > SendCommand (uint32_t cmd, std::string_view payload)
 
Result< std::string > GetSensorsData (sensors::SensorsMask mask)
 
void NotifyMotionUpdated ()
 

Private Attributes

std::unordered_map< int, MotionUpdatedCallbackclient_channels_
 
int last_client_channel_id_ = -1
 
std::mutex subscribers_mtx_
 
transport::SharedFdChannel channel_
 

Member Typedef Documentation

◆ MotionUpdatedCallback

using cuttlefish::webrtc_streaming::SensorsHandler::MotionUpdatedCallback = std::function<void(const uint8_t*, size_t)>

Constructor & Destructor Documentation

◆ SensorsHandler()

cuttlefish::webrtc_streaming::SensorsHandler::SensorsHandler ( SharedFD  sensors_fd)
explicit

◆ ~SensorsHandler()

cuttlefish::webrtc_streaming::SensorsHandler::~SensorsHandler ( )

Member Function Documentation

◆ AddMotionUpdatedCallback()

int cuttlefish::webrtc_streaming::SensorsHandler::AddMotionUpdatedCallback ( MotionUpdatedCallback  callback)

◆ GetSensorsData()

Result< std::string > cuttlefish::webrtc_streaming::SensorsHandler::GetSensorsData ( sensors::SensorsMask  mask)
private

◆ NotifyMotionUpdated()

void cuttlefish::webrtc_streaming::SensorsHandler::NotifyMotionUpdated ( )
private

◆ RemoveMotionUpdatedCallback()

void cuttlefish::webrtc_streaming::SensorsHandler::RemoveMotionUpdatedCallback ( int  subscriber_id)

◆ SendCommand()

Result< void > cuttlefish::webrtc_streaming::SensorsHandler::SendCommand ( uint32_t  cmd,
std::string_view  payload 
)
private

◆ SetHingeAngle()

Result< void > cuttlefish::webrtc_streaming::SensorsHandler::SetHingeAngle ( double  angle)

◆ SetMotion()

Result< void > cuttlefish::webrtc_streaming::SensorsHandler::SetMotion ( double  x,
double  y,
double  z 
)

Member Data Documentation

◆ channel_

transport::SharedFdChannel cuttlefish::webrtc_streaming::SensorsHandler::channel_
private

◆ client_channels_

std::unordered_map<int, MotionUpdatedCallback> cuttlefish::webrtc_streaming::SensorsHandler::client_channels_
private

◆ last_client_channel_id_

int cuttlefish::webrtc_streaming::SensorsHandler::last_client_channel_id_ = -1
private

◆ subscribers_mtx_

std::mutex cuttlefish::webrtc_streaming::SensorsHandler::subscribers_mtx_
private

The documentation for this class was generated from the following files: