General API#
The general API is the main entrypoint into the rest of the API. It is
unavailable for scripting through rot
, as rot
abstracts all
usage of the API away.
Name |
Specification |
Description |
---|---|---|
tarnishPid |
|
The PID of the system
service. This is useful
if you need to ack
|
apiAvailable |
signal
- (out) api
|
Signal sent when an API has been successfully requested by something. |
apiUnavailable |
signal
- (out) api
|
Signal sent when an API is no longer available. This can happen for one of the following reasons: 1. All applications that have requested the API have released it (or exited). 2. Tarnish is shutting down and releasing all the APIs manually |
aboutToQuit |
signal |
Signal sent when tarnish is about to exit. This allows background applications to gracefully exit. |
requestAPI |
method
- (in) name |
Request access to an
API.
Refused requests will
return an
|
releaseAPI |
method
- (in) name |
Release your request for access to an API. This allows Tarnish to unregister the API if nothing is using it. |
APIs |
method
- (out)
|
Request the list of available APIs on the system. |
Example Usage#
#include <liboxide.h>
#include "dbusservice_interface.h"
#include "systemapi_interface.h"
using namespace codes::eeems::oxide1;
int main(int argc, char* argv[]){
Q_UNUSED(argc);
Q_UNUSED(argv);
auto bus = QDBusConnection::systemBus();
General api(OXIDE_SERVICE, OXIDE_SERVICE_PATH, bus);
qDebug() << "Tarnish PID:" << api.tarnishPid();
qDebug() << "Requesting system API...";
QDBusObjectPath path = api.requestAPI("system");
if(path.path() == "/"){
qDebug() << "Unable to get system API";
return EXIT_FAILURE;
}
qDebug() << "Got the system API!";
qDebug() << "Releasing system API...";
api.releaseAPI("system");
return EXIT_SUCCESS;
}