-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Right now, webthing-rust assumes that all properties are observable and that they are plain old data, as in, representable via json.
This is observable in functions in all of the BaseThing, Thing, BaseProperty and Property types. In the Thing trait you have getters and setters that only take the property name (and for the setters, the value), but don't take any further parameters. The BaseProperty::new function asks for an initial value, representable as json, and the Property trait has setters and getters but no parameters either.
The WOT description API has multiple different properties, and most of them are not plain old data, but instead are APIs that require query parameters. If you look at the example json given by the spec, you find the properties retrieveTD, retrieveTDs, searchJSONPath, searchXPath, searchSPARQL. The first needs the ID of the thing description to be retrieved, and the last three perform a search given a given query. Only retrieveTDs is supposed to return a collection of all the things descriptions known to the directory, so this one can be represented as plain old data.
Furthermore, there is the issue of observability. Right now, the WebThingServer accepts all requests to subscribe of changes to properties, which means the properties are observable, as described in the spec here. In addition to the same problem of no way to specify parameters, there is also the limitation that a property can't opt out of observability.