anbox-platform-sdk  1.23.0
Anbox Platform SDK API documentation
anbox::Platform Class Referenceabstract

Platform defines the custom Anbox platform implemented by a plugin. More...

#include <platform.h>

+ Collaboration diagram for anbox::Platform:

Public Member Functions

 Platform ()=default
 
virtual ~Platform ()=default
 
 Platform (const Platform &)=delete
 
Platformoperator= (const Platform &)=delete
 
virtual AudioProcessoraudio_processor ()=0
 Retrieve the platform audio processor instance. More...
 
virtual InputProcessorinput_processor ()=0
 Retrieve the platform input processor instance. More...
 
virtual GraphicsProcessorgraphics_processor ()
 Retrieve the platform graphics processor instance. More...
 
virtual SensorProcessorsensor_processor ()
 Retrieve the platform sensor processor instance. More...
 
virtual GpsProcessorgps_processor ()
 Retrieve the platform gps processor instance. More...
 
virtual CameraProcessorcamera_processor ()
 Retrieve the platform camera processor instance. More...
 
virtual AnboxProxyanbox_proxy ()
 Retrieve the platform anbox proxy. More...
 
virtual VideoDecodercreate_video_decoder (AnboxVideoCodecType codec_type)
 Create a video decoder instances for a codec of the given name. More...
 
virtual VhalConnectorvhal_connector ()
 Retrieve the platform vhal connector instance. More...
 
virtual bool ready () const =0
 Query the platform for its ready status. More...
 
virtual int wait_until_ready ()=0
 Wait for platform plugin to be initialized. More...
 
virtual int get_config_item (AnboxPlatformConfigurationKey key, void *data, size_t data_size)=0
 Retrieve the configuration options provided by platform plugin. More...
 
virtual int stop ()
 Ask the platform to stop any pending work it has to prepare for Anbox to terminate. More...
 
virtual void handle_event (AnboxEventType type)
 Handle an event sending from Anbox. More...
 
virtual int set_config_item (AnboxPlatformConfigurationKey key, void *data, size_t data_size)
 Set the configuration options by Anbox to the platform. More...
 
virtual void setup_event_tracer (AnboxTracerGetCategoryEnabledFunc get_category_enabled_callback, AnboxTracerAddEventFunc add_event_callback)
 Register an external event tracing implementation withe platform. More...
 

Detailed Description

Platform defines the custom Anbox platform implemented by a plugin.

It supports the following features:

  • Process the audio data that is passed by Anbox from the Anroid container.
  • Delivery of input events to the Android container.
  • Loading a custom Open GL ES/EGL driver implementation.

Definition at line 45 of file platform.h.

Constructor & Destructor Documentation

◆ Platform() [1/2]

anbox::Platform::Platform ( )
default

◆ ~Platform()

virtual anbox::Platform::~Platform ( )
virtualdefault

◆ Platform() [2/2]

anbox::Platform::Platform ( const Platform )
delete

Member Function Documentation

◆ anbox_proxy()

virtual AnboxProxy* anbox::Platform::anbox_proxy ( )
inlinevirtual

Retrieve the platform anbox proxy.

A platform is supposed to have only a single anbox proxy instance at all time.

Returns
a valid AnboxProxy instance, otherwise NULL when an error occured. or the platform does not support to handle the system behavior change via callbacks.

Definition at line 128 of file platform.h.

◆ audio_processor()

virtual AudioProcessor* anbox::Platform::audio_processor ( )
pure virtual

Retrieve the platform audio processor instance.

A platform is supposed to have only a single audio processor instance at all time.

Returns
a valid AudioProcessor instance, otherwise NULL when an error occured or the platform does not support audio processing.

◆ camera_processor()

virtual CameraProcessor* anbox::Platform::camera_processor ( )
inlinevirtual

Retrieve the platform camera processor instance.

A platform is supposed to have only a single camera processor instance at all time.

Returns
a valid CameraProcessor instance, otherwise NULL when an error occured. or the platform does not support posting a video frame to a camera application running in Android container.

Definition at line 118 of file platform.h.

◆ create_video_decoder()

virtual VideoDecoder* anbox::Platform::create_video_decoder ( AnboxVideoCodecType  codec_type)
inlinevirtual

Create a video decoder instances for a codec of the given name.

Returns
a valid VideoDecoder instance, otherwise NULL when an error occurred or if video decoding is not supported by the platform.

Definition at line 136 of file platform.h.

◆ get_config_item()

virtual int anbox::Platform::get_config_item ( AnboxPlatformConfigurationKey  key,
void *  data,
size_t  data_size 
)
pure virtual

Retrieve the configuration options provided by platform plugin.

This function provides a way for anbox to read a configuration option from the plugin.

Parameters
keyplugin configuration option key.
datapointer stores the address of the configuration key value.
data_sizesize of the memory the data pointer points to
Returns
0 on success, a negative error code otherwise. Possible are -EINVAL (invalid arguments supplied) and -ENOMEM (provided memory is not large enough to store the value of the configuration item).

◆ gps_processor()

virtual GpsProcessor* anbox::Platform::gps_processor ( )
inlinevirtual

Retrieve the platform gps processor instance.

A platform is supposed to have only a single gps processor instance at all time.

Returns
a valid SensorProcessor instance, otherwise NULL when an error occured. or the platform does not support gps processing.

Definition at line 106 of file platform.h.

◆ graphics_processor()

virtual GraphicsProcessor* anbox::Platform::graphics_processor ( )
inlinevirtual

Retrieve the platform graphics processor instance.

A platform is supposed to have only a single graphics processor instance at all time. Providing a graphics processor is not mandatory for a platform.

Returns
a valid GraphicsProcessor instance, otherwise NULL when an error occured. or the platform does not support graphics processing.

Definition at line 84 of file platform.h.

◆ handle_event()

virtual void anbox::Platform::handle_event ( AnboxEventType  type)
inlinevirtual

Handle an event sending from Anbox.

Some operations (E.g. trigger an action) or initialization routine of a platform may require Android container fully booted or all essential components of Anbox are fully initialized.

This enables a platform to get notified when an event was fired from Anbox and perform one specific operation when a certain event is received.

Definition at line 209 of file platform.h.

◆ input_processor()

virtual InputProcessor* anbox::Platform::input_processor ( )
pure virtual

Retrieve the platform input processor instance.

A platform is supposed to have only a single input processor instance at all time.

Returns
a valid InputProcessor instance, otherwise NULL when an error occured. or the platform does not support input processing.

◆ operator=()

Platform& anbox::Platform::operator= ( const Platform )
delete

◆ ready()

virtual bool anbox::Platform::ready ( ) const
pure virtual

Query the platform for its ready status.

A platform is supposed to have different status during initialization

Returns
true if the platform is fully initialized, otherwise false.

◆ sensor_processor()

virtual SensorProcessor* anbox::Platform::sensor_processor ( )
inlinevirtual

Retrieve the platform sensor processor instance.

A platform is supposed to have only a single sensor processor instance at all time.

Returns
a valid SensorProcessor instance, otherwise NULL when an error occured. or the platform does not support sensor processing.

Definition at line 95 of file platform.h.

◆ set_config_item()

virtual int anbox::Platform::set_config_item ( AnboxPlatformConfigurationKey  key,
void *  data,
size_t  data_size 
)
inlinevirtual

Set the configuration options by Anbox to the platform.

This function provides a way for anbox to write a configuration option to the plugin.

Parameters
keyplugin configuration option key.
datapointer stores the address of the configuration key value.
data_sizesize of the memory the data pointer points to
Returns
0 on success, a negative error code otherwise. Possible are -EINVAL (invalid arguments supplied) and -ENOMEM (provided memory is not large enough to store the value of the configuration item).

Definition at line 223 of file platform.h.

◆ setup_event_tracer()

virtual void anbox::Platform::setup_event_tracer ( AnboxTracerGetCategoryEnabledFunc  get_category_enabled_callback,
AnboxTracerAddEventFunc  add_event_callback 
)
inlinevirtual

Register an external event tracing implementation withe platform.

Parameters
get_category_enabled_callbackCallback the platform can use to determine if a certain tracing category is enabled
add_event_callbackCallback to submit a tracing event to the Anbox runtime

Definition at line 236 of file platform.h.

◆ stop()

virtual int anbox::Platform::stop ( )
inlinevirtual

Ask the platform to stop any pending work it has to prepare for Anbox to terminate.

Anbox will wait for the function to return before it finishes its termination process. The function is called very early on before the Android container is stopped.

The platform is expected to stop its processors and don't provide any further data to Anbox. Any further data provided to Anbox after the function has returned will not be considered.

Returns
0 on success, a negative error code otherwise. Possible is -EINVAL (invalid arguments supplied).

Definition at line 198 of file platform.h.

◆ vhal_connector()

virtual VhalConnector* anbox::Platform::vhal_connector ( )
inlinevirtual

Retrieve the platform vhal connector instance.

A platform is supposed to have only a single vhal connector instance at all time.

Returns
a valid VhalConnector instance, otherwise NULL when an error occured, or the platform does not support connecting to the vhal service running in Android container.

Definition at line 151 of file platform.h.

◆ wait_until_ready()

virtual int anbox::Platform::wait_until_ready ( )
pure virtual

Wait for platform plugin to be initialized.

This function allows the caller to wait until the plugin platform has fully initialized all internal components. Once the platform plugin reports it is ready Anbox will start the Android container.

Returns
0 on success, a negative error code otherwise.

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