Kodi Community Forum

Full Version: eventserver and javascript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,
I use a Philips Pronto TSU9600 remote control that is programmed in JavaScript.
Is there an eventclient using javascript?
Is there any tutorial of eventserver and javascript?

thanks
As far as I'm aware Javascript has no sockets API so you can't write an eventclient in Javascript.

Presumably it works with XBMC using IR?

JR
jhsrennie Wrote:As far as I'm aware Javascript has no sockets API so you can't write an eventclient in Javascript.

Presumably it works with XBMC using IR?

JR

Hi jhsrennie,
the javascript that comes with the Pronto Pro can create TCPsockets and UDP sockets.

For HTTP API I use the following code:

Code:
var socket = new TCPSocket(false);
socket.connect('192.168.1.100', 8080, 3000);
socket.onConnect = function() {
  write("GET /xbmcCmds/xbmcHttp?command=SendKey(F045) HTTP/1.0\r\n\r\n");
}

I can use the following for EventServer. But how do I create the HELO packet?

Code:
var s = new UDPSocket();
s.send("e", "192.168.1.100", 4000);

thanks
Ah, OK. In that case grab SimpleEventClient.zip from http://swarchive.ratsauce.co.uk/XBMC/default.asp

This is a simple eventserver client that i wrote to learn how it all worked. It's in C++ but it should be pretty obvious from the code how the eventserver stuff works and it's heavily commented.

Later: I just had a thought. You can use the HTTP API to send keystrokes to XBMC and this is a lot simpler than writing an eventserver client. I'm not sure where this is documented, but to send the key code XX use:

http://myhtpc/xbmcCmds/xbmcHttp?command=SendKey(0xF0xx)

Some of the key codes are obvious, e.g. 1B is "escape" but many are not, e.g. "0" is 60 not 30. To get the key code turn on debug logging, press the key, then look in XBMC.log for the DEBUG: OnKey: entry.

JR
jhsrennie Wrote:Ah, OK. In that case grab SimpleEventClient.zip from http://swarchive.ratsauce.co.uk/XBMC/default.asp

This is a simple eventserver client that i wrote to learn how it all worked. It's in C++ but it should be pretty obvious from the code how the eventserver stuff works and it's heavily commented.

Hi jhsrennie,
thanks a lot for sharing this.
I will have a look, and return to you.

Quote:Later: I just had a thought. You can use the HTTP API to send keystrokes to XBMC and this is a lot simpler than writing an eventserver client. I'm not sure where this is documented, but to send the key code XX use:

http://myhtpc/xbmcCmds/xbmcHttp?command=SendKey(0xF0xx)
JR

I am using HTTP API quite decently right now (it's very simple to implement), but I understand that this method is deprecated and will be removed soon, so I need to move to the new method. If it wasn't for this, I would remain to HTTP API! Nod

thanks anyway for the tip.
elite1967 Wrote:Hi jhsrennie,
thanks a lot for sharing this.
I will have a look, and return to you.



I am using HTTP API quite decently right now (it's very simple to implement), but I understand that this method is deprecated and will be removed soon, so I need to move to the new method. If it wasn't for this, I would remain to HTTP API! Nod

thanks anyway for the tip.

Just to soothe you Smile, I doubt we will remove HTTPApi until it can handle inputs, to many clients that rely on it (which is in the same spot as you, or worse).
topfs2 Wrote:Just to soothe you Smile, I doubt we will remove HTTPApi until it can handle inputs, to many clients that rely on it (which is in the same spot as you, or worse).

Thanks for sharing this with us.
I am really more comfortable now. Nod