encode (MTSds i v) = "s" +++ to16bit i +++ v +++ "\n"
encode (MTUpd i v) = "u" +++ to16bit i +++ v +++ "\n"
+import StdDebug
decode :: String -> MTaskMSGRecv
decode x
+| not (trace_tn ("decoding: " +++ toString (toJSON x))) = undef
| size x == 0 = MTEmpty
= case x.[0] of
't' = MTTaskAck $ fromByteCode x
toString (MTSDSDelAck i) = "SDS deleted with id: " +++ toString i
toString (MTPub i v) = "Publish id: " +++ toString i
+++ " value " +++ safePrint v
+ toString (MTDevSpec mt) = "Specification: " +++ printToString mt
toString (MTMessage m) = m
toString MTEmpty = "Empty message"
gEq{|BCValue|} (BCValue e) (BCValue f) = toByteCode e == toByteCode f
derive class gCons Long, UserLED, Button, AnalogPin, DigitalPin, PinMode, Pin
-derive class iTask UserLED, Long, Pin, Button, AnalogPin, DigitalPin, PinMode
+derive class iTask UserLED, Long, Pin, Button, AnalogPin, DigitalPin, PinMode, MTaskDeviceSpec
op2 :: (ByteCode a p1) (ByteCode a p2) BC -> ByteCode b Expr
op2 (BC x) (BC y) bc = BC $ x >>| y >>| tell [bc]