update
[mTask.git] / Devices / mTaskDevice.icl
index 537a3b9..5c78b48 100644 (file)
@@ -18,7 +18,7 @@ import iTasks.UI.Definition, iTasks.UI.Editor, iTasks.UI.Editor.Builtin, iTasks.
 
 from Data.Func import $
 
-derive class iTask MTaskDevice, MTaskResource, MTaskDeviceSpec, MTaskMSGRecv, MTaskMSGSend, BCShare
+derive class iTask MTaskDevice, MTaskResource, MTaskMSGRecv, MTaskMSGSend, BCShare
 derive conses MTaskResource, TTYSettings, BaudRate, Parity, ByteSize, TCPSettings
 derive consName MTaskResource, TTYSettings, BaudRate, Parity, ByteSize, TCPSettings
 
@@ -97,21 +97,13 @@ deleteDevice d = upd (\(r,s,ss)->(r,s,True)) (channels d)
 
 sendToDevice :: String (Main (ByteCode () Stmt)) (MTaskDevice, MTaskInterval) -> Task ()
 sendToDevice wta mTask (device, timeout) =
-               traceValue "starting to send"
-       >>| get bcStateStore @ toMessages timeout o toRealByteCode (unMain mTask)
-       >>= \(msgs, st1)->traceValue "messages generated"
-       >>| set st1 bcStateStore
-       >>| traceValue "bcstate store updated"
+               get bcStateStore @ toMessages timeout o toRealByteCode (unMain mTask)
+       >>= \(msgs, st1)->set st1 bcStateStore
        >>| toSDSRecords st1
-       >>= \sdss->traceValue "Shares created"
-       >>| set sdss sdsStore//MTaskShareaddToSDSShare
-       >>| traceValue "Shares store updated"
+       >>= \sdss->set sdss sdsStore//MTaskShareaddToSDSShare
        >>| sendMessages msgs device
-       >>| traceValue "Messages sent"
        >>| makeTask wta -1
-       >>= \t->traceValue "Task made"
-       >>| withDevices device (addTask t)
-       >>| traceValue "Tasks share updated"
+       >>= withDevices device o addTask
        @! ()
        where
                sharename i = device.deviceChannels +++ "-" +++ toString i
@@ -143,4 +135,4 @@ deviceTaskDeleteAcked d i = withDevices d $ deleteTask
        where deleteTask d = {d & deviceTasks=[s\\s<-d.deviceTasks | i <> s.ident]}
 
 deviceAddSpec :: MTaskDevice MTaskDeviceSpec -> Task ()
-deviceAddSpec d s = withDevices d $ \r->{r&deviceSpec=Just s}
+deviceAddSpec d s = withDevices d $ \r->{MTaskDevice | r & deviceSpec=Just s}