Handler for a dbus session. More...
Public Member Functions | |
DBusInstance () BURGER_NOEXCEPT | |
Initialize internal values. | |
~DBusInstance () BURGER_NOEXCEPT | |
Release the connection. | |
BURGER_INLINE DBusConnection * | get_system (void) const BURGER_NOEXCEPT |
Return the dbus system connection. | |
BURGER_INLINE DBusConnection * | get_session (void) const BURGER_NOEXCEPT |
Return the dbus session connection. | |
eError | init (void) BURGER_NOEXCEPT |
Start up a dbus connection. | |
void | shutdown (void) BURGER_NOEXCEPT |
Release the connection. | |
uint_t | send_and_receive (const char *pBusName, const char *pPath, const char *pInterface, const char *pMethod,...) BURGER_NOEXCEPT |
Send and receive a message using a dbug connection. | |
uint_t | send_message (const char *pBusName, const char *pPath, const char *pInterface, const char *pMethod,...) BURGER_NOEXCEPT |
Send a message using a dbug connection. | |
uint_t | query_object (const char *pBusName, const char *pPath, const char *pInterface, const char *pObject, const int iType, void *pOutput) BURGER_NOEXCEPT |
Get a property object from "org.freedesktop.DBus.Properties". | |
void | x11_screen_saver_poll (void) BURGER_NOEXCEPT |
Send a message to screen savers to keep them disabled. | |
uint_t | x11_screen_saver_disable (uint_t bDisable) BURGER_NOEXCEPT |
Enable/disable the screen saver. | |
Static Public Member Functions | |
static uint_t | send_and_receive (DBusConnection *pConnection, const char *pBusName, const char *pPath, const char *pInterface, const char *pMethod,...) BURGER_NOEXCEPT |
Send and receive a message using a dbug connection. | |
static uint_t | send_message (DBusConnection *pConnection, const char *pBusName, const char *pPath, const char *pInterface, const char *pMethod,...) BURGER_NOEXCEPT |
Send a message using a dbug connection. | |
static uint_t | query_object (DBusConnection *pConnection, const char *pBusName, const char *pPath, const char *pInterface, const char *pObject, const int iType, void *pOutput) BURGER_NOEXCEPT |
Get a property object from "org.freedesktop.DBus.Properties". | |
Static Public Attributes | |
static const int | kTimeout = 333 |
Message timeout in milliseconds. | |
Static Protected Member Functions | |
static uint_t | send_and_receive (DBusConnection *pConnection, const char *pBusName, const char *pPath, const char *pInterface, const char *pMethod, va_list pArgList) BURGER_NOEXCEPT |
Internal function to send and receive a message. | |
static uint_t | send_message (DBusConnection *pConnection, const char *pBusName, const char *pPath, const char *pInterface, const char *pMethod, va_list pArgList) BURGER_NOEXCEPT |
Internal function to send a message. | |
static uint_t | send_and_receive (DBusConnection *pConnection, DBusMessage *pMessage, const int iType, void *pOutput) BURGER_NOEXCEPT |
Internal function to send and receive a message. | |
static uint_t | add_key_value (DBusMessageIter *iterInit, const char *key, const char *value) BURGER_NOEXCEPT |
Update a dictionary with a value. | |
Protected Attributes | |
DBusConnection * | m_pSystem |
DBus system connection. | |
DBusConnection * | m_pSession |
DBus session connection. | |
char * | m_pDisableObject |
String for the screen saver disable. | |
uint32_t | m_uScreenSaverToken |
Screen saver token from X11. | |
uint_t | m_bScreenSaverDisable |
Set to true to disable the screen saver. | |
Private Member Functions | |
BURGER_DISABLE_COPY (DBusInstance) | |
Handler for a dbus session.
This class handles the loading of the dbus library (If available) and create and manage a connection to dbus.
Burger::Unix::DBusInstance::DBusInstance | ( | ) |
Burger::Unix::DBusInstance::~DBusInstance | ( | ) |
Release the connection.
Call shutdown() to ensure the dbus connection, if any, is properly released.
|
staticprotected |
|
private |
|
inline |
Return the dbus session connection.
|
inline |
Return the dbus system connection.
Burger::eError Burger::Unix::DBusInstance::init | ( | void | ) |
Start up a dbus connection.
Ensure that dbus is present on the platform and if so, initialize the sessions.
uint_t Burger::Unix::DBusInstance::query_object | ( | const char * | pBusName, |
const char * | pPath, | ||
const char * | pInterface, | ||
const char * | pObject, | ||
const int | iType, | ||
void * | pOutput ) |
Get a property object from "org.freedesktop.DBus.Properties".
Using dbus via the default session, query "org.freedesktop.DBus.Properties" for the requested object.
pBusName | Pointer to "C" string of the bus to talk to |
pPath | Pointer to "C" string to path |
pInterface | Pointer to "C" string to interface |
pObject | Pointer to "C" string of object to query |
iType | Type of object to obtain |
pOutput | Pointer to a buffer to get a copy of the object |
|
static |
Get a property object from "org.freedesktop.DBus.Properties".
Using dbus, query "org.freedesktop.DBus.Properties" for the requested object.
pConnection | Pointer to active connection |
pBusName | Pointer to "C" string of the bus to talk to |
pPath | Pointer to "C" string to path |
pInterface | Pointer to "C" string to interface |
pObject | Pointer to "C" string of object to query |
iType | Type of object to obtain |
pOutput | Pointer to a buffer to get a copy of the object |
uint_t Burger::Unix::DBusInstance::send_and_receive | ( | const char * | pBusName, |
const char * | pPath, | ||
const char * | pInterface, | ||
const char * | pMethod, | ||
... ) |
Send and receive a message using a dbug connection.
Send a message on dbus and get the answer from the default session.
See https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0
pBusName | Pointer to "C" string of the bus to talk to |
pPath | Pointer to "C" string to path |
pInterface | Pointer to "C" string to interface |
pMethod | Pointer to "C" string of method to call |
... | Argument list to send to the method |
|
staticprotected |
Internal function to send and receive a message.
Send a message on dbus and get the answer. If the connection is nullptr, do nothing and return FALSE
See https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0
pConnection | Pointer to active connection |
pBusName | Pointer to "C" string of the bus to talk to |
pPath | Pointer to "C" string to path |
pInterface | Pointer to "C" string to interface |
pMethod | Pointer to "C" string of method to call |
pArgList | Argument list to send to the method |
|
static |
Send and receive a message using a dbug connection.
Send a message on dbus and get the answer. If the connection is nullptr, do nothing and return FALSE
See https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0
pConnection | Pointer to active connection |
pBusName | Pointer to "C" string of the bus to talk to |
pPath | Pointer to "C" string to path |
pInterface | Pointer to "C" string to interface |
pMethod | Pointer to "C" string of method to call |
... | Argument list to send to the method |
|
staticprotected |
Internal function to send and receive a message.
Send a message on dbus and get the answer. If the connection is nullptr, do nothing and return FALSE\
pConnection | Pointer to active connection |
pMessage | DBusMessage to send |
iType | Type of data to receive |
pOutput | Pointer to buffer to receive the data |
uint_t Burger::Unix::DBusInstance::send_message | ( | const char * | pBusName, |
const char * | pPath, | ||
const char * | pInterface, | ||
const char * | pMethod, | ||
... ) |
Send a message using a dbug connection.
Send a message on dbus on the default session.
See https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0
pBusName | Pointer to "C" string of the bus to talk to |
pPath | Pointer to "C" string to path |
pInterface | Pointer to "C" string to interface |
pMethod | Pointer to "C" string of method to call |
... | Argument list to send to the method |
|
staticprotected |
Internal function to send a message.
Send a message on dbus. If the connection is nullptr, do nothing and return FALSE
See https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0
pConnection | Pointer to active connection |
pBusName | Pointer to "C" string of the bus to talk to |
pPath | Pointer to "C" string to path |
pInterface | Pointer to "C" string to interface |
pMethod | Pointer to "C" string of method to call |
pArgList | Argument list to send to the method |
|
static |
Send a message using a dbug connection.
Send a message on dbus. If the connection is nullptr, do nothing and return FALSE
See https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#ga98ddc82450d818138ef326a284201ee0
pConnection | Pointer to active connection |
pBusName | Pointer to "C" string of the bus to talk to |
pPath | Pointer to "C" string to path |
pInterface | Pointer to "C" string to interface |
pMethod | Pointer to "C" string of method to call |
... | Argument list to send to the method |
void Burger::Unix::DBusInstance::shutdown | ( | void | ) |
Enable/disable the screen saver.
On linux systems, the freedesktop
window system supports messages that will enable and disable the activation of the screen saver. This function will enable Burgerlib to turn on or off this feature.
bDisable | TRUE to disable the screen saver |
void Burger::Unix::DBusInstance::x11_screen_saver_poll | ( | void | ) |
Send a message to screen savers to keep them disabled.
If the feature is not turned off, send a dbus message to gnome and freedesktop to let the know that the screen saver should not activate
|
static |
Message timeout in milliseconds.
|
protected |
Set to true to disable the screen saver.
|
protected |
String for the screen saver disable.
|
protected |
DBus session connection.
|
protected |
DBus system connection.
|
protected |
Screen saver token from X11.