change document structure to a more intuitive one
[msc-thesis1617.git] / appendix-protocol.tex
1 \section{General message format}
2 Messages are delimited by newlines to make processing by line based devices
3 easier. Message exchanges have a \emph{Request} and \emph{Response} header.
4 The \emph{Request} header means that the server is sending to the client. The
5 \emph{Response} header means that the client is sending to the server. In some
6 cases either the \emph{Request} or \emph{Response} is empty. This means that
7 the message is not acknowledged or responded upon. Multibyte values are
8 interpreted as \gls{MSB} first integers.
9
10 \section{Handshake}
11 \begin{table}[H]
12 \centering
13 \begin{subfigure}[t]{.48\textwidth}
14 \begin{tabular}{ll}
15 \toprule
16 \multicolumn{2}{c}{Request}\\
17 byte & value\\
18 \midrule
19 1 & \texttt{'c'}\\
20 \midrule\midrule
21 \multicolumn{2}{c}{Response}\\
22 byte & value\\
23 \midrule
24 1 & \texttt{'c'}\\
25 2 & Peripheral bitmask\\
26 3,4 & Bytes of memory\\
27 5,6 & Size of the stack\\
28 7 & Number of analog pins\\
29 8 & Number of digital pins\\
30 \bottomrule
31 \end{tabular}
32 \caption{Send a device specification}
33 \end{subfigure}
34 \end{table}
35
36 \newpage
37 \section{mTasks}
38 \begin{table}[H]
39 \centering
40 \begin{subfigure}[t]{.48\textwidth}
41 \begin{tabular}{ll}
42 \toprule
43 \multicolumn{2}{c}{Request}\\
44 byte & value\\
45 \midrule
46 1 & \texttt{'t'}\\
47 2,3 & interval or interrupt\\
48 4,5 & length (\texttt{n})\\
49 6 to n+6 & bytecode\\
50 \midrule\midrule
51 \multicolumn{2}{c}{Response}\\
52 byte & value\\
53 \midrule
54 1 & \texttt{'t'}\\
55 2,3 & \gls{Task} id\\
56 \bottomrule
57 \end{tabular}
58 \caption{Send a \gls{Task}}
59 \end{subfigure}
60 \quad%
61 \begin{subfigure}[t]{.48\textwidth}
62 \begin{tabular}{ll}
63 \toprule
64 \multicolumn{2}{c}{Request}\\
65 byte & meaning\\
66 \midrule
67 1 & \texttt{'d'}\\
68 2,3 & \gls{Task} id\\
69 \midrule\midrule
70 \multicolumn{2}{c}{Response}\\
71 byte & value\\
72 \midrule
73 1 & \texttt{'d'}\\
74 2,3 & \gls{Task} id\\
75 \bottomrule
76 \end{tabular}
77 \caption{Delete a \gls{Task}}
78 \end{subfigure}
79 \caption{Message protocol for exchanging \glspl{Task}}
80 \end{table}
81
82 \section{SDSs}
83 \begin{table}[H]
84 \centering
85 \begin{subfigure}[t]{.2\textwidth}
86 \begin{tabular}{ll}
87 \toprule
88 \multicolumn{2}{c}{Request}\\
89 byte & meaning\\
90 \midrule
91 1 & \texttt{'s'}\\
92 2,3 & identifier\\
93 4,5 & value\\
94 \midrule\midrule
95 \multicolumn{2}{c}{Response}\\
96 byte & meaning\\
97 \midrule
98 1 & \texttt{'s'}\\
99 2,3 & identifier\\
100 \bottomrule
101 \end{tabular}
102 \caption{Send an SDS specification}
103 \end{subfigure}
104 \quad%
105 \begin{subfigure}[t]{.2\textwidth}
106 \begin{tabular}{ll}
107 \toprule
108 \multicolumn{2}{c}{Response}\\
109 byte & value\\
110 \midrule
111 1 & \texttt{'a'}\\
112 2,3 & SDS id\\
113 \midrule\midrule
114 \multicolumn{2}{c}{Request}\\
115 byte & value\\
116 \midrule
117 1 & \texttt{'a'}\\
118 2,3 & SDS id\\
119 \bottomrule
120 \end{tabular}
121 \caption{Delete a SDS}
122 \end{subfigure}
123 \quad%
124 \begin{subfigure}[t]{.2\textwidth}
125 \begin{tabular}{ll}
126 \toprule
127 \multicolumn{2}{c}{Request}\\
128 byte & meaning\\
129 \midrule
130 1 & \texttt{'u'}\\
131 2,3 & sdsid\\
132 4,5 & value\\
133 \midrule\midrule
134 \multicolumn{2}{c}{Response}\\
135 \bottomrule
136 \end{tabular}
137 \caption{SDS update}
138 \end{subfigure}
139 \quad%
140 \begin{subfigure}[t]{.2\textwidth}
141 \begin{tabular}{ll}
142 \toprule
143 \multicolumn{2}{c}{Response}\\
144 \midrule\midrule
145 \multicolumn{2}{c}{Request}\\
146 byte & value\\
147 \midrule
148 1 & \texttt{'p'}\\
149 2,3 & SDS id\\
150 4,5 & value\\
151 \bottomrule
152 \end{tabular}
153 \caption{SDS publish}
154 \end{subfigure}
155 \caption{Message protocol for exchanging SDSs}
156 \end{table}