\begin{document}
\input{subfileprefix}
-%\chapter{\texorpdfstring{\Glsxtrshort{TOP} for the \glsxtrshort{IOT}}{TOP for the IoT}}%
-\subfile{4iot}
-
-%\chapter{The \texorpdfstring{\gls{MTASK}}{mTask} \texorpdfstring{\glsxtrshort{DSL}}{DSL}}%
-\subfile{lang}
-
\chapter{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}%
\label{chp:integration_with_itask}
\begin{chapterabstract}
Every communication method that implements the \cleaninline{channelSync} class can provide the communication with an \gls{MTASK} device.
As of now, serial port communication, direct \gls{TCP} communication and \gls{MQTT} over \gls{TCP} are supported as communication providers.
The \cleaninline{withDevice} function transforms a communication provider and a task that does something with this device to an \gls{ITASK} task.
-This task sets up the communication, exchanges specifications, handles errors and cleans up after closing.
+Internally, the task sets up the communication, exchanges specifications, executes the inner task while handling errors, and finally cleans up after closing.
\Cref{lst:mtask_device} shows the types and interface to connecting devices.
\begin{lstClean}[label={lst:mtask_device},caption={Device communication interface in \gls{MTASK}.}]
class channelSync a :: a (Shared sds Channels) -> Task () | RWShared sds
-withDevice :: (a (MTDevice -> Task b) -> Task b) | iTask b & channelSync, iTask a
+withDevice :: a (MTDevice -> Task b) -> Task b | iTask b & channelSync, iTask a
\end{lstClean}
\section{Lifting tasks}\label{sec:liftmtask}
-Once the connection with the device is established, \ldots
-\begin{lstClean}
-liftmTask :: (Main (BCInterpret (TaskValue u))) MTDevice -> Task u | iTask u
+Once the connection with the device is established, \gls{MTASK} tasks can be lifted to \gls{MTASK} tasks using the \cleaninline{liftmTask} family of functions (see \cref{lst:liftmtask}).
+Given an \gls{MTASK} task in the \cleaninline{BCInterpret} view and a device obtained from \cleaninline{withDevice}, an \gls{ITASK} task is returned.
+This \gls{ITASK} task tethers the \gls{MTASK} task that is executed on the microcontroller.
+Hence, when for example observing the task value, the actual task value from the microcontroller is observed.
+
+\begin{lstClean}[label={lst:liftmtask},caption={The interface for lifting \gls{MTASK} tasks to \gls{ITASK} tasks.}]
+liftmTask :: (Main (MTask BCInterpret u)) MTDevice -> Task u | iTask u
\end{lstClean}
+Under the hood, \cleaninline{liftmTask} compiler the \gls{MTASK} task to byte code, gathers the initial values for the lifted \glspl{SDS} and sends the data to the device.
+Once acknowledged, the \gls{MTASK} task value and the \glspl{SDS} are monitored.
+If the \gls{ITASK} server updates the value of a lifted \gls{SDS}, the appropriate message is sent to the \gls{MTASK} to notify it of the change.
+Furthermore, the \gls{MTASK} device may update the \gls{SDS}, and in that case the message is picked up by the \cleaninline{liftmTask} task and the \gls{SDS} on the \gls{ITASK} server updated accordingly.
+
\section{Lifting \texorpdfstring{\glsxtrlongpl{SDS}}{shared data sources}}\label{sec:liftsds}
\begin{lstClean}[label={lst:mtask_itasksds},caption={Lifted \gls{ITASK} \glspl{SDS} in \gls{MTASK}.}]
class liftsds v where
-> Main (MTask v u) | RWShared sds
\end{lstClean}
-\chapter{Implementation}%
-\label{chp:implementation}
-\begin{chapterabstract}
- This chapter shows the implementation of the \gls{MTASK} system.
- It is threefold: first it shows the implementation of the byte code compiler for \gls{MTASK}'s \gls{TOP} language, then is details of the implementation of \gls{MTASK}'s \gls{TOP} engine that executes the \gls{MTASK} tasks on the microcontroller, and finally it shows how the integration of \gls{MTASK} tasks and \glspl{SDS} is implemented both on the server and on the device.
-\end{chapterabstract}
-IFL19 paper, bytecode instructieset~\cref{chp:bytecode_instruction_set}
-
-\section{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}
-IFL18 paper stukken
+\section{Conclusion}
-% Green computing
-\subfile{green}
\input{subfilepostamble}
\end{document}