X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=arch.communication.tex;h=1e9b4b6b86309d7fb20f63d61c5d65915005b999;hb=b446f3259c042cd5b95d7a92070efb745efd0c50;hp=61a7e2e90f201a3f8a33731e58a2d2eac635febf;hpb=6548a5ec9ce8e0df67fc4019625ab5238eb1bf71;p=msc-thesis1617.git diff --git a/arch.communication.tex b/arch.communication.tex index 61a7e2e..1e9b4b6 100644 --- a/arch.communication.tex +++ b/arch.communication.tex @@ -2,8 +2,8 @@ The communication from the server to the client and vice versa is just a character stream containing encoded \gls{mTask} messages. The \CI{synFun} belonging to the device is responsible for sending the content in the left channel and putting received messages in the right channel. Moreover, the -boolean value should be set to \CI{True} when the connection is terminated. The -specific encoding of the messages is visible in +boolean flag in the channel type should be set to \CI{True} when the connection +is terminated. The specific encoding of the messages is visible in Appendix~\ref{app:communication-protocol}. The type holding the messages is shown in Listing~\ref{lst:avmsg}. Detailed explanation about the message types and according actions will be given in the following subsections. @@ -26,6 +26,31 @@ and according actions will be given in the following subsections. :: MTaskInterval = OneShot | OnInterval Int | OnInterrupt Int \end{lstlisting} +\subsection{Device Specification} +The server stores a description for every device available in a record type. +From the macro settings in the client --- in the interface file--- a profile +is created that describes the specification of the device. When the connection +between the server and a client is established, the server will send a request +for specification. The client serializes its specification and send it to the +server so that the server knows what the client is capable of. The exact +specification is shown in Listing~\ref{lst:devicespec} and stores the +peripheral availability, the memory available for storing \glspl{Task} and +\glspl{SDS} and the size of the stack. Not all peripheral flags are shown for +brevity. + +\begin{lstlisting}[label={lst:devicespec}, + caption={Device specification for \gls{mTask}-\glspl{Task}}] +:: MTaskDeviceSpec = + { haveLed :: Bool + , haveLCD :: Bool + , have... + , bytesMemory :: Int + , stackSize :: Int + , aPins :: Int + , dPins :: Int + } +\end{lstlisting} + \subsection{Add a device} A device can be added by filling in the \CI{MTaskDevice} record as much as possible and running the \CI{connectDevice} function. This function grabs the @@ -91,12 +116,12 @@ Listing~\ref{lst:sendtask}. First the \gls{Task} is compiled into messages. The details of the compilation process are given in Section~\ref{sec:compiler}. The new \glspl{SDS} that were generated during compilation are merged with the existing device's \glspl{SDS}. Furthermore the messages are placed in the -channel \gls{SDS} of the device. This will result in sending the actual \gls{SDS} -specification and \gls{Task} specifications to the device. A \gls{Task} record -is created with the identifier $-1$ to denote a \gls{Task} not yet -acknowledged. Finally the device itself is updated with the new state and with -the new \gls{Task}. After waiting for the acknowledgement the device is -updated again and the \gls{Task} returns. +channel \gls{SDS} of the device. This will result in sending the actual +\gls{SDS} specification and \gls{Task} specifications to the device. A +\gls{Task} record is created with the identifier $-1$ to denote a \gls{Task} +not yet acknowledged. Finally the device itself is updated with the new state +and with the new \gls{Task}. After waiting for the acknowledgement the device +is updated again and the \gls{Task} returns. \begin{lstlisting}[label={lst:sendtask},% caption={Sending a \gls{Task} to a device}]