-Start :: *World -> *World
-Start world = startEngine (mTaskManager
- >>* [OnAction (Action "Shutdown") (always $ shutDown)]) world
+Start world = startEngine [
+ publish "/manage" $ const $ mTaskManager
+ >>* [OnAction (Action "Shutdown") (always $ shutDown)],
+ publish "/" $ const demo
+ ] world
+
+demo = viewSharedInformation "Devices" [] deviceStoreNP
+ >>* [OnValue $ ifValue pred (cont o hd)]
+ where
+ pred [] = False
+ pred [x:_] = not $ isEmpty x.deviceShares
+
+ cont :: MTaskDevice -> Task ()
+ cont dev
+ # rs = getRealShare dev (hd dev.deviceShares)
+ = get rs >>= \oldvalue->
+ forever (updateSharedInformation "Blinkyblink" [] (getRealShare dev (hd dev.deviceShares))
+ >>* [OnAction ActionContinue (const $ Just $ treturn ())])
+ -|| (wait "bigger than 10" (\x->x == oldvalue) rs
+ >>= viewInformation "Bigger:)" [])
+
+ toInt :: BCValue -> Int
+ toInt (BCValue e) = dynToInt (dynamic e)
+
+ dynToInt :: Dynamic -> Int
+ dynToInt (a :: Int) = a
+ dynToInt x = abort "Not an int"