+ sendmTask mTaskId ds =
+ (enterChoice "Choose Device" [ChooseFromDropdown \t->t.deviceName] ds
+ -&&- enterInformation "Timeout, 0 for one-shot" [])
+ >>* [OnAction (Action "Send") (withValue $ Just o sendToDevice mTaskId)]
+
+ sendToDevice :: String (MTaskDevice, Int) -> Task ()
+ sendToDevice mTask (device, timeout) = get bcStateStore
+ @ toMessages timeout o toRealByteCode (unMain $ fromJust ('DM'.get mTask mTaskMap))
+ >>= \(msgs, st1)->set st1 bcStateStore
+ //@ map f
+ >>| upd (\(r,s,ss)->(r,s++msgs,ss)) (channels device)
+ @! ()
+ where
+ f (i,d) = (i, sharedStore ("mTaskSDS-" +++ toString i) (dd d))
+ dd [x,y] = toInt x*265 + toInt y
+
+// = (msgs, map f st.sdss)
+// where
+// upd (\(r,s,ss)->(r,s++[],ss)) (channels device) @! ()
+// # (msgs, st) = toMessages timeout (toRealByteCode (unMain bc))
+// = Just $ viewInformation "" [] device
+// = (msgs, map f st.sdss)
+// where
+// f (i,d) = (i, sharedStore ("mTaskSDS-" +++ toString i) (dd d))
+// dd [x,y] = toInt x*265 + toInt y
+// #
+// = Just $ viewInformation "" [] device