You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Emanoil Kotsev a4463053cb updated to latest dbus-1-tqt with some additions to compile 3 hours ago
4d updated to latest dbus-1-tqt with some additions to compile 3 hours ago
4e updated to latest dbus-1-tqt with some additions to compile 3 hours ago
4f Updated to latest dbus-1-tqt with some additions to build 4 hours ago
.gitignore Initial commit 2 months ago
LICENSE Initial commit 2 months ago
README.md fix typo 1 month ago
build_4d.sh Updated to latest dbus-1-tqt with some additions to build 4 hours ago
build_4e.sh Updated to latest dbus-1-tqt with some additions to build 4 hours ago
build_4f.sh Updated to latest dbus-1-tqt with some additions to build 4 hours ago

README.md

dbus-1-tqt-example

PoC to discuss around https://mirror.git.trinitydesktop.org/gitea/TDE/dbus-1-tqt/issues/3 5 7 9 11

All examples are based on the example in dbus-1-tqt for a service providing method “ListSorter”. In examples 4d and 4e below the service is calles “org.example.Service”. In example 4f the service is calles “org.example.Service1” to comply with bluez5 naming conventions.

In example 4d we show how service “org.example.Service” is placed under “/org/example/service”.

In example 4e we show how service “org.example.Service” is placed under object path “/org/example/service”. Another standard DBus service “org.freedesktop.DBus.ObjectManager” is placed unser object path “/”.

In example 4f we show how service “org.example.Service” from example 4d is used asynchronously. The async use of a service has the advantage of non blocking in GUI context.

Overview

Build:
git clone https://mirror.git.trinitydesktop.org/gitea/deloptes/dbus-1-tqt-example
cd dbus-1-tqt-example/4<example>
bash  ../build_4<example>.sh  
Run:
./tqdbusexample
Test for example 4d and 4e:
dbus-send --print-reply --session --dest=org.example.Service / \
   org.freedesktop.DBus.Introspectable.Introspect
dbus-send --print-reply --session --dest=org.example.Service /org \
   org.freedesktop.DBus.Introspectable.Introspect
dbus-send --print-reply --session --dest=org.example.Service /org/example \
   org.freedesktop.DBus.Introspectable.Introspect
dbus-send --print-reply --session --dest=org.example.Service /org/example/service \
   org.freedesktop.DBus.Introspectable.Introspect

dbus-send --print-reply --session --dest=org.example.Service \
  /org/example/service  \
  org.example.Service.ListSorter array:string:"x","a","c","b"

Test for example 4f:
dbus-send --print-reply --session --dest=org.example.Service1 / \
   org.freedesktop.DBus.Introspectable.Introspect
dbus-send --print-reply --session --dest=org.example.Service1 /org \
   org.freedesktop.DBus.Introspectable.Introspect
dbus-send --print-reply --session --dest=org.example.Service1 /org/example \
   org.freedesktop.DBus.Introspectable.Introspect
dbus-send --print-reply --session --dest=org.example.Service1 /org/example/service \
   org.freedesktop.DBus.Introspectable.Introspect

dbus-send --print-reply --session --dest=org.example.Service1 \
  /org/example/service  \
  org.example.Service1.ListSorter array:string:"x","a","c","b"

Detailed overview

Generate code example 4d

There is only one definitions “test1.xml”. Just run dbusxml2qt3 test1.xml and implement.

Content of the directory

$ ls -1
dbusbasenode.cpp
dbusbasenode.h
introspectableinterface.cpp
introspectableinterface.h
serviceinterface.cpp
serviceinterface.h
servicenode.cpp
servicenode.h
serviceproxy.cpp
serviceproxy.h
test1.xml
create main.cpp and the service implementation “testservice”

Content of the directory

$ ls -1
dbusbasenode.cpp
dbusbasenode.h
introspectableinterface.cpp
introspectableinterface.h
main.cpp
serviceinterface.cpp
serviceinterface.h
servicenode.cpp
servicenode.h
serviceproxy.cpp
serviceproxy.h
test1.xml
testservice.cpp
testservice.h
build
$ bash ../build_4d.sh
run
$ ./tqdbusexample
Requesting name 'org.example.Service' successfull
test

See test section in Overview

Generate code example 4e
generate root node
$ dbusxml2qt3 -n rootnode -c RootNode test1.xml
ClassGenerator: processing interface 'org.freedesktop.DBus.Introspectable'
ClassGenerator: processing interface 'org.freedesktop.DBus.ObjectManager'

Files generated

rootnode.cpp
rootnode.h
generate root level services
$ dbusxml2qt3 test1.xml
ClassGenerator: processing interface 'org.freedesktop.DBus.Introspectable'
ClassGenerator: processing interface 'org.freedesktop.DBus.ObjectManager'
dbusxml2qt3: cannot generate node without class name.

Files generated

objectmanagerinterface.cpp
objectmanagerinterface.h
objectmanagerproxy.cpp
objectmanagerproxy.h
rootnode.cpp
rootnode.h
generate org.example.Service level services
$ dbusxml2qt3 test2.xml
ClassGenerator: processing interface 'org.example.Service'
Generating org.freedesktop.DBus.Introspectable on demand

Files generated

introspectableinterface.cpp
introspectableinterface.h
objectmanagerinterface.cpp
objectmanagerinterface.h
objectmanagerproxy.cpp
objectmanagerproxy.h
rootnode.cpp
rootnode.h
serviceinterface.cpp
serviceinterface.h
servicenode.cpp
servicenode.h
serviceproxy.cpp
serviceproxy.h
create main.cpp and the service implementation “testservice”

Content of the directory

$ ls -1
dbusbasenode.cpp
dbusbasenode.h
introspectableinterface.cpp
introspectableinterface.h
main.cpp
objectmanagerinterface.cpp
objectmanagerinterface.h
objectmanagerproxy.cpp
objectmanagerproxy.h
rootnode.cpp
rootnode.h
serviceinterface.cpp
serviceinterface.h
servicenode.cpp
servicenode.h
serviceproxy.cpp
serviceproxy.h
test1.xml
test2.xml
testservice.cpp
testservice.h

build
$ bash ../build_4e.sh
run
$ ./tqdbusexample
Requesting name 'org.example.Service' successfull
test

See test section in Overview

Generate code example 4f

There is only one definitions “test1.xml”. Just run dbusxml2qt3 test1.xml and implement.

Content of the directory

$ ls -1
dbusbasenode.cpp
dbusbasenode.h
introspectableinterface.cpp
introspectableinterface.h
serviceinterface.cpp
serviceinterface.h
servicenode.cpp
servicenode.h
serviceproxy.cpp
serviceproxy.h
test1.xml
create main.cpp and the service implementation “testservice”

Content of the directory

$ ls -1
dbusbasenode.cpp
dbusbasenode.h
introspectableinterface.cpp
introspectableinterface.h
main.cpp
serviceinterface.cpp
serviceinterface.h
servicenode.cpp
servicenode.h
serviceproxy.cpp
serviceproxy.h
test1.xml
testservice.cpp
testservice.h
build
$ bash ../build_4f.sh
run
$ ./tqdbusexample
Requesting name 'org.example.Service1' successfull
test

See test section in Overview