\section{guirobot.c File Reference}
\label{guirobot_8c}\index{guirobot.c@{guirobot.c}}
Robot-Side application with GUI (simulator) to control the robot. 


{\tt \#include $<$time.h$>$}\par
{\tt \#include $<$math.h$>$}\par
{\tt \#include $<$pthread.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$gtk/gtk.h$>$}\par
{\tt \#include $<$glib.h$>$}\par
{\tt \#include $<$unistd.h$>$}\par
{\tt \#include $<$signal.h$>$}\par
{\tt \#include $<$gdk/gdk.h$>$}\par
{\tt \#include \char`\"{}../lib/libcomm.h\char`\"{}}\par
{\tt \#include \char`\"{}guicommon.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf gr\_\-delete\_\-event} (Gtk\-Widget $\ast$widget, gpointer data)
\begin{CompactList}\small\item\em This function will be called be gtk when the window gets a closing command, it makes sure that the interface is down and the program is finished.\item\end{CompactList}\item 
void {\bf gr\_\-da\_\-expose\_\-event} (Gtk\-Widget $\ast$widget, gpointer data)
\begin{CompactList}\small\item\em This function is called by gtk if the drawing area (da) needs to be redrawn.\item\end{CompactList}\item 
void {\bf gr\_\-button\_\-press\_\-event} (Gtk\-Widget $\ast$widget, gpointer data)
\begin{CompactList}\small\item\em This function is called if a button is pressed.\item\end{CompactList}\item 
{\bf gr\_\-block\_\-call\_\-do\_\-test} (int fd, int id, unsigned int type, char $\ast$buf, unsigned int size, int term)
\begin{CompactList}\small\item\em Function which is called from {\bf block\_\-call}() {\rm (p.\,\pageref{libcomm_8c_a6})} if a message/datablock has received.\item\end{CompactList}\item 
{\bf linemonitor\_\-exception} (char $\ast$server, int port, int type)
\begin{CompactList}\small\item\em Exception function for the {\bf linemonitor}() {\rm (p.\,\pageref{libcomm_8c_a20})}, print exception code and its meaning on the screen and take further action if necessary.\item\end{CompactList}\item 
{\bf gr\_\-block\_\-call\_\-term\_\-test} (int fd, int id)
\begin{CompactList}\small\item\em Function which ist called from {\bf block\_\-call}() {\rm (p.\,\pageref{libcomm_8c_a6})} if a the connection terminates: shut down system.\item\end{CompactList}\item 
{\bf gr\_\-socket\_\-accept\_\-do} (int fd, int id, char $\ast$pip, struct sockaddr\_\-in their\_\-addr, int term)
\begin{CompactList}\small\item\em Function which is called from {\bf socket\_\-accept}() {\rm (p.\,\pageref{libcomm_8c_a1})} if someone has connected.\item\end{CompactList}\item 
int {\bf main} (int argc, char $\ast$argv[$\,$])
\begin{CompactList}\small\item\em test0001sockts: see test0001sockts.c.\item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
Gtk\-Widget $\ast$ {\bf gr\_\-application}
\item 
Gtk\-Widget $\ast$ {\bf da\_\-global}
\item 
int {\bf robot\_\-x} = 50
\item 
int {\bf robot\_\-y} = 0
\item 
int {\bf soft\_\-msec}
\item 
int {\bf hard\_\-msec}
\item 
int {\bf wait\_\-msec}
\item 
int {\bf shut\_\-down}
\item 
int {\bf serverport}
\end{CompactItemize}


\subsection{Detailed Description}
Robot-Side application with GUI (simulator) to control the robot.





\subsection{Function Documentation}
\index{guirobot.c@{guirobot.c}!gr_block_call_do_test@{gr\_\-block\_\-call\_\-do\_\-test}}
\index{gr_block_call_do_test@{gr\_\-block\_\-call\_\-do\_\-test}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gr\_\-block\_\-call\_\-do\_\-test (int {\em fd}, int {\em id}, unsigned int {\em type}, char $\ast$ {\em buf}, unsigned int {\em size}, int {\em term})}\label{guirobot_8c_a14}


Function which is called from {\bf block\_\-call}() {\rm (p.\,\pageref{libcomm_8c_a6})} if a message/datablock has received.

See API of {\bf block\_\-call}() {\rm (p.\,\pageref{libcomm_8c_a6})}. \index{guirobot.c@{guirobot.c}!gr_block_call_term_test@{gr\_\-block\_\-call\_\-term\_\-test}}
\index{gr_block_call_term_test@{gr\_\-block\_\-call\_\-term\_\-test}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gr\_\-block\_\-call\_\-term\_\-test (int {\em fd}, int {\em id})}\label{guirobot_8c_a16}


Function which ist called from {\bf block\_\-call}() {\rm (p.\,\pageref{libcomm_8c_a6})} if a the connection terminates: shut down system.

See {\bf block\_\-call}() {\rm (p.\,\pageref{libcomm_8c_a6})} API. \index{guirobot.c@{guirobot.c}!gr_button_press_event@{gr\_\-button\_\-press\_\-event}}
\index{gr_button_press_event@{gr\_\-button\_\-press\_\-event}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void gr\_\-button\_\-press\_\-event (Gtk\-Widget $\ast$ {\em widget}, gpointer {\em data})}\label{guirobot_8c_a13}


This function is called if a button is pressed.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
widget}](Gtk\-Widget $\ast$) pointer to affected object (button).\item[{\em 
event}](Gdk\-Event\-Motion $\ast$) pointer to structure which describes the event. \end{description}
\end{Desc}
\index{guirobot.c@{guirobot.c}!gr_da_expose_event@{gr\_\-da\_\-expose\_\-event}}
\index{gr_da_expose_event@{gr\_\-da\_\-expose\_\-event}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void gr\_\-da\_\-expose\_\-event (Gtk\-Widget $\ast$ {\em widget}, gpointer {\em data})}\label{guirobot_8c_a12}


This function is called by gtk if the drawing area (da) needs to be redrawn.

For example if it becomes visible.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
widget}](Gtk\-Widget $\ast$) pointer to affected object (in this case the drawing area).\item[{\em 
data}](gpointer) pointer to additional data from gtk. \end{description}
\end{Desc}
\index{guirobot.c@{guirobot.c}!gr_delete_event@{gr\_\-delete\_\-event}}
\index{gr_delete_event@{gr\_\-delete\_\-event}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void gr\_\-delete\_\-event (Gtk\-Widget $\ast$ {\em widget}, gpointer {\em data})}\label{guirobot_8c_a10}


This function will be called be gtk when the window gets a closing command, it makes sure that the interface is down and the program is finished.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
widget}](Gtk\-Widget $\ast$) pointer to affected object (for example: window).\item[{\em 
data}](gpointer) pointer to additional data from gtk. \end{description}
\end{Desc}
\index{guirobot.c@{guirobot.c}!gr_socket_accept_do@{gr\_\-socket\_\-accept\_\-do}}
\index{gr_socket_accept_do@{gr\_\-socket\_\-accept\_\-do}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gr\_\-socket\_\-accept\_\-do (int {\em fd}, int {\em id}, char $\ast$ {\em pip}, struct sockaddr\_\-in {\em their\_\-addr}, int {\em term})}\label{guirobot_8c_a17}


Function which is called from {\bf socket\_\-accept}() {\rm (p.\,\pageref{libcomm_8c_a1})} if someone has connected.

See {\bf socket\_\-accept}() {\rm (p.\,\pageref{libcomm_8c_a1})} API. \index{guirobot.c@{guirobot.c}!linemonitor_exception@{linemonitor\_\-exception}}
\index{linemonitor_exception@{linemonitor\_\-exception}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}linemonitor\_\-exception (char $\ast$ {\em server}, int {\em port}, int {\em type})}\label{guirobot_8c_a15}


Exception function for the {\bf linemonitor}() {\rm (p.\,\pageref{libcomm_8c_a20})}, print exception code and its meaning on the screen and take further action if necessary.

See API of {\bf linemonitor}() {\rm (p.\,\pageref{libcomm_8c_a20})}. \index{guirobot.c@{guirobot.c}!main@{main}}
\index{main@{main}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em argc}, char $\ast$ {\em argv}[$\,$])}\label{guirobot_8c_a18}


test0001sockts: see test0001sockts.c.



\subsection{Variable Documentation}
\index{guirobot.c@{guirobot.c}!da_global@{da\_\-global}}
\index{da_global@{da\_\-global}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Gtk\-Widget$\ast$ da\_\-global}\label{guirobot_8c_a1}


\index{guirobot.c@{guirobot.c}!gr_application@{gr\_\-application}}
\index{gr_application@{gr\_\-application}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Gtk\-Widget$\ast$ gr\_\-application}\label{guirobot_8c_a0}


\index{guirobot.c@{guirobot.c}!hard_msec@{hard\_\-msec}}
\index{hard_msec@{hard\_\-msec}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int hard\_\-msec}\label{guirobot_8c_a5}


\index{guirobot.c@{guirobot.c}!robot_x@{robot\_\-x}}
\index{robot_x@{robot\_\-x}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int robot\_\-x = 50}\label{guirobot_8c_a2}


\index{guirobot.c@{guirobot.c}!robot_y@{robot\_\-y}}
\index{robot_y@{robot\_\-y}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int robot\_\-y = 0}\label{guirobot_8c_a3}


\index{guirobot.c@{guirobot.c}!serverport@{serverport}}
\index{serverport@{serverport}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int serverport}\label{guirobot_8c_a8}


\index{guirobot.c@{guirobot.c}!shut_down@{shut\_\-down}}
\index{shut_down@{shut\_\-down}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int shut\_\-down}\label{guirobot_8c_a7}


\index{guirobot.c@{guirobot.c}!soft_msec@{soft\_\-msec}}
\index{soft_msec@{soft\_\-msec}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int soft\_\-msec}\label{guirobot_8c_a4}


\index{guirobot.c@{guirobot.c}!wait_msec@{wait\_\-msec}}
\index{wait_msec@{wait\_\-msec}!guirobot.c@{guirobot.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int wait\_\-msec}\label{guirobot_8c_a6}


