W3C home > Mailing lists > Public > public-wot-ig@w3.org > December 2015

Re: WebIDL for Thing API

From: Bassbouss, Louay <louay.bassbouss@fokus.fraunhofer.de>
Date: Wed, 16 Dec 2015 10:32:24 +0000
To: "Peintner, Daniel (ext)" <daniel.peintner.ext@siemens.com>
CC: "public-wot-ig@w3.org" <public-wot-ig@w3.org>
Message-ID: <1BA499A6-EF39-4C54-9DF5-69AB236FE89C@fokus.fraunhofer.de>
Hi Daniel,

Thank you for the feedback. The current Thing Description offers explicit definition of events. We can only allow these events this in the addListener function. This is what the current WebIDL supports. if you have a property like “temperature” that fires events when it is changed, you need to define a custom event like “ temperatureChanged”. For actions I am not sure if you need custom events. Actions change that state of the thing and this will lead to fire events for the properties changed after the action is called. The only disadvantage I see in the current thing description is that you need an explicit definition of events for properties that fire events. To make this more easier for developers, we can define a new boolean attribute “observable” for properties. In this case we have two options:
1- We define two function as you proposed e.g. addEventListener and addPropertyChangeListener
2- We can have a single function addListener and we need to make sure that properties and events cannot have the same name in the thing description. 
I prefer option 2 since it keep the API more simple. for each add Listener function we need a remove and removeAll listener. 

Thx
Louay

> On 15 Dec 2015, at 15:56, Peintner, Daniel (ext) <daniel.peintner.ext@siemens.com> wrote:
> 
> Hi Louay, all,
> 
> Thank you very much for the initial WebIDL draft. It looks very promising!
> 
> Looking at the draft I was wondering how we can model aspects such as "a property value has been changed" or "an action has been called". A thing might be interested in such events and we should allow to get a notification to update the UI or to react elsewise.
> 
> The thing description tutorial [1] does not really mention this aspect in details. That said, it offers the attribute "Stability" that I think is meant to cover this idea w.r.t. property...
> 
> Hence, I was wondering whether we could have something like the following in the Interface Thing
> 
> addPropertyChangedListener(DOMString propertyName, ThingEventListener listener)
> addActionCalledListener(DOMString actionName, ThingEventListener listener)
> 
> Or, do you have any other proposal/idea how we could achieve that in a better manner?
> 
> Thanks,
> 
> -- Daniel
> 
> [1] https://github.com/w3c/wot/blob/master/TF-TD/Tutorial.md

> 
> 
> 
> ________________________________
> Von: Bassbouss, Louay [louay.bassbouss@fokus.fraunhofer.de]
> Gesendet: Montag, 14. Dezember 2015 13:27
> An: public-wot-ig@w3.org
> Betreff: WebIDL for Thing API
> 
> Dear group members,
> 
> I just submitted the initial WebIDL draft of the Thing API [1] I demonstrated @TPAC in sapporo. It considers also feedback I received from some of you. It is just a draft to start with. Can we put an Agenda item to discuss it in the next phone call.
> 
> Regards,
> Louay
> 
> [1]: https://github.com/w3c/wot/blob/master/TF-AP/thing-api/thing-api-webidl.md


Received on Wednesday, 16 December 2015 10:33:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 16 December 2015 10:33:21 UTC