\section{CStatemaschine Klassenreferenz}
\label{classCStatemaschine}\index{CStatemaschine@{CStatemaschine}}
implements a statemaschine ( used the handle incoming command blocks )  


{\tt \#include $<$statemaschine.hpp$>$}

\subsection*{\"{O}ffentliche Typen}
\begin{CompactItemize}
\item 
enum {\bf STATE} \{ \par
{\bf IDLE}, 
{\bf WAIT\_\-COMMAND}, 
{\bf WAIT\_\-ADDRESS}, 
{\bf WAIT\_\-LENGTH}, 
\par
{\bf WAIT\_\-DATA}, 
{\bf WAIT\_\-ETX}, 
{\bf WAIT\_\-CRC}
 \}
\begin{CompactList}\small\item\em all possible states \item\end{CompactList}\end{CompactItemize}
\subsection*{\"{O}ffentliche Methoden}
\begin{CompactItemize}
\item 
{\bf CStatemaschine} ()
\begin{CompactList}\small\item\em constructor \item\end{CompactList}\item 
virtual {\bf $\sim$CStatemaschine} ()\label{classCStatemaschine_a1}

\begin{CompactList}\small\item\em destructor \item\end{CompactList}\item 
bool {\bf Input} (const unsigned char uc\-Input)
\begin{CompactList}\small\item\em the implementation of the statemaschine overgive the next byte for run throught the statemaschine \item\end{CompactList}\item 
{\bf STATE} {\bf Get\-Current\-State} (void) const
\begin{CompactList}\small\item\em delivers the current state of the statemaschine \item\end{CompactList}\item 
void {\bf Set\-Current\-State} (const {\bf STATE})
\begin{CompactList}\small\item\em Sets the current state of the statemaschine. \item\end{CompactList}\item 
bool {\bf Is\-Completed} (void) const
\begin{CompactList}\small\item\em returns true in case of a complete run through the statemaschine \item\end{CompactList}\end{CompactItemize}
\subsection*{Private Methoden}
\begin{CompactItemize}
\item 
bool {\bf State\-Idle} (unsigned char uc\-Input)
\begin{CompactList}\small\item\em handle state IDLE \item\end{CompactList}\item 
bool {\bf State\-Wait\-Command} (unsigned char uc\-Input)
\begin{CompactList}\small\item\em handle state WAIT\_\-COMMAND \item\end{CompactList}\item 
bool {\bf State\-Wait\-Address} (unsigned char uc\-Input)
\begin{CompactList}\small\item\em handle state WAIT\_\-ADDRESS \item\end{CompactList}\item 
bool {\bf State\-Wait\-Length} (unsigned char uc\-Input)
\begin{CompactList}\small\item\em handle state WAIT\_\-LENGTH \item\end{CompactList}\item 
bool {\bf State\-Wait\-Data} (unsigned char uc\-Input)
\begin{CompactList}\small\item\em handle state WAIT\_\-DATA \item\end{CompactList}\item 
bool {\bf State\-Wait\-Etx} (unsigned char uc\-Input)
\begin{CompactList}\small\item\em handle state WAIT\_\-ETX \item\end{CompactList}\item 
bool {\bf State\-Wait\-Crc} (unsigned char uc\-Input)
\begin{CompactList}\small\item\em handle state WAIT\_\-CRC \item\end{CompactList}\end{CompactItemize}
\subsection*{Private Attribute}
\begin{CompactItemize}
\item 
{\bf STATE} {\bf m\_\-Current\-State}\label{classCStatemaschine_r0}

\item 
bool {\bf m\_\-b\-Finished}\label{classCStatemaschine_r1}

\begin{CompactList}\small\item\em the current state we're in \item\end{CompactList}\item 
bool {\bf m\_\-b\-Datasegment\-Used}\label{classCStatemaschine_r2}

\begin{CompactList}\small\item\em have we finished a complete run through the statemaschine \item\end{CompactList}\end{CompactItemize}


\subsection{Ausf\"{u}hrliche Beschreibung}
implements a statemaschine ( used the handle incoming command blocks ) 

\begin{Desc}
\item[Version:]1.0 \end{Desc}
\begin{Desc}
\item[Autor:]Ingo Fr\"{o}hlich \end{Desc}




\subsection{Dokumentation der Aufz\"{a}hlungstypen}
\index{CStatemaschine@{CStatemaschine}!STATE@{STATE}}
\index{STATE@{STATE}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf CStatemaschine::STATE}}\label{classCStatemaschine_w7}


all possible states 

\begin{Desc}
\item[Aufz\"{a}hlungswerte: ]\par
\begin{description}
\index{WAIT_COMMAND@{WAIT\_\-COMMAND}!CStatemaschine@{CStatemaschine}}\index{CStatemaschine@{CStatemaschine}!WAIT_COMMAND@{WAIT\_\-COMMAND}}\item[{\em 
WAIT\_\-COMMAND\label{classCStatemaschine_w7w1}
}]just entered the statemaschine \index{WAIT_ADDRESS@{WAIT\_\-ADDRESS}!CStatemaschine@{CStatemaschine}}\index{CStatemaschine@{CStatemaschine}!WAIT_ADDRESS@{WAIT\_\-ADDRESS}}\item[{\em 
WAIT\_\-ADDRESS\label{classCStatemaschine_w7w2}
}]we expect a command ( 1 byte ) \index{WAIT_LENGTH@{WAIT\_\-LENGTH}!CStatemaschine@{CStatemaschine}}\index{CStatemaschine@{CStatemaschine}!WAIT_LENGTH@{WAIT\_\-LENGTH}}\item[{\em 
WAIT\_\-LENGTH\label{classCStatemaschine_w7w3}
}]waiting for the addresse ( 2 bytes ) \index{WAIT_DATA@{WAIT\_\-DATA}!CStatemaschine@{CStatemaschine}}\index{CStatemaschine@{CStatemaschine}!WAIT_DATA@{WAIT\_\-DATA}}\item[{\em 
WAIT\_\-DATA\label{classCStatemaschine_w7w4}
}]waiting for data block length ( 1 byte ) \index{WAIT_ETX@{WAIT\_\-ETX}!CStatemaschine@{CStatemaschine}}\index{CStatemaschine@{CStatemaschine}!WAIT_ETX@{WAIT\_\-ETX}}\item[{\em 
WAIT\_\-ETX\label{classCStatemaschine_w7w5}
}]waiting for data ( n byte ) \index{WAIT_CRC@{WAIT\_\-CRC}!CStatemaschine@{CStatemaschine}}\index{CStatemaschine@{CStatemaschine}!WAIT_CRC@{WAIT\_\-CRC}}\item[{\em 
WAIT\_\-CRC\label{classCStatemaschine_w7w6}
}]wait for checksum ( 2 bytes ) \end{description}
\end{Desc}



\subsection{Beschreibung der Konstruktoren und Destruktoren}
\index{CStatemaschine@{CStatemaschine}!CStatemaschine@{CStatemaschine}}
\index{CStatemaschine@{CStatemaschine}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}CStatemaschine::CStatemaschine ()}\label{classCStatemaschine_a0}


constructor 

Format frame :

STX, Command, Address, Length, [Data], ETX, crc

STX : stating byte Command : Command send or received ( see commandstring for details ) Address : Address in the fps data send to or received from Length : Length of the data Data : the pure data ETX : byt, signals the end of the frame crc : checksum of the hole frame 

\subsection{Dokumentation der Elementfunktionen}
\index{CStatemaschine@{CStatemaschine}!GetCurrentState@{GetCurrentState}}
\index{GetCurrentState@{GetCurrentState}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf CStatemaschine::STATE} CStatemaschine::Get\-Current\-State (void) const\hspace{0.3cm}{\tt  [inline]}}\label{classCStatemaschine_a3}


delivers the current state of the statemaschine 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em ---}]\end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]current state \end{Desc}
\index{CStatemaschine@{CStatemaschine}!Input@{Input}}
\index{Input@{Input}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::Input (const unsigned char {\em uc\-Input})}\label{classCStatemaschine_a2}


the implementation of the statemaschine overgive the next byte for run throught the statemaschine 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em the}]next read byte \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true ok 

false an error occured \end{Desc}
\index{CStatemaschine@{CStatemaschine}!IsCompleted@{IsCompleted}}
\index{IsCompleted@{IsCompleted}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::Is\-Completed (void) const}\label{classCStatemaschine_a5}


returns true in case of a complete run through the statemaschine 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em ---}]\end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true run completed \end{Desc}
\index{CStatemaschine@{CStatemaschine}!SetCurrentState@{SetCurrentState}}
\index{SetCurrentState@{SetCurrentState}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void CStatemaschine::Set\-Current\-State (const {\em STATE})}\label{classCStatemaschine_a4}


Sets the current state of the statemaschine. 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em the}]new state \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]--- \end{Desc}
\index{CStatemaschine@{CStatemaschine}!StateIdle@{StateIdle}}
\index{StateIdle@{StateIdle}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::State\-Idle (unsigned char {\em uc\-Input})\hspace{0.3cm}{\tt  [private]}}\label{classCStatemaschine_d0}


handle state IDLE 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em current}]input of the statemaschine \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true error occured 

false else \end{Desc}
\index{CStatemaschine@{CStatemaschine}!StateWaitAddress@{StateWaitAddress}}
\index{StateWaitAddress@{StateWaitAddress}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::State\-Wait\-Address (unsigned char {\em uc\-Input})\hspace{0.3cm}{\tt  [private]}}\label{classCStatemaschine_d2}


handle state WAIT\_\-ADDRESS 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em current}]input of the statemaschine \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true error occured 

false else \end{Desc}
\index{CStatemaschine@{CStatemaschine}!StateWaitCommand@{StateWaitCommand}}
\index{StateWaitCommand@{StateWaitCommand}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::State\-Wait\-Command (unsigned char {\em uc\-Input})\hspace{0.3cm}{\tt  [private]}}\label{classCStatemaschine_d1}


handle state WAIT\_\-COMMAND 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em current}]input of the statemaschine \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true error occured 

false else \end{Desc}
\index{CStatemaschine@{CStatemaschine}!StateWaitCrc@{StateWaitCrc}}
\index{StateWaitCrc@{StateWaitCrc}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::State\-Wait\-Crc (unsigned char {\em uc\-Input})\hspace{0.3cm}{\tt  [private]}}\label{classCStatemaschine_d6}


handle state WAIT\_\-CRC 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em current}]input of the statemaschine \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true error occured 

false else \end{Desc}
\index{CStatemaschine@{CStatemaschine}!StateWaitData@{StateWaitData}}
\index{StateWaitData@{StateWaitData}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::State\-Wait\-Data (unsigned char {\em uc\-Input})\hspace{0.3cm}{\tt  [private]}}\label{classCStatemaschine_d4}


handle state WAIT\_\-DATA 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em current}]input of the statemaschine \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true error occured 

false else \end{Desc}
\index{CStatemaschine@{CStatemaschine}!StateWaitEtx@{StateWaitEtx}}
\index{StateWaitEtx@{StateWaitEtx}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::State\-Wait\-Etx (unsigned char {\em uc\-Input})\hspace{0.3cm}{\tt  [private]}}\label{classCStatemaschine_d5}


handle state WAIT\_\-ETX 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em current}]input of the statemaschine \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true error occured 

false else \end{Desc}
\index{CStatemaschine@{CStatemaschine}!StateWaitLength@{StateWaitLength}}
\index{StateWaitLength@{StateWaitLength}!CStatemaschine@{CStatemaschine}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool CStatemaschine::State\-Wait\-Length (unsigned char {\em uc\-Input})\hspace{0.3cm}{\tt  [private]}}\label{classCStatemaschine_d3}


handle state WAIT\_\-LENGTH 

\begin{Desc}
\item[Parameter:]
\begin{description}
\item[{\em current}]input of the statemaschine \end{description}
\end{Desc}
\begin{Desc}
\item[R\"{u}ckgabe:]true error occured 

false else \end{Desc}


Die Dokumentation f\"{u}r diese Klasse wurde erzeugt aufgrund der Dateien:\begin{CompactItemize}
\item 
statemaschine.hpp\item 
statemaschine.cpp\end{CompactItemize}
