W3C home > Mailing lists > Public > public-wot-ig@w3.org > January 2016

2. WoT Thing needs to have istate/ostate Bands

From: David Janes <davidjanes@davidjanes.com>
Date: Wed, 27 Jan 2016 04:33:01 -0500
Message-ID: <CACp1KyNGYAwx2dg2-m9ga+oF231iDE4YjB5+v_F1Mg9dLgre_g@mail.gmail.com>
To: "t2trg@irtf.org" <t2TRG@irtf.org>, public-wot-ig@w3.org
Formatted Version:

2. WoT Thing needs to have istate/ostate Bands


   - WeMo Model
   - Interstitial State
   - What do the properties return?


Consider the WeMo Switch, a popular "stater" IoT device. Turning a light
off to on looks like this.


   1. the switch is *off*
   2. the user sends *turn on* command / the WeMo receives it
   3. about 300ms (guestimate) passes
   4. the switch is *on*

It's step (3) we're considering.

So let's look at this as a WoT property manipulation. Note that I'm just
pseudocoding this, I don't know if there's a property called exactly "on"
but I'm sure there's something like it.

thing.getProperty("on")         ## (stage 1) a promise that yields false
thing.setProperty("on", true)   ## (stage 2)
thing.getProperty("on")     ## (stage 3) WHAAA?
thing.getProperty("on")     ## (stage 4)


It's Stage 3 that's the concern. We don't have a clean way of knowing that
we're turning on the light, but the light is currently off.

This is called the "Interstitial State" and it's important that this is
indicated in the UI.

Now, the immediate objection might be "Well, thing.setProperty('on', true)"
returns a Promise that will tell when the the light turns on. But *this is
not sufficient* because *thing.getProperty("on")* might be called *somewhere
else in the code* or *by someone else entirely in a different process*

Break up the properties into two states:

   - the *istate*, the "input state", the actual state of the thing
   - the *ostate*, the "output state", the state we're trying to transition

These are independent

Now our code looks like this

thing.istate.getProperty("on")      ## (stage 1) a promise that yields false
thing.istate.setProperty("on", true)    ## (stage 2)
thing.istate.getProperty("on")      ## (stage 3) FALSE
thing.ostate.getProperty("on")      ## (stage 3) TRUE
thing.istate.getProperty("on")      ## (stage 4)

Or even more simply if we make the assumption that the istate and ostate
are basically views of the properties

thing.istate.get("on")      ## (stage 1) a promise that yields false
thing.istate.set("on", true)    ## (stage 2)
thing.istate.get("on")      ## (stage 3) FALSE
thing.ostate.get("on")      ## (stage 3) TRUE
thing.istate.get("on")      ## (stage 4)
thing.ostate.get("on")      ## (stage 4) NULL - "nothing happening"
Received on Wednesday, 27 January 2016 09:33:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:26:54 UTC