Termux:GUI C/C++ Bindings
|
This file contains all functions related to the connection object, as well as global methods requiring no Activities. More...
#include "types.h"
Go to the source code of this file.
Functions | |
tgui_err | tgui_to_termux () |
Brings Termux to the foreground. More... | |
tgui_err | tgui_connection_create (tgui_connection *c) |
Creates a connection to the Termux:GUI plugin. Waits up to 6 seconds for the plugin to connect. More... | |
tgui_err | tgui_get_version (tgui_connection c, int *v) |
Gets the version code of the plugin app. Can be used to disable features not supported by the plugin version. More... | |
tgui_err | tgui_set_log_level (tgui_connection c, int level) |
Sets the log level of the plugin. Can be used for debugging. More... | |
tgui_err | tgui_get_log (tgui_connection c, bool clear, char **log) |
Gets the log of the plugin. Can be used for debugging. More... | |
tgui_err | tgui_toast (tgui_connection c, const char *text, bool l) |
Sends a toast using the connection. More... | |
tgui_err | tgui_turn_screen_on (tgui_connection c) |
Turns the screen on. More... | |
tgui_err | tgui_is_locked (tgui_connection c, bool *locked) |
Checks whether the screen is locked. More... | |
tgui_err | tgui_request_unlock (tgui_connection c, tgui_activity a) |
Requests a lockscreen unlock. When the lockscreen isn't protected, unlocks it. When the lockscreen is protected, brings up the UI for the user to unlock it. More... | |
tgui_err | tgui_wait_event (tgui_connection c, tgui_event *event) |
Waits for an event from the plugin and returns it. Events have to be destroyed with tgui_event_destroy . More... | |
tgui_err | tgui_poll_event (tgui_connection c, tgui_event *event, bool *available) |
Returns an event from the plugin if one is available without blocking. Events have to be destroyed with tgui_event_destroy . More... | |
void | tgui_event_destroy (tgui_event *event) |
Frees the memory of an event. Some events fill the union with pointers to dynamic memory, which have to be freed. More... | |
void | tgui_connection_destroy (tgui_connection c) |
Closes a connection and frees the resources (all objects created with the connection still have to be destroyed). All open Activities will be closed by the plugin automatically. More... | |
This file contains all functions related to the connection object, as well as global methods requiring no Activities.
tgui_err tgui_to_termux | ( | ) |
tgui_err tgui_connection_create | ( | tgui_connection * | c | ) |
Creates a connection to the Termux:GUI plugin. Waits up to 6 seconds for the plugin to connect.
[out] | c | The newly created connection, if no error occurred. |
tgui_err tgui_get_version | ( | tgui_connection | c, |
int * | v | ||
) |
Gets the version code of the plugin app. Can be used to disable features not supported by the plugin version.
c | The connection to use. | |
[out] | v | The version code |
tgui_err tgui_set_log_level | ( | tgui_connection | c, |
int | level | ||
) |
Sets the log level of the plugin. Can be used for debugging.
c | The connection to use. |
level | The requested log level, from 0 to 10 (inclusive). |
tgui_err tgui_get_log | ( | tgui_connection | c, |
bool | clear, | ||
char ** | log | ||
) |
Gets the log of the plugin. Can be used for debugging.
c | The connection to use. | |
clear | Set to true if you want to clear the log after getting it. | |
[out] | log | Gets set to a pointer to the retrieved log buffer if successful. Has to be freed with free(). |
tgui_err tgui_toast | ( | tgui_connection | c, |
const char * | text, | ||
bool | l | ||
) |
Sends a toast using the connection.
c | The connection to use. | |
[in] | text | The text to display. |
l | true if the toast should be displayed for a long time, false for a short time. |
tgui_err tgui_turn_screen_on | ( | tgui_connection | c | ) |
tgui_err tgui_is_locked | ( | tgui_connection | c, |
bool * | locked | ||
) |
tgui_err tgui_request_unlock | ( | tgui_connection | c, |
tgui_activity | a | ||
) |
Requests a lockscreen unlock. When the lockscreen isn't protected, unlocks it. When the lockscreen is protected, brings up the UI for the user to unlock it.
c | The connection to use. |
a | The Activity that wants to unlock the screen. |
tgui_err tgui_wait_event | ( | tgui_connection | c, |
tgui_event * | event | ||
) |
Waits for an event from the plugin and returns it. Events have to be destroyed with tgui_event_destroy
.
c | The connection to use. | |
[out] | event | The event from the plugin. |
tgui_err tgui_poll_event | ( | tgui_connection | c, |
tgui_event * | event, | ||
bool * | available | ||
) |
Returns an event from the plugin if one is available without blocking. Events have to be destroyed with tgui_event_destroy
.
c | The connection to use. | |
[out] | event | The event from the plugin. |
[out] | available | Set to true if an event was available. If false, event is invalid and doesn't need to be destroyed. |
void tgui_event_destroy | ( | tgui_event * | event | ) |
Frees the memory of an event. Some events fill the union with pointers to dynamic memory, which have to be freed.
event | The event to free. |
void tgui_connection_destroy | ( | tgui_connection | c | ) |
Closes a connection and frees the resources (all objects created with the connection still have to be destroyed). All open Activities will be closed by the plugin automatically.
c | The connection to close. |