dbus

qdbusxml2cpp unknown type

我的梦境 提交于 2019-12-05 11:31:18
While using the qdbusxml2cpp program to convert the following xml to a Qt Class, I am getting this error: qdbusxml2cpp -c ObjectManager -a ObjectManager:ObjectManager.cpp xml/object_manager.xml Got unknown type `a{oa{sa{sv}}}' You should add <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="<type>"/> to the XML description D-Feet description: XML: <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node><interface name="org.freedesktop.DBus.Introspectable"><method name="Introspect"><arg

Linux Shutdown with dbus-send

孤人 提交于 2019-12-05 10:39:10
I am writing a Java app to shutdown my Linux box remotely. The desktop app sits and waits for a command to be sent to it. I have tried using "shutdown -h" but this requires sudo privileges and is not an option. I then found a way to shutdown without sudo using the following dbus-send solution: dbus-send --print-reply --system --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown This works fine but I am trying to figure out, using dbus-send, if its possible to do a timed shutdown similar to "shutdown 3600" which would shut

Use dbus to just send a message in Python

﹥>﹥吖頭↗ 提交于 2019-12-05 02:38:18
问题 I have 2 Python programs. I just want to send a message (a long string) from the one to the other, and I want use dbus. Now, is there an easy way to do this? For example, if the message is very small, I have partially solved the problem putting the message in the path. But then I had to use the external program dbus-send: Server (python): import dbus,gtk from dbus.mainloop.glib import DBusGMainLoop DBusGMainLoop(set_as_default=True) bus = dbus.SessionBus() def msg_handler(*args,**keywords):

QtDbus is not working in Qt5.4.1 on Windows 7

血红的双手。 提交于 2019-12-04 18:21:23
When I run the Qt Creator dbus examples, they couldn't run, is there any settings or stuff for working QtDbus module or any prerequistics? for example in chat project: if (!QDBusConnection::sessionBus().isConnected()) { qWarning("Cannot connect to the D-Bus session bus.\n" "Please check your system settings and try again.\n"); return 1; } returns 1 and program terminated. Finally I found the solution: For QtDbus module get working, The 3rd party Dbus module must be installed in Windows: Dbus Windows Installer Download After downloading and installing Dbus, it gets working without any

Unable to autolaunch a dbus-daemon without a $DISPLAY for X11. NetBeans. Pi as remote host

≡放荡痞女 提交于 2019-12-04 18:03:16
I am trying to run the following example code using my NetBeans IDE: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dbus/dbus.h> int main() { DBusConnection *connection = NULL; DBusError error; char buffer[1024]; dbus_error_init(&error); connection = dbus_bus_get(DBUS_BUS_SESSION, &error); if (dbus_error_is_set(&error)) { fprintf(stderr, "%s", error.message); abort(); } puts("This is my unique name"); puts(dbus_bus_get_unique_name(connection)); fgets(buffer, sizeof(buffer), stdin); return 0; } From an excellent tutorial: DBUS TUTORIAL USING THE LOW-LEVEL API I have my

Defining Enum custom types for Qt D-Bus introspection

坚强是说给别人听的谎言 提交于 2019-12-04 13:48:51
I am working with QDBUS which has the custom type as Enum. After googling I found below link which explains marshalling of QDBUS custom types. http://techbase.kde.org/Development/Tutorials/D-Bus/CustomTypes#Adventurous_serialization_of_enumerations This doesnot explain the annotation to be specified in the QTDBUS interospection xml to generate proxy using qdbusxml2cpp. How to add Enum annotations in QTDBUS interospection xml? Please if possible explain with some sample code. I found a solution for my problem: First create a new header file called enums.h which looks like: #ifndef ENUMS_H

Is there a way to get the uid of the other end of a unix socket connection

末鹿安然 提交于 2019-12-04 11:56:31
问题 Is there a way for a UNIX domain socket listener to only accept connection from certain user ( chmod / chown does not work for abstract socket afaik), or in another word, get the uid of the incoming connection (on Linux)? Dbus, which uses abstract unix socket on Linux, has a function GetConnectionUnixUser which is used by polkit to determine the caller. So I suppose the dbus-daemon must have a way to do that. Does anyone know how that works? 回答1: The easiest way to check peer credentials is

Print out response of Dbus Method Call in C

偶尔善良 提交于 2019-12-04 11:23:18
The problem I am having is specifically printing out the response of a dbus method call in C using the low level API. I am new to C's libdbus, but have done some work in python-dbus. I know how to write dbus methods and method calls in python as well as the CLI I can find code on the internet to invoke dbus methods, but they don't return or print out the response I have been looking at the libdbus doxygen api, but cannot determine how to pull out the response. The way I have my code set up, a python dbus daemon runs with methods I want to call. Some of them return a string. I want a C program

How to handle properties of a dbus interface with python?

放肆的年华 提交于 2019-12-04 11:09:33
I'm about to work on an implementation of mpris . But currently I am not sure how to read/write dbus interface properties with python-dbus. Is there any examples for this ? Finally got the answer: @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='ss', out_signature='v') def Get(self, interface, prop): ... @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='ssv') def Set(self, interface, prop, value): ... @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='s', out_signature='a{sv}') def GetAll(self, interface): ... 来源: https://stackoverflow.com/questions/4277814/how-to

is DBus what I'm looking for?

大城市里の小女人 提交于 2019-12-04 10:23:40
I need an IPC system on Linux. My requirements are: packet/message oriented ability to handle both point-to-point and one-to-many communication no hierarchy, there's no server and client if one endpoint crashes, the others must be notified good support from existing Linux distros existence of a "bind" for Apache, for the purpose of creating dynamic pages sorted in order of importance (roughly). I don't need extreme performance, nor I will be sending high volume of data. I stumbled upon DBus, and it looks like a good candidate (it pecl::packages::dbus a good mechanism to let Apache access the