rllib  1
rlcanopendaemon.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           rlcanopen.cpp  -  description
00003                              -------------------
00004     begin     : Tue March 03 2004
00005     copyright : (C) 2004 by Marc Bräutigam, Christian Wilmes, Rainer Lehrig
00006     email     : lehrig@t-online.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as        *
00013  *   published by the Free Software Foundation                             *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef DAEMON
00017 #define DAEMON
00018 
00019 #include <stdio.h>
00020 #include <stdlib.h>
00021 #include <string.h>
00022 #include "rlthread.h"
00023 #include "rlcutil.h"
00024 #include "rlsocket.h"
00025 #include "rlwthread.h"
00026 #include "rlcanopen.h"
00027 
00028 
00029   enum rl_msg {
00030     MSG_SEND      = 0,
00031     MSG_RECEIVE   = 1,
00032     MSG_SDO_READ = 0,
00033     MSG_SDO_WRITE = 1,
00034     MSG_PDO_RECEIVE = 3,
00035     MSG_CONNECT = 5,
00036     MSG_DISCONNECT = 6,
00037     MSG_PDO_TRANSMIT = 4,
00038     MSG_NMT_TRANSMIT = 7,
00039     MSG_RESTART_BOARD = 8,
00040     MSG_GET_NODE_STATE = 9
00041   };
00042 
00043 
00045 
00051 class rlCanOpenDaemon{
00052   public:
00053   
00057   rlCanOpenDaemon();                                
00058   
00062   rlCanOpenDaemon(int _port, char* _iniFileName=0);
00063   
00065   ~rlCanOpenDaemon();
00066   
00068   int getPort();                      
00069   
00073   void start();
00074   
00076   rlCanOpen* nodes;                                                             
00077   
00081   rlThread daemon_thread;  
00082 
00083   private:
00084   int port;
00085 
00086 };
00087 
00088 // parameter struct for passing parameters to handler thread
00089 struct THREADTRANSFER
00090 {
00091   int socketdescr; // socket descriptor identifying the new connection
00092   rlCanOpenDaemon* daemonptr; // pointer to daemon object
00093 };
00094 
00095 
00096 
00097 
00098 
00099 
00100 #endif