Exporting javascript objects

gateway.py, the script that is part of my little ofono web-based client which I mentioned before, now lets its clients export their own objects as D-bus objects.  While not very practical, a full D-bus service can be written in javascript that way.  I added this capability mainly because ofono will now start using agent interfaces as part of its D-bus interface and other daemons, like connman and bluez, already have agents, so you need to be able to export an object to make a UI.

All other types of http requests remain as listed here.  The new (GET) requests are:

  • /path/to/object/export/<n>/ObjectName[;Interface.MethodOrSignalName,<in_signature>[,<out_signature>][;…]] – This looks complex but it just creates a D-bus object with the given name (arbitrary string, used just internally), and a given list of members on given interfaces. Members list is ;-delimited, each member is a signal or a method depending on whether it has an out signature.  New calls with their parameters are sent to the client in replies to the “idle” request using the same syntax as for signals from remote objects.  In turn signals from exported objects are emitted using the same syntax as method calls on remote objects.
  • /path/to/object/Interface.MethodName/return/[<value>[,…]] – Return a (possibly empty) tuple of values to a pending call sent in an “idle” request earlier.
  • /path/to/object/Interface.MethodName/error/<string> – Return an exception / error constant to a pending call sent in an “idle” request earlier.
Advertisements

One Response to “Exporting javascript objects”

  1. centera beach hotel pattaya Says:

    centera beach hotel pattaya

    Exporting javascript objects | Account of my unadventures

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: