manuscript
[phd-thesis.git] / appx / mtask_aux.tex
index 54812ff..3edf747 100644 (file)
@@ -2,17 +2,16 @@
 
 \input{subfilepreamble}
 
-
 \begin{document}
 \input{subfileprefix}
 \ifSubfilesClassLoaded{\appendix\setcounter{chapter}{1}}{}
-\chapter{Auxiliary \texorpdfstring{\glsentrytext{MTASK}}{mTask} type classes}%
+\chapter{Auxiliary mTask type classes}%
 \label{chp:mtask_aux}
 \lstset{basicstyle=\tt\footnotesize}
 \section{Peripherals}\label{sec:aux_peripherals}
 This section shows the peripherals not mentioned in \cref{chp:top4iot}.
 All constructors use \gls{HOAS} to create a type safe sensor object from a connection specification that can be used to interact with the sensor.
-The measurement tasks all yield unstable values contaning the measured value.
+The measurement tasks all yield unstable values containing the measured value.
 The auxiliary functions such as calibration yield stable values indicating the result.
 Tasks suffixed with the backtick (\cleaninline{'}) indicate variants for which the timing interval can be specified (see \cref{chp:green_computing_mtask}).
 
@@ -36,7 +35,7 @@ class AirQualitySensor v where
 
 \subsection{Gesture sensor}
 The \gls{MTASK} language supports one type (\emph{PAJ7620} connected via \gls{I2C}) of gesture sensors.
-The \emph{PAJ7620} contains an optical CMOS array that measures the reflection of the on-board \gls{IR} \gls{LED} to detect up to several different gestures.
+The \emph{PAJ7620} contains an optical CMOS array that measures the reflection of the on-board \gls{IR} \gls{LED} to detect up to several gestures.
 The complete interface containing the constructor and the measurement task is shown in \cref{lst:mtask_gesture}.
 
 \begin{lstClean}[label={lst:mtask_gesture},caption={Gesture sensor interface in \gls{MTASK}.}]
@@ -65,8 +64,8 @@ class LightSensor v where
 
 \subsection{Motion detection sensor}
 The \gls{MTASK} language supports motion sensing using a \gls{PIR} sensor through a type class that only contains macros.
-\gls{PIR} sensors detect motion by the \gls{IR} reflection through a number of fresnel lenses and communicates through a digital \gls{GPIO} pin.
-Therefore, a \gls{PIR} is nothing more than a \cleaninline{DPIN} according to \gls{MTASK} but for uniformity, a type class is available (see \cref{lst:mtask_pir}).
+\gls{PIR} sensors detect motion by the \gls{IR} reflection through a number of Fresnel lenses and communicates through a digital \gls{GPIO} pin.
+Therefore, a \gls{PIR} is nothing more than a \cleaninline{DPin} according to \gls{MTASK} but for uniformity, a type class is available (see \cref{lst:mtask_pir}).
 
 \begin{lstClean}[label={lst:mtask_pir},caption={\Gls{PIR} sensor interface in \gls{MTASK}.}]
 :: PIR :== DPin
@@ -86,8 +85,7 @@ Therefore, a sound detector is nothing more than a tuple of a \cleaninline{DPin}
 \begin{lstClean}[label={lst:mtask_sound},caption={Sound detection sensor interface in \gls{MTASK}.}]
 :: SoundDetector :== (DPin, APin)
 
-class SoundDetector v | tupl, expr, pinMode v & dio DPin v
-where
+class SoundDetector v | tupl, expr, pinMode v & dio DPin v where
        soundDetector :: DPin APin ((v SoundDetector) -> Main (v b)) -> Main (v b)
 
        soundPresence` :: (TimingInterval v) (v SoundDetector) -> MTask v Bool
@@ -97,8 +95,8 @@ where
        soundLevel :: (v SoundDetector) -> MTask v Bool | tupl, aio v
 \end{lstClean}
 
-\subsection{\texorpdfstring{\gls{I2C}}{I\textsuperscript{2}C} buttons}
-The \gls{MTASK} language supports one type of \gls{I2C} buttons (the \gls{I2C} buttons from the \gls{WEMOS} d1 mini \gls{OLED} shield).
+\subsection{\IIC{} buttons}
+The \gls{MTASK} language supports one type of \gls{I2C} buttons (the \gls{I2C} buttons from the \gls{WEMOS} D1 mini \gls{OLED} shield).
 The buttons from this shield provide more information than just the status (see \cleaninline{ButtonStatus}).
 The complete interface containing the constructor and the measurement tasks is shown in \cref{lst:mtask_i2cbutton}.
 
@@ -116,8 +114,8 @@ class i2cbutton v where
        BButton :: (v I2CButton) -> MTask v ButtonStatus
 \end{lstClean}
 
-\subsection{\texorpdfstring{\gls{LED}}{LED} matrix}
-The \gls{MTASK} language supports one type of \gls{LED} matrix (the $8\times8$ \gls{LED} matrix shield for the \gls{WEMOS} d1 mini).
+\subsection{LED matrix}
+The \gls{MTASK} language supports one type of \gls{LED} matrix (the $8\times8$ \gls{LED} matrix shield for the \gls{WEMOS} D1 mini).
 Instead of containing a \gls{TOP}-like interface, the \gls{ARDUINO} interface is directly translated to \gls{MTASK}.
 As a result, every task immediately returns a stable value indicating the result.
 The complete interface containing the constructor and the interaction tasks is shown in \cref{lst:mtask_ledmatrix}.
@@ -135,31 +133,34 @@ class LEDMatrix v where
 \end{lstClean}
 
 \subsection{Connection types}\label{lst:connection_types}
-\begin{lstClean}[caption={}]
+The connection between the \gls{ITASK} server and the \gls{MTASK} devices are communication method agnostic.
+As long as the \cleaninline{channelSync} type class is implemented, the communication method can be used.
+\Cref{lst:conn_types} shows the data types for the connections.
+
+\begin{lstClean}[label={lst:conn_types},caption={Data types for the different connections in \gls{MTASK}.}]
 :: TCPSettings =
        { host        :: String
        , port        :: Int
        , pingTimeout :: ?Int
        }
-:: MQTTSettings = 
+:: MQTTSettings =
        { host     :: String
        , port     :: Int
        , mcuId    :: String
        , serverId :: String
        , auth     :: MQTTAuth
        }
-:: TTYSettings = {
-               devicePath :: String,
-               baudrate   :: BaudRate,
-               bytesize   :: ByteSize,
-               parity     :: Parity,
-               stop2bits  :: Bool,
-               xonxoff    :: Bool,
-               sleepTime  :: Int
+:: TTYSettings =
+       { devicePath :: String
+       , baudrate   :: BaudRate
+       , bytesize   :: ByteSize
+       , parity     :: Parity
+       , stop2bits  :: Bool
+       , xonxoff    :: Bool
+       , sleepTime  :: Int
        }
 \end{lstClean}
 
-
 \lstset{basicstyle=\tt}
 \input{subfilepostamble}
 \end{document}