@! ()
where
sharename i = device.deviceChannels +++ "-" +++ toString i
- toSDSRecords st = sequence "" [makeShare wta sdsi sdsval\\{sdsi,sdspub,sdsval}<-st.sdss]// | sdspub]
+ toSDSRecords st = sequence "" [makeShare wta sdsi sdsbc\\{sdsi,sdspub,sdsbc}<-st.sdss]// | sdspub]
addTask :: MTaskTask MTaskDevice -> MTaskDevice
addTask task device = {device & deviceTasks=[task:device.deviceTasks]}
manageShares :: [MTaskShare] -> Task ()
+///makeShare :: String Int Dynamic -> Task MTaskShare
makeShare :: String Int String -> Task MTaskShare
:: BCShare = {
sdsi :: Int,
sdspub :: Bool,
- sdsval :: String
+ sdsval :: Dynamic,
+ sdsbc :: String
}
:: BCState = {
class toByteCode a :: a -> String
class fromByteCode a :: String -> a
-class mTaskType a | toByteCode, fromByteCode a
+class mTaskType a | toByteCode, fromByteCode, TC a
instance toByteCode Int, Bool, Char, Long, String, Button, UserLED
instance fromByteCode Int, Bool, Char, Long, String, Button, UserLED
instance sds ByteCode where
sds f = {main = BC $ freshs
>>= \sds->pure (f (tell` [BCSdsFetch sds]))
- >>= \(v In bdy)->modify (addSDS sds (toByteCode v)) >>| unBC (unMain bdy)}
+ >>= \(v In bdy)->modify (addSDS sds v) >>| unBC (unMain bdy)}
+// >>= \(v In bdy)->modify (addSDS sds (toByteCode v)) >>| unBC (unMain bdy)}
where
- addSDS i v s = {s & sdss=[{sdsi=i,sdspub=False,sdsval=v}:s.sdss]}
+ addSDS i v s = {s & sdss=[{sdsi=i,sdspub=False,sdsval=(dynamic v),sdsbc=toByteCode v}:s.sdss]}
con f = undef
pub (BC x) = BC $ censor (\[BCSdsFetch s]->[BCSdsPublish s])
toMessages :: MTaskInterval (String, BCState) -> ([MTaskMSGSend], BCState)
toMessages interval (bytes, st=:{sdss}) = (
- [MTSds s.sdsi (toByteCode s.sdsval)\\s<-sdss] ++
+ [MTSds s.sdsi s.sdsbc\\s<-sdss] ++
[MTTask interval bytes], st)
toSDSUpdate :: Int Int -> [MTaskMSGSend]