\subsection{IoT}
\begin{frame}
- \frametitle{What is Internet of Things (IoT)}
+ \frametitle{What is the Internet of Things (IoT)}
\begin{block}{History}
\begin{itemize} \item 1999: \pause{} RFID
\item Device to device communication
\pause{}
- \item ESP8266
+ \item Now: \pause{} IoT is everywhere
\item Estimated 30 billion in 2020
\end{itemize}
\end{block}
\pause{}
\begin{block}{Tasks performed by IoT}
- \begin{itemize}
+ \begin{itemize}[<+->]
\item Monitoring (Temperature, Electricity, Humidity, Heartbeat)
\item Acting (Servo's, Motors)
\item Tracking (GPS, WiFi tracking)
- \item Communication (SMS, Whatsapp)
- \pause{}
\item Combinations: e.g. Thermostat, Smart Clothing, Smart Watches
\end{itemize}
\end{block}
\item Tasks are basic blocks
\item Generated web interface
\item Type driven
- \item EDSL
+ \item EDSL in Clean
\end{itemize}
\end{block}
\pause{}
\begin{block}{Overlap}
\begin{itemize}[<+->]
\item Tasks often involve humans
- \item Tasks can be performed by IoT
- \end{itemize}
- \end{block}
- \pause{}
- \begin{block}{But how to integrate}
- \begin{itemize}[<+->]
- \item Distributed iTasks
- \item SDS
- \item Swat two flies at once
+ \item Tasks can often be performed by IoT
\end{itemize}
\end{block}
\end{frame}
\begin{frame}
- \frametitle{Solution}
- \begin{itemize}[<+->]
- \item Add IoT to iTasks
- \item Solve the integration problem
- \item Extend the reach of iTasks
- \item iTasks server
- \item IoT device client
- \item EDSL to make IoT tasks
- \item Internalship
- \end{itemize}
-\end{frame}
+ \frametitle{Problem statement}
+ \begin{block}{What is the problem?}
+ \begin{itemize}
+ \item iTasks works
+ \item IoT works
+ \item But...\pause{} integration does not
+ \end{itemize}
+ \end{block}
-\begin{frame}
- \frametitle{Problems overcome}
- \begin{itemize}[<+->]
- \item Way to express IoT Tasks
- \item Write client software
- \item Write server software
- \item Connect them up
- \item But first some theory
- \item Reprogramming, write cycles
- \end{itemize}
+ \pause{}
+
+ \begin{block}{Why is this interesting?}
+ \begin{itemize}[<+->]
+ \item Make IoT integration easier
+ \item Extend the reach of iTasks
+ \item Fully integrated systems
+ \end{itemize}
+ \end{block}
\end{frame}
\subsection{iTasks}
\begin{frame}[fragile]
- \frametitle{Task Oriented Programming}
- \framesubtitle{\ldots and iTasks}
- \begin{block}{iTasks}
+ \frametitle{First some theory}
+ \framesubtitle{\ldots iTasks}
+ \begin{block}{Tasks}
\begin{itemize}[<+->]
- \item Basic blocks
- \item Generated web interface
- \item Type driven
+ \item Observables
+ \item Given the state, a \CI{TaskValue} is observed.
+ \item Continuous execution
+ \item Generics
\end{itemize}
\end{block}
\pause{}
- \begin{columns}[c]
- \column{.49\linewidth}
- \begin{block}{Tasks}
- \begin{itemize}[<+->]
- \item Observables
- \item Given the state, a \CI{TaskValue} is observed.
- \item Continuous execution
- \item Generics
- \end{itemize}
- \end{block}
- \pause{}
- \column{.49\linewidth}
- \begin{figure}[ht]
- \centering
- \includegraphics[width=\linewidth]{fig-taskvalue}
- \caption{The states of a \CI{TaskValue}}
- \end{figure}
- \end{columns}
+ \begin{figure}[ht]
+ \centering
+ \includegraphics[width=\linewidth]{fig-taskvalue}
+ \caption{The states of a \CI{TaskValue}}
+ \end{figure}
\end{frame}
\begin{frame}[fragile]
\end{lstlisting}
\end{frame}
+\begin{frame}
+ \frametitle{So how can we do the integration?}
+ \begin{itemize}[<+->]
+ \item Program device as an SDS
+ \item Distributed iTasks
+ \item Devices have different paradigms
+ \end{itemize}
+\end{frame}
+
\begin{frame}
\frametitle{But not all Tasks or SDSs are suitable for microcontrollers\ldots}
\pause\centering\Large EDSLs to the rescue
\begin{block}{What is mTask}
\begin{itemize}
\item Created by Pieter Koopman and Rinus Plasmeijer
- \item EDSL
+ \item EDSL for imperative programs
\item Arduino C++ generation, iTasks simulation
\end{itemize}
\end{block}
\begin{frame}[fragile]
\frametitle{Expressions}
\begin{block}{mTask}
- \begin{itemize}[<+->]
- \item Of the form \CI{v t p}
- \item \CI{p} is hierarchical
- \end{itemize}
+ Of the form \CI{v t p}
\end{block}
\pause{}
\begin{lstlisting}[language=Clean]
\frametitle{Examples}
\begin{lstlisting}[language=Clean]
blink = task \blink=(\x.
- IF (x ==. lit True)
+ IF x)
(ledOn LED1)
(ledOff LED2) :.
blink (lit 1000) (Not x))
In {main=blink (lit 1000) True}
thermostat :: Main (View () Stmt)
-thermostat = {main = IF (analogRead A0 >. lit 50)
- ( digitalWrite D0 (lit True) )
- ( digitalWrite D0 (lit False) )
- }
+thermostat = {main = digitalWrite (dIO D0) (analogRead A0 >. lit 50)
thermostat2 :: Main (View () Stmt)
-thermostat2 = let a0 = aIO A0
- d0 = dIO D0
- in {main = IF (a0 >. lit 50)
- (d0 =. lit True)
- (d0 =. lit False)
- }
+thermostat = {main = (dIO D0) =. (analogRead A0 >. lit 50)
\end{lstlisting}
\end{frame}
\begin{frame}
\frametitle{Current state of mTask}
\begin{itemize}
+ \item Suits our needs as an EDSL
\item It all seems perfect
\item \ldots\pause{} but\ldots
\pause{}
\begin{frame}
\frametitle{Solution}
\begin{itemize}[<+->]
+ \item Reuse mTask
\item New bytecode backend for mTask
\item Interpreter on client
\item Server in iTasks with integration
\item No taskserver generation, onetime programming
\item Dynamic task sending
- \item Explicit SDS publishing
\end{itemize}
\end{frame}
\end{lstlisting}
\end{frame}
-%\begin{frame}[fragile]
-% \frametitle{Functionality}
-% \begin{block}{SDS scope and naming}
-% \begin{itemize}
-% \item SDS is lost
-% \item State per device
-% \item Tasks are sent and gone
-% \end{itemize}
-% \pause{}
-% \begin{lstlisting}
-%class namedsds v where
-% namedsds :: ((v t Upd) -> In (Named t String) (Main (v c s)))
-% -> (Main (v c s)) | ...
-%:: Named a b = Named infix 1 a b
-%
-%instance sdspub ByteCode where
-% pub (BC x) = BC (censor (\[BCSdsFetch s]->[BCSdsPublish s]) x)
-% \end{lstlisting}
-% \end{block}
-%\end{frame}
-
\begin{frame}[fragile]
- \frametitle{Assignment}
+ \frametitle{Assignment and SDSs}
\begin{lstlisting}[language=Clean]
instance sds ByteCode where
sds f = {main = BC (freshshare
\end{lstlisting}
\end{frame}
+\begin{frame}[fragile]
+ \frametitle{Bandwidth is scarce}
+ Publish SDS explicitly
+ \pause{}
+ \begin{lstlisting}
+class sdspub v where
+ pub :: (v t Upd) -> (v () Stmt)
+instance sdspub ByteCode where
+ pub (BC x) = BC (censor (\[BCSdsFetch s]->[BCSdsPublish s]) x)
+ \end{lstlisting}
+\end{frame}
+
\begin{frame}[fragile]
\frametitle{Task scheduling}
\begin{block}{Old}