IoT Cloud enable GENIVI, Tizen, AGL in 5 minutes via MQTT

While helping one of my customers, I asked Ian Craggs @icraggs to prototype an MQTT+D-Bus bridge to cloud enable GENIVI, Tizen and Automotive Grade Linux.  Ian surprised me with a command line solution that MQTT enables them  in 5 minutes.  I expect we’ll still develop a bridge component for GENIVI but this is a trivially easy solution folks can do now.

You can test it against this MQTT MessageSight instance ip= port=1883 in the cloud and use the MQTT Client web app on to test your GENIVI/Tizen/AGL publishing and subscribing.

Ian’s quick and easy solution as follows:

I have been experimenting with getting information from D-Bus to MQTT and back, and have come up with the following simple methods, using the Paho C MQTT client, available from  source repository

These methods do no transformation or extraction of information at the moment, but it is easy to change them to get the exact information we need.  Any questions, please ask.

D-Bus to MQTT

There is a Linux program called dbus-monitor which will listen for events and print them to stdout.  Using the stdinpub sample of the Paho C client (src/samples directory), raw Linux desktop notification messages can be published to an MQTT server by using a command like this:

dbus-monitor –session interface=org.freedesktop.Notifications | stdinpub Notifications –delimiter -1 –verbose –maxdatalen 1000

You can test this using the command:

notify-send summary body

The raw output looks like this (you can see where the “summary” and “body” fields end up) :

signal sender=:1.78232 -> dest=:1.273 serial=122 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=NotificationClosed
uint32 13
uint32 1
method call sender=:1.81115 -> dest=org.freedesktop.Notifications serial=5 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=GetServerInformation
method call sender=:1.81115 -> dest=org.freedesktop.Notifications serial=6 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
string “notify-send”
uint32 0
string “”
string “summary”
string “body”
array [
array [
dict entry(
string “urgency”
variant             byte 1
dict entry(
string “category”
variant             string “”
int32 -1

We can easily extract just the relevant data from the events we are interested in.

MQTT to D-Bus

Using another program called notify-send and another sample stdoutsub (available from Paho again), we can use MQTT to create desktop events via D-Bus:

stdoutsub notify –delimiter newline | xargs -I %body –delimiter \\n notify-send summary %body

We can use dbus-send instead of notify-send to create events on any D-Bus interface.


Leave a Reply

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

You are commenting using your 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