tuned-switcher 1.1.0
Performance profile manager
Loading...
Searching...
No Matches
SystemdService Class Reference

#include <systemdservice.h>

Inheritance diagram for SystemdService:
Collaboration diagram for SystemdService:

Public Member Functions

 SystemdService (QObject *parent=nullptr)
 
 ~SystemdService () override=default
 
bool IsSupported () const override
 
bool IsRunning () const override
 
bool Start () const override
 
bool Stop () const override
 
- Public Member Functions inherited from ServiceManager
virtual ~ServiceManager ()=default
 

Private Member Functions

QString GetServiceState (const QString &) const
 

Private Attributes

const QString SystemdBusName = QStringLiteral("org.freedesktop.systemd1")
 
const QString SystemdBusPath = QStringLiteral("/org/freedesktop/systemd1")
 
const QString SystemdBusInterfaceManager = QStringLiteral("org.freedesktop.systemd1.Manager")
 
const QString SystemdBusInterfaceUnit = QStringLiteral("org.freedesktop.systemd1.Unit")
 
const QString SystemdBusMethodNameGetUnit = QStringLiteral("GetUnit")
 
const QString SystemdBusMethodNameStart = QStringLiteral("StartUnit")
 
const QString SystemdBusMethodNameStop = QStringLiteral("StopUnit")
 
const QString SystemdBusPropertyNameActiveState = QStringLiteral("ActiveState")
 
const QString SystemdBusPropertyNameSystemState = QStringLiteral("SystemState")
 
const QString SystemdBusValueServiceActive = QStringLiteral("active")
 
const QString SystemdTunedServiceName = QStringLiteral("tuned.service")
 
const QString SystemdTunedServiceMode = QStringLiteral("replace")
 
const QString DBusPropertyInterface = QStringLiteral("org.freedesktop.DBus.Properties")
 
const QString DBusPropertyMethodNameGet = QStringLiteral("Get")
 
QDBusConnection DBusInstance = QDBusConnection::systemBus()
 

Additional Inherited Members

- Static Public Member Functions inherited from ServiceManager
static ServiceManagerCreate (QObject *parent=nullptr)
 
- Protected Member Functions inherited from ServiceManager
 ServiceManager (QObject *parent=nullptr)
 

Detailed Description

Class for working with the systemd service manager.

Constructor & Destructor Documentation

◆ SystemdService()

SystemdService::SystemdService ( QObject * parent = nullptr)
explicit

Main constructor of the SystemdService class.

Parameters
parentParent.

◆ ~SystemdService()

SystemdService::~SystemdService ( )
overridedefault

Destructor of the SystemdService class.

Member Function Documentation

◆ GetServiceState()

QString SystemdService::GetServiceState ( const QString & BusPath) const
private

Get the state of the Tuned service.

Parameters
BusPathDBus service object path.
Returns
The state of the Tuned service, or an empty string if an error occurs.

◆ IsRunning()

bool SystemdService::IsRunning ( ) const
overridevirtual

Check whether the Tuned service is running using the DBus API.

Returns
Whether the Tuned sevice is running.
Return values
trueThe Tuned service is running.
falseThe Tuned servic is not running.

Implements ServiceManager.

◆ IsSupported()

bool SystemdService::IsSupported ( ) const
overridevirtual

Check whether the service control feature is supported.

Returns
Whether the service control feature is supported.
Return values
trueThe service control feature is supported.
falseThe service control feature is not supported.

Implements ServiceManager.

◆ Start()

bool SystemdService::Start ( ) const
overridevirtual

Start the Tuned service using the DBus API.

Returns
Result of the requested operation.
Return values
trueThe Tuned service was successfully started.
falseAn error occurred when trying to start the Tuned service.

Implements ServiceManager.

◆ Stop()

bool SystemdService::Stop ( ) const
overridevirtual

Stop the Tuned service using the DBus API.

Returns
Result of the requested operation.
Return values
trueThe Tuned service was successfully stopped.
falseAn error occurred when trying to stop the Tuned service.

Implements ServiceManager.

Member Data Documentation

◆ DBusInstance

QDBusConnection SystemdService::DBusInstance = QDBusConnection::systemBus()
private

Stores DBus instance.

◆ DBusPropertyInterface

const QString SystemdService::DBusPropertyInterface = QStringLiteral("org.freedesktop.DBus.Properties")
private

Stores the Systemd Properties DBus interface.

◆ DBusPropertyMethodNameGet

const QString SystemdService::DBusPropertyMethodNameGet = QStringLiteral("Get")
private

Stores the Systemd DBus GetProperty method name.

◆ SystemdBusInterfaceManager

const QString SystemdService::SystemdBusInterfaceManager = QStringLiteral("org.freedesktop.systemd1.Manager")
private

Stores the Systemd Manager DBus interface.

◆ SystemdBusInterfaceUnit

const QString SystemdService::SystemdBusInterfaceUnit = QStringLiteral("org.freedesktop.systemd1.Unit")
private

Stores the Systemd Unit DBus interface.

◆ SystemdBusMethodNameGetUnit

const QString SystemdService::SystemdBusMethodNameGetUnit = QStringLiteral("GetUnit")
private

Stores the Systemd DBus GetUnit method name.

◆ SystemdBusMethodNameStart

const QString SystemdService::SystemdBusMethodNameStart = QStringLiteral("StartUnit")
private

Stores the Systemd DBus MethodNameStart method name.

◆ SystemdBusMethodNameStop

const QString SystemdService::SystemdBusMethodNameStop = QStringLiteral("StopUnit")
private

Stores the Systemd DBus MethodNameStop method name.

◆ SystemdBusName

const QString SystemdService::SystemdBusName = QStringLiteral("org.freedesktop.systemd1")
private

Stores the Systemd DBus interface name.

◆ SystemdBusPath

const QString SystemdService::SystemdBusPath = QStringLiteral("/org/freedesktop/systemd1")
private

Stores the Systemd DBus object path.

◆ SystemdBusPropertyNameActiveState

const QString SystemdService::SystemdBusPropertyNameActiveState = QStringLiteral("ActiveState")
private

Stores the Systemd DBus ActiveState property name.

◆ SystemdBusPropertyNameSystemState

const QString SystemdService::SystemdBusPropertyNameSystemState = QStringLiteral("SystemState")
private

Stores the Systemd DBus SystemState property name.

◆ SystemdBusValueServiceActive

const QString SystemdService::SystemdBusValueServiceActive = QStringLiteral("active")
private

Stores the Tuned DBus ServiceActive value.

◆ SystemdTunedServiceMode

const QString SystemdService::SystemdTunedServiceMode = QStringLiteral("replace")
private

Stores the Systemd start/stop service mode.

◆ SystemdTunedServiceName

const QString SystemdService::SystemdTunedServiceName = QStringLiteral("tuned.service")
private

Stores the Tuned Systemd service name.


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