Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implentation dbus in rivendell #537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DeltaAnto
Copy link

@DeltaAnto DeltaAnto commented Mar 11, 2020

Hello

Sorry for the delay, I had some problems with github. I am beginner with git.

I am a student and during my internship I had to add dbus in rivendell.

This will allow for example to creates a web application that controls rdairplay.

For this I added in the lib folder, an api that allows to easily add the method and value without having to modify much to the existing code.

The only constraint is to add c++11 in the configure.ac and qtdbus.

I had trouble using the documentation system in xml format so send a mini example here:

DbusModule -> is main core for add fonctionnality in dbus. this class need path for get is object in dbus.

//Create a API Module
TestModule *core = this;
DbusModule *module = new DbusModule("/TestModule");

DbusField -> is used for add field private or public in dbus

DbusField *field_post_offset = new DbusField("post_offset");
field_post_offset->setInt(&post_offset);
module->addDBusField(field_post_offset);

DbusModule -> is used for add method in dbus

DbusMethod<void(),void> *method_test = new DbusMethod<void(),void>();
method_test->changePointer([core]() {
    // CODE HERE
});
module->addDBusMethod("test",method_test);

DbusLinkPart -> is for enabled all method and fields in dbus

QObject *obj = new QObject();
DbusLinkPart *part = new DbusLinkPart(obj);
part->setModule(module);
module->link(part);

A small demonstration and test are available directly in the rdairplay/rdairplay.cpp file

To use the api use:

First get the service org.rivendell.dbus_api and get the path "/TestModule" for getting global listener local.qdbuscpp2xml.DbusLink and get the value I use a method getFieldString ("testname"); to get Field QString.

for the method, i have for exemple void(int); i use CallMethod_Int

for the method, i have for exemple int(int); i use CallMethodInt_Int

for the method, i have for exemple QString(int,int); i use CallMethodString_Int_Int

Sorry for spelling mistakes
Best regards, Anthony TURON

	*Implementation dbus in rivendell with a custom api in /lib
	and add code for testing api in rivendell (/rdairplay/rdairplay.cpp).
@ElvishArtisan
Copy link
Owner

Thank you Anthony! This looks really cool, and I'm looking forward to testing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants