from Data.Func import $
-derive class iTask MTaskDevice, MTaskResource, MTaskMSGRecv, MTaskMSGSend
+derive class iTask MTaskDevice, MTaskResource, MTaskMSGRecv, MTaskMSGSend, BCShare
derive conses MTaskResource, TTYSettings, BaudRate, Parity, ByteSize, TCPSettings
derive consName MTaskResource, TTYSettings, BaudRate, Parity, ByteSize, TCPSettings
sendToDevice :: String (Main (ByteCode () Stmt)) (MTaskDevice, MTaskInterval) -> Task ()
sendToDevice wta mTask (device, timeout) =
get bcStateStore @ toMessages timeout o toRealByteCode (unMain mTask)
- >>= \(msgs, st1)->set st1 bcStateStore @ toSDSRecords
+ >>= \(msgs, st1)->set st1 bcStateStore @ toSDSRecords
>>= \sdss->set sdss sdsStore//MTaskShareaddToSDSShare
>>| makeShares sdss
>>| sendMessage device msgs
where
sharename i = device.deviceChannels +++ "-" +++ toString i
toSDSRecords st = [{MTaskShare |
- initValue=toInt d1*265 + toInt d2,
+ initValue=toInt (sdsval!!0)*265 + toInt (sdsval!!1),
withTask=wta,
- identifier=i,
- realShare="mTaskSDS-" +++ toString i}
- \\(i,[d1,d2])<-st.sdss]
+ identifier=sdsi,
+ //We skip the only/local shares
+ realShare="mTaskSDS-" +++ toString sdsi}
+ \\{sdsi,sdspub,sdsval}<-st.sdss | sdspub]
makeShares = foldr (\sh t->set sh.initValue (getSDSStore sh) >>| t) (treturn ())
addTask :: MTaskTask MTaskDevice -> MTaskDevice