lab11 / summon

Browser for the Local Web of Things
18 stars 7 forks source link

Idea: Use parse.js to automatically create Summon UIs #26

Open bradjc opened 7 years ago

bradjc commented 7 years ago

To use our generic gateway, devices create a parse.js file which translates BLE advertisements to JSON blobs. An idea I had is to use the parse.js file in Summon to create the JSON blob, then that could be passed to an application (removing the need to write the parsing code twice in some cases) which would then display it. That idea could be extended, however, to just display the JSON blob itself if the device does not have an application. The keys are intended to be humanly readable with units, so theoretically a UI could be autogenerated by parsing the JSON keys.

This could also be potentially further expanded to allow a device creator to define a simple file that would essentially be a list of macro substantiations. Something like:

 [
     {"display_type": "integer",
      "parsejs_key": "sensor_reading_1"},
    {"display_type": "time_series_graph",
     "parsejs_key": "temperature",
     "units": "celsius"}
 ]

Then Summon would generate a UI based on that.

I have been successful in getting parse.js to work in cordova: https://github.com/lab11/gateway/blob/master/smartphone/cordova/www/js/index.js

Thoughts?