makeTask name ident = get currentDateTime
@ \dt->{MTaskTask | name=name,ident=ident,dateAdded=dt}
-sendTaskToDevice :: String (Main (ByteCode a Stmt)) (MTaskDevice, MTaskInterval) -> Task ()
+sendTaskToDevice :: String (Main (ByteCode a Stmt)) (MTaskDevice, MTaskInterval) -> Task [MTaskDevice]
sendTaskToDevice wta mTask (device, timeout)
# (msgs, newState) = toMessages timeout mTask device.deviceState
-= toSDSRecords msgs newState device
- >>= \sdss->updateShares device ((++) sdss)
+# shares = [makeShare wta sdsi sdsval\\{sdsi,sdsval}<-newState.sdss, (MTSds sdsi` _)<-msgs | sdsi == sdsi`]
+= updateShares device ((++) shares)
>>| sendMessages msgs device
>>| makeTask wta -1
>>= withDevices device o addTaskUpState newState
- @! ()
where
- sharename i = device.deviceChannels +++ "-" +++ toString i
-
- toSDSRecords :: [MTaskMSGSend] BCState MTaskDevice -> Task [MTaskShare]
- toSDSRecords s st device = treturn
- [makeShare wta sdsi sdsval
- \\{sdsi,sdsval}<-st.sdss, (MTSds sdsi` _)<-s | sdsi == sdsi`]
-
addTaskUpState :: BCState MTaskTask MTaskDevice -> MTaskDevice
- addTaskUpState st task device =
- { MTaskDevice
- | device
- & deviceState=st
- , deviceTasks=[task:device.deviceTasks]}
+ addTaskUpState st task device = { MTaskDevice | device &
+ deviceState=st, deviceTasks=[task:device.deviceTasks]}