Merge branch 'master' of git.martlubbers.net:msc-thesis1617
[msc-thesis1617.git] / appendix-protocol.tex
index d20f6c8..0f64bdb 100644 (file)
-\section{Server to Client}
+\section*{General Message Format}
 Messages are delimited by newlines to make processing by line based devices
-more easy.
-\todo{Handshake}
-\begin{table}[ht]
-       \centering
-       \begin{tabular}{ll}
-               \toprule
-               byte & value\\
-               \midrule
-               1 & \texttt{'t'}\\
-               2,3 & interval\\
-               4,5 & length (\texttt{n})\\
-               6 to n+6 & bytecode\\
-               \bottomrule
-       \end{tabular}
-       \caption{Send a task}
-\end{table}
+easier. Message exchanges have a \emph{Request} and \emph{Response} header.
+The \emph{Request} header means that the server is sending to the client. The
+\emph{Response} header means that the client is sending to the server. In some
+cases either the \emph{Request} or \emph{Response} is empty. This means that
+the message is not acknowledged or responded upon. Multibyte values are
+interpreted as \gls{MSB} first integers.
 
-\begin{table}[ht]
+\section*{Handshake}
+\begin{table}[H]
        \centering
        \begin{tabular}{ll}
                \toprule
-               byte & meaning\\
-               \midrule
-               1 & \texttt{'d'}\\
-               2,3 & task id\\
-               \bottomrule
-       \end{tabular}
-       \caption{Delete a task}
-\end{table}
-
-\begin{table}[ht]
-       \centering
-       \begin{tabular}{ll}
-               \toprule
-               byte & meaning\\
+               \multicolumn{2}{c}{Request}\\
+               byte & value\\
                \midrule
-               1 & \texttt{'s'}\\
-               2,3 & identifier\\
-               4,5 & value\\
-               \bottomrule
-       \end{tabular}
-       \caption{Send an SDS specification}
-\end{table}
-
-\begin{table}[ht]
-       \centering
-       \begin{tabular}{ll}
-               \toprule
-               byte & meaning\\
+               1 & \texttt{'c'}\\
+               \midrule\midrule
+               \multicolumn{2}{c}{Response}\\
+               byte & value\\
                \midrule
-               1 & \texttt{'u'}\\
-               2,3 & sdsid\\
-               4,5 & value\\
+               1 & \texttt{'c'}\\
+               2 & Peripheral bitmask\\
+               3,4 & Bytes of memory\\
+               5,6 & Size of the stack\\
+               7 & Number of analog pins\\
+               8 & Number of digital pins\\
                \bottomrule
        \end{tabular}
-       \caption{SDS update}
+       \caption{Send a device specification}
 \end{table}
 
-\section{Client to Server}
-\todo{Handshake reply}
-\begin{table}[ht]
+\newpage
+\section*{\gls{mTask}-\glspl{Task}}
+\begin{table}[H]
        \centering
-       \begin{tabular}{ll}
-               \toprule
-               byte & value\\
-               \midrule
-               1 & \texttt{'t'}\\
-               2,3 & task id\\
-               \bottomrule
-       \end{tabular}
-       \caption{Task acknowledgement}
+       \begin{subfigure}[b]{.48\textwidth}
+               \centering
+               \begin{tabular}{ll}
+                       \toprule
+                       \multicolumn{2}{c}{Request}\\
+                       byte & value\\
+                       \midrule
+                       1 & \texttt{'t'}\\
+                       2,3 & interval or interrupt\\
+                       4,5 & length ($n$)\\
+                       6 to $n$+6 & bytecode\\
+                       \midrule\midrule
+                       \multicolumn{2}{c}{Response}\\
+                       byte & value\\
+                       \midrule
+                       1 & \texttt{'t'}\\
+                       2,3 & \gls{Task} id\\
+                       \bottomrule
+               \end{tabular}
+               \caption{Send a \gls{Task}}
+       \end{subfigure}
+       \quad%
+       \begin{subfigure}[b]{.48\textwidth}
+               \centering
+               \begin{tabular}{ll}
+                       \toprule
+                       \multicolumn{2}{c}{Request}\\
+                       byte & meaning\\
+                       \midrule
+                       1 & \texttt{'d'}\\
+                       2,3 & \gls{Task} id\\
+                       \midrule\midrule
+                       \multicolumn{2}{c}{Response}\\
+                       byte & value\\
+                       \midrule
+                       1 & \texttt{'d'}\\
+                       2,3 & \gls{Task} id\\
+                       \bottomrule
+               \end{tabular}
+               \caption{Delete a \gls{Task}}
+       \end{subfigure}
+       \caption{Message protocol for exchanging \glspl{Task}}
 \end{table}
 
-\begin{table}[ht]
+\section*{\glspl{SDS}}
+\begin{table}[H]
        \centering
-       \begin{tabular}{ll}
-               \toprule
-               byte & value\\
-               \midrule
-               1 & \texttt{'u'}\\
-               2,3 & SDS id\\
-               4,5 & value\\
-               \bottomrule
-       \end{tabular}
-       \caption{SDS publish}
+       \begin{subfigure}[b]{.23\textwidth}
+               \centering
+               \begin{tabular}{ll}
+                       \toprule
+                       \multicolumn{2}{c}{Request}\\
+                       byte & meaning\\
+                       \midrule
+                       1 & \texttt{'s'}\\
+                       2,3 & id\\
+                       4,5 & value\\
+                       \midrule\midrule
+                       \multicolumn{2}{c}{Response}\\
+                       byte & meaning\\
+                       \midrule
+                       1 & \texttt{'s'}\\
+                       2,3 & id\\
+                       \bottomrule
+               \end{tabular}
+               \caption{Send an \gls{SDS} specification}
+       \end{subfigure}
+       \quad%
+       \begin{subfigure}[b]{.23\textwidth}
+               \centering
+               \begin{tabular}{ll}
+                       \toprule
+                       \multicolumn{2}{c}{Response}\\
+                       byte & value\\
+                       \midrule
+                       1 & \texttt{'a'}\\
+                       2,3 & SDS id\\
+                       \midrule\midrule
+                       \multicolumn{2}{c}{Request}\\
+                       byte & value\\
+                       \midrule
+                       1 & \texttt{'a'}\\
+                       2,3 & SDS id\\
+                       \bottomrule
+               \end{tabular}
+               \caption{Delete an \gls{SDS}\\~}
+       \end{subfigure}
+       \quad%
+       \begin{subfigure}[b]{.23\textwidth}
+               \centering
+               \begin{tabular}{ll}
+                       \toprule
+                       \multicolumn{2}{c}{Request}\\
+                       byte & meaning\\
+                       \midrule
+                       1 & \texttt{'u'}\\
+                       2,3 & sdsid\\
+                       4,5 & value\\
+                       \midrule\midrule
+                       \multicolumn{2}{c}{Response}\\
+                       \bottomrule
+               \end{tabular}
+               \caption{\gls{SDS} update\\~}
+       \end{subfigure}
+       \quad%
+       \begin{subfigure}[b]{.23\textwidth}
+               \centering
+               \begin{tabular}{ll}
+                       \toprule
+                       \multicolumn{2}{c}{Response}\\
+                       \midrule\midrule
+                       \multicolumn{2}{c}{Request}\\
+                       byte & value\\
+                       \midrule
+                       1 & \texttt{'p'}\\
+                       2,3 & SDS id\\
+                       4,5 & value\\
+                       \bottomrule
+               \end{tabular}
+               \caption{\gls{SDS} publish\\~}
+       \end{subfigure}
+       \caption{Message protocol for exchanging \glspl{SDS}}
 \end{table}
-
-\todo{SDS acknowledgement}