add task deletion and acknowledgements
[mTask.git] / Devices / mTaskTCP.icl
index bf05e05..e0b85e2 100644 (file)
@@ -1,9 +1,12 @@
 implementation module Devices.mTaskTCP
 
+import GenPrint
+import StdDebug
 import Devices.mTaskDevice
 import iTasks
 
 derive class iTask TCPSettings
+derive gPrint MTaskMSGRecv
 
 getmTaskTCPDevice :: Task MTaskResource
 getmTaskTCPDevice = TCPDevice <$> enterInformation "Settings" []
@@ -21,8 +24,9 @@ instance MTaskDuplex TCPSettings where
                        onConnect _ (msgs,send,sendStopped) = (Ok "", Just (msgs,[],sendStopped), map encode send, False)
 
                        whileConnected :: (Maybe String) String ([MTaskMSGRecv], [MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool), [String], Bool)
-                       whileConnected Nothing acc (msgs,send,sendStopped) = (Ok acc, Nothing, [], False)
-                       whileConnected (Just newData) acc (msgs,send,sendStopped) = (Ok acc, Just (msgs ++ [decode newData],[],False), map encode send, False)
+                       whileConnected mnewData acc (msgs,send,sendStopped)
+                       | not (trace_tn (printToString (map decode (maybeToList mnewData)))) = undef
+                       = (Ok acc, Just (msgs ++ map decode (maybeToList mnewData),[],sendStopped), map encode send, False)
                        
                        onDisconnect :: String ([MTaskMSGRecv],[MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool))
                        onDisconnect l (msgs,send,sendStopped) = (Ok l, Nothing)