(I guess I better post something here because it’s been a while.) So over the last two weekends I made a simple oFono client in javascript, meaning that it’s browser-based or “web-based”. To do that I needed a way to talk to D-bus over HTTP. I’ll try to set up a demo instance of the client later but now I’ll just mention the HTTP to D-bus gateway. Even though the whole thing is a hack, maybe the gateway will be useful to someone. It’s also possible that there are already fifteen similar programs there, I’ve not really checked. The idea is rather simple, it’s a 10 kilobyte python script called gateway.py and you can run it in some directory and it will run a primitive web server on a given port using python’s built-in http library, and will serve the files from the current directory and its subdirectories. It also understands a couple of fake requests that enable web applications to talk to D-bus. It connects to the system bus and relays messages to and from D-bus services using the following three types of (GET) requests: / path / to / object / Interface . Method ( parameters ) – This makes a regular D-bus call to a given method on a given interface of an object. It’s synchronous and the HTTP response will contain the D-bus response written as JSON. The D-bus types correspond very neatly to JSON types so the response is easy to use in javascript on the web.
View post:
Javascript to D-bus, can you hear me