maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] MultiMote - A plugin-based remote control application (https://talk.maemo.org/showthread.php?t=92995)

marxian 2014-04-09 14:07

[Announce] MultiMote - A plugin-based remote control application
 
MultiMote is plugin-based remote control application that allows you to control software/hardware using HTTP, bluetooth and infrared (only HTTP is currently implemented, although individual plugins can extend this). Remotes can be defined easily using XML, and additional programming logic can be added using C++ and JavaScript. MultiMote uses QtScript to expose objects/properties to the scripting environment.

I have not yet had time to document the APIs, but there are two existing remotes (MultiMote-DreamBox and MultiMote-VLC) in extras-devel that cover most of the bases. There is also a simple HelloWorld test remote on GitHub that uses a Qt/C++ plugin to extend the programming logic.

The source code for MultiMote is hosted at GitHub: https://github.com/marxoft/multimote.

Source code for MultiMote-Dreambox: https://github.com/marxoft/multimote...motes/dreambox

Source code for MultiMote-VLC: https://github.com/marxoft/multimote...er/remotes/vlc

Source code for MultiMote-HelloWorld: https://github.com/marxoft/multimote...tes/helloworld

Basic procedure to create a remote:
  • Define the remote UI in a file named remote.xml. In addition to defining the UI layout, you can also define the signal handlers, for example the onClicked handler of the button element defines what happens when the button is clicked. The handler can be a function body, or it can be a function provided in JavaScript or a Qt/C++ plugin.
  • Define the remote settings in a file named settings.xml (optional). Providing a settings file will result in an "$REMOTE_NAME settings" entry being added to the application menu when the remote is loaded. This is used to raise a dialog enabling users to change the settings. Remote settings are saved in a separate group in the MultiMote config file (/home/user/.config/MultiMote/MultiMote.conf), and are restored when the remote is loaded. Each setting is exposed to the scripting environment using the key attribute as the property name. You can use the onChanged attribute to handle changes made by the user or when the remote settings are loaded.
  • Provide additional programming logic using C++ and/or JavaScript (optional). You can do pretty much whatever you want here. MultiMote will look for *.js files when the remote is loaded and evaluate them. You can then call the functions defined in JavaScript. MultiMote will also look for Qt plugins and attempt to load them. The plugin will be exposed to the scripting environment using its objectName, thus enabling you to call its methods from either the handlers defined in the XML files, or from JavaScript.
  • Place all files in a subdirectory of /home/user/MultiMote/remotes/. Currently, the directory name is used as the display name for the remote, so if your remote is called "My Remote" you should place the files in /home/user/MultiMote/remotes/My Remote/.

MultiMote exposes a few global properties to all remotes:
  • Qt: The Qt property provides access to the global Qt namespace, so that you can use the Qt enums.
  • screen: The screen property can be used to check the current screen orientation, set the allowed orientations, and check if the screen is locked.
  • notifications: The notifications property can be used to display a Hildon information banner/note.
  • http: The http property can be used to make HTTP requests. You can provide an optional callback that will be used to provide the server response.
  • pageStack: The pageStack property can be used to check/control which page of the remote is currently displayed.

Now for some screenshots:

http://img834.imageshack.us/img834/3127/4o67.th.png http://img542.imageshack.us/img542/7021/etsh.th.png http://img827.imageshack.us/img827/4281/p1od.th.png http://img843.imageshack.us/img843/6610/wzdq.th.png

http://img542.imageshack.us/img542/8198/r2kj.th.png http://img713.imageshack.us/img713/6627/6xc1.th.png http://img594.imageshack.us/img594/1758/6437.th.png http://img560.imageshack.us/img560/6950/dey1.th.png

http://img802.imageshack.us/img802/9845/0ozl.th.png http://img716.imageshack.us/img716/4250/skah.th.png http://img841.imageshack.us/img841/9803/jofh.th.png http://img713.imageshack.us/img713/4899/ahpr.th.png

http://img138.imageshack.us/img138/7559/st7a.th.png http://img849.imageshack.us/img849/5484/gb8j.th.png

Copernicus 2014-04-09 14:28

Re: [Announce] MultiMote - A plugin-based remote control application
 
Very cool! This looks like a perfect way to implement custom remotes. Blows the old QtIrreco concept completely out of the water. :)

Quote:

Originally Posted by marxian (Post 1420543)
MultiMote is plugin-based remote control application that allows you to control software/hardware using HTTP, bluetooth and infrared (only HTTP is currently implemented, although individual plugins can extend this).

Ah, well, any idea on what kind of infrared backend you're considering? I guess, if you're doing custom remotes, the LIRC server would work fine. And yeah, I do still plan on eventually making the Pierogi backend into a separate library as well... ;)

nokiabot 2014-04-09 14:40

Re: [Announce] MultiMote - A plugin-based remote control application
 
good job it looks and sounds good need to check what it is:)

marxian 2014-04-09 14:51

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by Copernicus (Post 1420548)
Very cool! This looks like a perfect way to implement custom remotes. Blows the old QtIrreco concept completely out of the water. :)

Thanks. :) I'm actually not that familiar with QtIrreco, but it was important to me to be able to have more than simple push buttons. Also, it will be possible to use the same remote with QML aswell as widgets (I'll be working on Harmattan and Symbian versions soon-ish), though in some cases it may make sense to tweak the layout a bit.

Quote:

Originally Posted by Copernicus (Post 1420548)
Ah, well, any idea on what kind of infrared backend you're considering? I guess, if you're doing custom remotes, the LIRC server would work fine. And yeah, I do still plan on eventually making the Pierogi backend into a separate library as well... ;)

Less bloat is better, but since it's important that remotes can be created as easily as possible, convenience is also a factor, so enabling the use of existing LIRC config files is attractive. However, if a Pierogi library was available that already provided configs for the remotes that people want to use, that could be a good alternative. I haven't put that much thought into it yet (though I have had a look at the Pierogi code to see how this stuff works :)), as I'll be implementing the bluetooth support first (I want a BT mouse and keyboard remote :)).

marxian 2014-04-09 15:02

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by nokiabot (Post 1420553)
good job it looks and sounds good need to check what it is:)

It's an application that provides backend and user interface implementations for remote controls that you can create using XML. It is possible to create a remote with a single XML file:

Code:

<remote>
    <title>My Remote</title>
    <description>My cool remote</description>
    <orientation>Qt::Horizontal | Qt::Vertical</orientation> // Both orientations supported for auto-rotation.
    <page name="page1">
        <button name="myButton">
            <text>Click me</text>
            <onClicked>notifications.information("This is my cool remote")</onClicked> // Display information banner with message.
        </button>
    </page>
</remote>

Put the above XML in a file named remote.xml, place the file in /home/user/MultiMote/remotes/My Remote/, and the remote will be available in MultiMote. :)

mr_pingu 2014-04-09 15:19

Re: [Announce] MultiMote - A plugin-based remote control application
 
Woaw, looks great.
Maybe you and copernicus could make one killer application together :D

Downloading the VLC one right now (:

Quote:

Originally Posted by marxian
as I'll be implementing the bluetooth support first (I want a BT mouse and keyboard remote ).

And it seems I am served on my wishes:
Quote:

Originally Posted by mr_pingu (Post 1420428)
I need a application that allows me to use it as bluetooth hwkeyboard and the screen as mousepad.
Just like bluemaemo but then a working solution and a lot less buggy...


Copernicus 2014-04-09 16:20

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by marxian (Post 1420558)
it will be possible to use the same remote with QML aswell as widgets (I'll be working on Harmattan and Symbian versions soon-ish), though in some cases it may make sense to tweak the layout a bit.

Cool. BTW, let me ask -- are you just exposing a "clicked()" interface to the buttons, or are "pressed()" and "released()" also available? (I guess I should take a look for myself... :) ) Many CIR remotes have special behaviors when a button is held down (particularly useful for things like volume controls).

Quote:

Less bloat is better, but since it's important that remotes can be created as easily as possible, convenience is also a factor, so enabling the use of existing LIRC config files is attractive. However, if a Pierogi library was available that already provided configs for the remotes that people want to use, that could be a good alternative.
For least bloat, you'd probably do best by avoiding both LIRC and Pierogi. :) The LIRC server has been designed as a one-size-fits-all mechanism, trying to support every possible combination of on and off pulses in every protocol in one single massive code path. Pierogi goes the other way, creating a custom method for each CIR protocol, so the hardware driver is much simpler (and far more efficient). On the other hand, I'm also trying to store every keyset of every device in the entire known universe. :) I guess maybe something like grabbing the Pierogi protocol engine and leaving the keyset data behind might make the most sense for a MultiMote backend...

Quote:

I'll be implementing the bluetooth support first (I want a BT mouse and keyboard remote :)).
Very cool. :) I've been taking a look at the bluetooth stuff myself (particularly as many devices are moving to bluetooth for remote purposes, and I'd like to get that into Pierogi as well), but I haven't gotten very far with it... :)

marxian 2014-04-09 16:37

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by Copernicus (Post 1420581)
Cool. BTW, let me ask -- are you just exposing a "clicked()" interface to the buttons, or are "pressed()" and "released()" also available? (I guess I should take a look for myself... :) ) Many CIR remotes have special behaviors when a button is held down (particularly useful for things like volume controls).

Generally, all signals/slots/properties provided by the widget in question are exposed, so looking at the Qt reference documentation for QPushButton, QSlider etc will give you a good idea of what is available. MultiMote does not restrict handlers to specific signals. Instead, it uses QMetaObject to check if the signal is available when parsing the XML. In most cases my widget implementations merely augment what is already available to provide some additional layout properties.

xes 2014-04-09 19:09

Re: [Announce] MultiMote - A plugin-based remote control application
 
Do you think that this tool could be used to control an LG smart tv?

Example of commands:
https://github.com/ubaransel/lgcommander

http://harizanov.com/2013/12/control...-raspberry-pi/

marxian 2014-04-09 19:43

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by xes (Post 1420602)
Do you think that this tool could be used to control an LG smart tv?

Example of commands:
https://github.com/ubaransel/lgcommander

http://harizanov.com/2013/12/control...-raspberry-pi/

Yes, although the current built in HTTP implementation isn't flexible enough to handle it. I should really change that to allow headers to be provided. Right now it's pretty basic. Of course, if you need custom HTTP requests, you can always do that in a Qt plugin, or maybe just using XMLHttpRequest in JavaScript. :)

marxian 2014-04-10 16:24

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by xes (Post 1420602)
Do you think that this tool could be used to control an LG smart tv?

Example of commands:
https://github.com/ubaransel/lgcommander

http://harizanov.com/2013/12/control...-raspberry-pi/

I've written a test remote for the LG smart TV: https://github.com/marxoft/multimote...otes/lgsmarttv

It requires MultiMote 0.0.2 (in autobuilder queue). The test remote allows you to perform the steps in the Python script (get IP address, display pairing key, get session id, send command to TV). I don't have access to a TV, so I cannot test. If it works, I can provide a proper UI to implement the full command list. :)

xes 2014-04-11 19:45

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by marxian (Post 1420716)
I've written a test remote for the LG smart TV: https://github.com/marxoft/multimote...otes/lgsmarttv

It requires MultiMote 0.0.2 (in autobuilder queue). The test remote allows you to perform the steps in the Python script (get IP address, display pairing key, get session id, send command to TV). I don't have access to a TV, so I cannot test. If it works, I can provide a proper UI to implement the full command list. :)

Hey!! Thank you!
..i have just tried the lg remote but the ip detection returns "Network unreachable".
Do you think it could be possible to have a verbose output?

marxian 2014-04-11 21:40

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by xes (Post 1420989)
Hey!! Thank you!
..i have just tried the lg remote but the ip detection returns "Network unreachable".
Do you think it could be possible to have a verbose output?

I didn't RTFM about discovering UPnP services. :o I need to use a UDP socket to get the IP address. I'm testing now, and I'll report back when I have something working.

xes 2014-04-12 21:39

Re: [Announce] MultiMote - A plugin-based remote control application
 
i have found some interesting example for the Roku player:

https://gist.github.com/onaclov2000/4749011
http://www.remotecentral.com/cgi-bin...hread.cgi?4900

marxian 2014-04-12 22:44

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by xes (Post 1421154)

Yeah, that is the pretty much what I'm doing now, but in C++:

Code:

Socket::Socket(QObject *parent) :
    QObject(parent),
    m_retries(0)
{
    this->setObjectName("socket");
    this->connect(&m_socket, SIGNAL(connected()), this, SLOT(onConnected()));
    this->connect(&m_socket, SIGNAL(disconnected()), this, SLOT(onDisconnected()));
    this->connect(&m_socket, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
    this->connect(&m_socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(onStateChanged(QAbstractSocket::SocketState)));
    this->connect(&m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError)));
}

Socket::~Socket() {}

void Socket::getIPAddress() {
    QByteArray data = "M-SEARCH * HTTP/1.1\r\n" \
            "HOST: 239.255.255.250\r\n" \
            "MAN: ssdp:discover\r\n" \
            "MX: 4\r\n" \
            "ST: urn:schemas-upnp-org:device:MediaRenderer:1\r\n\r\n";

    QHostAddress address("239.255.255.250");

    qDebug() << "Binding: " << m_socket.bind(address, 1900);
    qDebug() << "Bytes sent:" << m_socket.writeDatagram(data, address, 1900);
}

void Socket::onConnected() {
    qDebug() << "Connected";
}

void Socket::onDisconnected() {
    qDebug() << "Disconnected";
}

void Socket::onReadyRead() {
    qDebug() << m_socket.readAll();
}

void Socket::onStateChanged(QAbstractSocket::SocketState state) {
    qDebug() << state;
}

void Socket::onError(QAbstractSocket::SocketError error) {
    qDebug() << error;
    qDebug() << m_socket.errorString();
}

So this should work, once I clean up the code. :)

xes 2014-06-16 21:34

Re: [Announce] MultiMote - A plugin-based remote control application
 
@marxian
Do you have any news about the lg remote plugin?
Have you some new draft of code to test?

marxian 2014-06-16 23:29

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by xes (Post 1429839)
@marxian
Do you have any news about the lg remote plugin?
Have you some new draft of code to test?

I haven't had any time to work on it since I last posted, due to other projects. I'll try to get back to it as soon as I can.

impeham 2014-07-10 20:08

Re: [Announce] MultiMote - A plugin-based remote control application
 
This idea is awesome! almost everything today uses rest api calls.

Thanks.

impeham 2014-07-11 13:41

Re: [Announce] MultiMote - A plugin-based remote control application
 
it would be great if it could also run python scripts! :)

sixwheeledbeast 2014-07-13 22:25

Re: [Announce] MultiMote - A plugin-based remote control application
 
I presume this would be capable of controlling a GoPro using it's URL commands?
If so has anybody made a plugin or remote for this yet?

marxian 2014-07-17 00:20

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by impeham (Post 1432482)
it would be great if it could also run python scripts! :)

It would be possible to run a python script using QProcess. This would currently require you to write a small Qt Plugin which would be loaded by MultiMote at runtime. See https://github.com/marxoft/multimote...tes/helloworld for an example.

In future I may expose QProcess to the scripting environment, so you can run scripts from JS, like this:

Code:

var process = new Process();
process.command = "python xyz";
process.onFinished.connect( function (status) { print(status); } );
process.start();

If you are referring to the possibility of integrating Python code into MultiMote, then there is a library called PythonQt that may facilitate this, but I've never tried it.

marxian 2014-07-17 00:30

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by sixwheeledbeast (Post 1432652)
I presume this would be capable of controlling a GoPro using it's URL commands?
If so has anybody made a plugin or remote for this yet?

Having had a quick look around, I don't see any reason why it wouldn't be possible. For simple cases, a single XML file may be enough to achieve what you want.

I found a list of commands at http://goprojavaapi.blogspot.co.uk/2...-in-gopro.html

marxian 2014-07-17 01:54

Re: [Announce] MultiMote - A plugin-based remote control application
 
I've added a basic test remote for GoPro at https://github.com/marxoft/multimote.../remotes/gopro. :)

Maybe it's a useful starting point for someone with a GoPro. ;)

sixwheeledbeast 2014-07-17 18:12

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by marxian (Post 1433083)
I've added a basic test remote for GoPro at https://github.com/marxoft/multimote.../remotes/gopro. :)

Maybe it's a useful starting point for someone with a GoPro. ;)

Thanks very much.
Maybe I am being stupid or missing something but I am having trouble getting the gopro remote to work.

I downloaded the the source and built the gopro remote on it's own, but it doesn't appear in my remotes list.
I then downloaded the vlc remote from extras with no issues.
What am I missing as the files all seem correct?

marxian 2014-07-17 19:17

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by sixwheeledbeast (Post 1433155)
Thanks very much.
Maybe I am being stupid or missing something but I am having trouble getting the gopro remote to work.

I downloaded the the source and built the gopro remote on it's own, but it doesn't appear in my remotes list.
I then downloaded the vlc remote from extras with no issues.
What am I missing as the files all seem correct?

MultiMote uses QDir::entryList() to get the remote list, by looking for subdirectories in '/home/user/MultiMote/remotes/'. As long as there is a subdirectory named 'GoPro', then it should appear in the remote list.

sixwheeledbeast 2014-07-17 19:41

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by marxian (Post 1433164)
MultiMote uses QDir::entryList() to get the remote list, by looking for subdirectories in '/home/user/MultiMote/remotes/'. As long as there is a subdirectory named 'GoPro', then it should appear in the remote list.

Ah, this directory only had a VLC folder, ended up moving the three files manually to a new GoPro directory and all seems fine.

I assumed building the GoPro plugin would do that it's self.

Anyway thanks very much, I have a universal GoPro remote now :)

marxian 2014-07-17 19:54

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by sixwheeledbeast (Post 1433170)
Ah, this directory only had a VLC folder, ended up moving the three files manually to a new GoPro directory and all seems fine.

I assumed building the GoPro plugin would do that it's self.

Anyway thanks very much, I have a universal GoPro remote now :)

Building the package with dpkg-buildpackage only builds the package, it doesn't install anything. For that you need to use dpkg:

Code:

dpkg -i multimote-gopro_0.0.1_armel.deb
If you are working on the device, then an alternative to building the package is:

Code:

qmake
make install

Or, if there is nothing to compile, you can simply copy the remote files manually.

sixwheeledbeast 2014-07-17 20:38

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by marxian (Post 1433173)
Building the package with dpkg-buildpackage only builds the package, it doesn't install anything. For that you need to use dpkg:

Code:

dpkg -i multimote-gopro_0.0.1_armel.deb

Yep, that's what I did originally. I built it with my scratchbox environment, scp'ed the deb to the device and installed with dpkg.

This is why I was confused it didn't work.

marxian 2014-07-17 21:50

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by sixwheeledbeast (Post 1433185)
Yep, that's what I did originally. I built it with my scratchbox environment, scp'ed the deb to the device and installed with dpkg.

This is why I was confused it didn't work.

That's odd. I just tried it myself, and it worked. It might be worth opening the debian package to see if everything is present and correct (there should be an absolute path to the remote files).

I will stick it in devel, anyway. I might as well, now that I've built it. :)

sixwheeledbeast 2014-07-28 22:29

Re: [Announce] MultiMote - A plugin-based remote control application
 
1 Attachment(s)
Finally got round to testing this on my friends GoPro, unfortunately seems to have an issue. None of the commands work and return the following banner message.
The same commands work fine in a MicroB web browser.
Any Ideas?

marxian 2014-07-28 23:30

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by sixwheeledbeast (Post 1434146)
Finally got round to testing this on my friends GoPro, unfortunately seems to have an issue. None of the commands work and return the following banner message.
The same commands work fine in a MicroB web browser.
Any Ideas?

I can't see anything in the code that might cause a 410: Gone error. That error should only be returned by the server if the resource has been deleted. Maybe there is a problem with the default headers that are being sent by the QtNetwork APIs (the user-agent, for example). A URL encoding problem would be another possible cause, but I don't see that being the case here, and the server should return a 404: Not found error if the URL does not point to valid resource.

sixwheeledbeast 2014-07-29 12:33

Re: [Announce] MultiMote - A plugin-based remote control application
 
Quote:

Originally Posted by marxian (Post 1434152)
I can't see anything in the code that might cause a 410: Gone error. That error should only be returned by the server if the resource has been deleted. Maybe there is a problem with the default headers that are being sent by the QtNetwork APIs (the user-agent, for example). A URL encoding problem would be another possible cause, but I don't see that being the case here, and the server should return a 404: Not found error if the URL does not point to valid resource.

If it helps the error only occurs when the GoPro is powered up and working in App Mode (the mode it should be in). Anything else and Multimote does a 404 like you expect.


All times are GMT. The time now is 11:36.

vBulletin® Version 3.8.8