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

AnboxProxy provides a proxy layer which encapsulates callbacks that can be used by a platform to change Android system behaviors. E.g. change the screen orientation. The platform can invoke the callbacks which are provided by Anbox on demand when triggering an action or changing a behavior. More...

#include <anbox_proxy.h>

+ Collaboration diagram for anbox::AnboxProxy:

Public Member Functions

 AnboxProxy ()=default
 
virtual ~AnboxProxy ()=default
 
 AnboxProxy (const AnboxProxy &)=delete
 
AnboxProxyoperator= (const AnboxProxy &)=delete
 
int change_screen_orientation (AnboxScreenOrientationType orientation_type)
 Change the screen orientation. More...
 
void set_change_screen_orientation_callback (const AnboxChangeScreenOrientationCallback &callback, void *user_data)
 Set the screen orientation change callback. More...
 
int change_display_density (uint32_t density)
 Change the display density. More...
 
void set_change_display_density_callback (const AnboxChangeDisplayDensityCallback &callback, void *user_data)
 Set the display density change callback. More...
 
int change_display_size (uint32_t width, uint32_t height)
 Change the display size. More...
 
void set_change_display_size_callback (const AnboxChangeDisplaySizeCallback &callback, void *user_data)
 Set the display size change callback. More...
 
int trigger_action (const char *name, const char **args, size_t args_len)
 Trigger an action which is executed within the Android container. More...
 
void set_trigger_action_callback (const AnboxTriggerActionCallback &callback, void *user_data)
 Set the trigger action callback. More...
 
virtual int send_message (const char *type, size_t type_size, const char *data, size_t data_size)
 Send a message from Anbox to the platform. More...
 
int create_adb_connection (const char *id)
 Create ADB connection. More...
 
void set_create_adb_connection_callback (const AnboxCreateADBConnectionCallback &callback, void *user_data)
 Set the ADB connection creation callback. More...
 

Detailed Description

AnboxProxy provides a proxy layer which encapsulates callbacks that can be used by a platform to change Android system behaviors. E.g. change the screen orientation. The platform can invoke the callbacks which are provided by Anbox on demand when triggering an action or changing a behavior.

Definition at line 65 of file anbox_proxy.h.

Constructor & Destructor Documentation

◆ AnboxProxy() [1/2]

anbox::AnboxProxy::AnboxProxy ( )
default

◆ ~AnboxProxy()

virtual anbox::AnboxProxy::~AnboxProxy ( )
virtualdefault

◆ AnboxProxy() [2/2]

anbox::AnboxProxy::AnboxProxy ( const AnboxProxy )
delete

Member Function Documentation

◆ change_display_density()

int anbox::AnboxProxy::change_display_density ( uint32_t  density)
inline

Change the display density.

Parameters
densitythe density value of the display
Returns
0 on success, otherwise returns EINVAL on error occurs.

Definition at line 97 of file anbox_proxy.h.

◆ change_display_size()

int anbox::AnboxProxy::change_display_size ( uint32_t  width,
uint32_t  height 
)
inline

Change the display size.

Parameters
widththe width of the display size
heightthe height of the display size
Returns
0 on success, otherwise returns EINVAL on error occurs.

Definition at line 117 of file anbox_proxy.h.

◆ change_screen_orientation()

int anbox::AnboxProxy::change_screen_orientation ( AnboxScreenOrientationType  orientation_type)
inline

Change the screen orientation.

Parameters
orientation_typethe type of orientation to be applied to Android container
Returns
0 on success, otherwise returns EINVAL on error occurs.

Definition at line 78 of file anbox_proxy.h.

◆ create_adb_connection()

int anbox::AnboxProxy::create_adb_connection ( const char *  id)
inline

Create ADB connection.

Parameters
idthe unique ID of the ADB connection
Returns
a positive value representing the exposed ADB connection port number on success, or EINVAL if an error occurs.

Definition at line 184 of file anbox_proxy.h.

◆ operator=()

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

◆ send_message()

virtual int anbox::AnboxProxy::send_message ( const char *  type,
size_t  type_size,
const char *  data,
size_t  data_size 
)
inlinevirtual

Send a message from Anbox to the platform.

Parameters
typepointer to type data
type_sizelength of type data
datapointer to message data
data_sizelength of message data
Returns
0 on success, otherwise returns a negative value on error.

Definition at line 168 of file anbox_proxy.h.

◆ set_change_display_density_callback()

void anbox::AnboxProxy::set_change_display_density_callback ( const AnboxChangeDisplayDensityCallback callback,
void *  user_data 
)
inline

Set the display density change callback.

Definition at line 104 of file anbox_proxy.h.

◆ set_change_display_size_callback()

void anbox::AnboxProxy::set_change_display_size_callback ( const AnboxChangeDisplaySizeCallback callback,
void *  user_data 
)
inline

Set the display size change callback.

Definition at line 124 of file anbox_proxy.h.

◆ set_change_screen_orientation_callback()

void anbox::AnboxProxy::set_change_screen_orientation_callback ( const AnboxChangeScreenOrientationCallback callback,
void *  user_data 
)
inline

Set the screen orientation change callback.

Definition at line 85 of file anbox_proxy.h.

◆ set_create_adb_connection_callback()

void anbox::AnboxProxy::set_create_adb_connection_callback ( const AnboxCreateADBConnectionCallback callback,
void *  user_data 
)
inline

Set the ADB connection creation callback.

Definition at line 191 of file anbox_proxy.h.

◆ set_trigger_action_callback()

void anbox::AnboxProxy::set_trigger_action_callback ( const AnboxTriggerActionCallback callback,
void *  user_data 
)
inline

Set the trigger action callback.

Definition at line 153 of file anbox_proxy.h.

◆ trigger_action()

int anbox::AnboxProxy::trigger_action ( const char *  name,
const char **  args,
size_t  args_len 
)
inline

Trigger an action which is executed within the Android container.

Parameters
namethe name of action
argsthe arguments to be launched the action
args_lenthe number of arguments to launch the action
Returns
0 on success, otherwise returns EINVAL on error occurs.
Note
the args only stands for the parameter to action and unlike standard C the action name must not be included in the parameters. So does args_len only reflects the number of parameters, the name of the action must not be counted. The returned value 0 only implies the request to launch action is handled by Anbox successfully, it doesn't tell if the action is invoked successfully within the Android container or not. To check the actual error message if the action script is not executed successfully within the Android container, please view the log of anbox service unit.

Definition at line 146 of file anbox_proxy.h.


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