Screen API#

Name

Specification

Description

screenshots

` ARRAY OBJECT_PATH` property (read)

Get the list of screenshots on the device.

screenshotAdded

signal - (out) OBJECT_PATH

Signal sent when a screenshot is added.

screenshotRemoved

signal - (out) OBJECT_PATH

Signal sent when a screenshot is removed.

screenshotModified

signal - (out) OBJECT_PATH

Signal sent when a screenshot is modified.

addScreenshot

method - (in) blob ARRAY BYTE - (out) OBJECT_PATH

Add a screenshot taken by an application.

drawFullScreenImage

method - (in) path STRING - (out) BOOLEAN

Draw an image to the screen.

screenshot

method - (out) OBJECT_PATH

Take a screenshot.

Example Usage#

#include <liboxide.h>
#include "dbusservice_interface.h"
#include "screenapi_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() << "Requesting screen API...";
    QDBusObjectPath path = api.requestAPI("screen");
    if(path.path() == "/"){
        qDebug() << "Unable to get screen API";
        return EXIT_FAILURE;
    }
    qDebug() << "Got the screen API!";

    Screen screen(OXIDE_SERVICE, path.path(), bus);
    path = screen.screenshot();
    if(path.path() == "/"){
        qDebug() << "Screenshot failed";
    }else{
        qDebug() << "Screenshot taken";
    }
    return EXIT_SUCCESS;
}
#!/bin/bash
echo -n "Screenshot "
if [ $(rot screen call screenshot | jq -cr) = "/" ]; then
     echo "failed"
else
     echo "taken"
fi

Screenshot#

Name

Specification

Description

blob

ARRAY BYTE property (read/write)

The blob data of the screenshot.

path

STRING property (read)

The path to the screenshot on disk.

modified

signal

Signal sent when the screenshot is modified.

removed

signal

Signal sent when the screenshot is removed.

remove

method

Remove the screenshot from the device.

Example Usage#

#include <liboxide.h>
#include "dbusservice_interface.h"
#include "screenapi_interface.h"
#include "screenshot_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() << "Requesting screen API...";
    QDBusObjectPath path = api.requestAPI("screen");
    if(path.path() == "/"){
        qDebug() << "Unable to get screen API";
        return EXIT_FAILURE;
    }
    qDebug() << "Got the screen API!";

    Screen screen(OXIDE_SERVICE, path.path(), bus);
    for(auto path : screen.screenshots()){
        Screenshot(OXIDE_SERVICE, path.path(), bus).remove().waitForFinished();
    }
    qDebug() << "Screenshots removed";
    return EXIT_SUCCESS;
}
#!/bin/bash
rot screen get screenshots \
     | jq -cr 'values | join("\n")' \
     | sed 's|/codes/eeems/oxide1/||' \
     | xargs -rI {} rot --object Screenshot:{} screen call remove
echo "Screenshots removed"

System API#

Name

Specification

Description

autoSleep

INT32 property (read/write)

Number of minutes of inactivity before the system suspends automatically. If it’s set to 0 auto sleep is disabled.

sleepInhibited

BOOLEAN property (read)

If system suspend is inhibited or not.

powerOffInhibited

BOOLEAN property (read)

If power off is inhibited or not.

leftAction

signal

Signal sent when a long press on the left button happens.

homeAction

signal

Signal sent when a long press on the home button happens.

rightAction

signal

Signal sent when a long press on the right button happens.

powerAction

signal

Signal sent when a long press on the right button happens.

s leepInhibitedChanged

signal - (out) BOOLEAN

Signal sent when sleepInhibited changes.

powe rOffInhibitedChanged

signal - (out) BOOLEAN

Signal sent when powerOffInhibited changes.

autoSleepChanged

signal - (out) BOOLEAN

Signal sent when autoSleep changes.

deviceSuspending

signal

Signal sent when system is entering a suspended state. Applications can use this signal to run cleanup code before the system suspends.

deviceResuming

signal

Signal sent when the system is resuming from sleep. Applications can use this signal to reinitialise after the system suspends.

suspend

method

Attempt to suspend the system.

powerOff

method

Attempt to power off the system.

reboot

method

Attempt to reboot the system.

activity

method

Reset the auto sleep timer. Applications should use this to track user activity that can’t be normally tracked through interaction with the touchscreen, pen, or buttons.

inhibitSleep

method

Block system sleep from happening until uninhibitSleep is called, or the application exits.

uninhibitSleep

method

Unblock system sleep.

inhibitPowerOff

method

Block system shutdown or reboot from happening until uninhibitSleep is called, or the application exits.

uninhibitPowerOff

method

Unblock system shutdown and reboot.

Example Usage#

#include <liboxide.h>
#include "dbusservice_interface.h"
#include "systemapi_interface.h"

using namespace codes::eeems::oxide1;

int main(int argc, char* argv[]){
    QCoreApplication app(argc, argv);

    auto bus = QDBusConnection::systemBus();
    General api(OXIDE_SERVICE, OXIDE_SERVICE_PATH, bus);
    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!";

    System system(OXIDE_SERVICE, path.path(), bus);
    QObject::connect(&system, &System::leftAction, []{
        qDebug() << "Left button long pressed";
        qApp->exit();
    });
    return app.exec();
}
#!/bin/bash
rot --once system listen leftAction
echo "Left button long pressed!"