import iTasks
import mTask
import Devices.mTaskDevice
+import Shares.mTaskShare
+import Utils.SDS
from Text import class Text(startsWith,concat,split,join), instance Text String
derive class iTask UserLED
-:: MTaskShare = {
- initValue :: Int,
- withTask :: String,
- identifier :: Int,
- realShare :: String
- }
-
Start :: *World -> *World
Start world = startEngine (mTaskManager
>>* [OnAction (Action "Shutdown") (always $ shutDown)]) world
-memoryShare :: String a -> Shared a | iTask a
-memoryShare s d = sdsFocus s $ memoryStore "" $ Just d
-
-deviceStore :: Shared [MTaskDevice]
-deviceStore = sharedStore "mTaskDevices" []
-
-sdsStore :: Shared [MTaskShare]
-sdsStore = memoryShare "mTaskShares" []
-
-bcStateStore :: Shared BCState
-bcStateStore = memoryShare "mTaskBCState" zero
-
-mTaskTaskStore :: Shared [String]
-mTaskTaskStore = memoryShare "mTaskTasks" ["count", "ledon", "ledoff"]
-
mTaskMap :: Map String (Main (ByteCode () Stmt))
mTaskMap = 'DM'.fromList [("count", bc), ("ledon", bc2 LED1), ("ledoff", bc3 LED3)]
bc3 d = {main = ledOff d}
:: MTaskDeviceStatus = {connected :: Bool, name :: String, tasks :: [String]}
-derive class iTask MTaskDeviceStatus, MTaskShare, BCState
+derive class iTask MTaskDeviceStatus, BCState
mTaskManager :: Task ()
mTaskManager = anyTask
// ||- updateInformation "Value" [] v)
- viewDevices :: [MTaskDevice] -> Task ()
- viewDevices ds = anyTask [
- addDevice deviceStore <<@ Title "Add new device" @! ():
- [viewDevice d <<@ Title d.deviceName\\d<-ds]]
- <<@ ArrangeWithTabs @! ()
-
- viewDevice :: MTaskDevice -> Task ()
- viewDevice d = (viewInformation "Device settings" [] d
- ||- viewSharedInformation "Channels" [ViewAs dropEmpty] (channels d) @! ()
- ) <<@ ArrangeHorizontal
- where
- dropEmpty (r,s,ss) = (filter ((=!=)MTEmpty) r,s,ss)
-
-
// addDevice :: (Shared [MTaskDevice]) -> Task SerTCP
// addDevice devices = enterInformation "Device type" []
// >&^ \sh->whileUnchanged sh $ \mty->case mty of