CommManager.h
Go to the documentation of this file.
00001 #ifndef COMM_MANAGER_H
00002 #define COMM_MANAGER_H
00003 
00004 #include <pthread.h>
00005 #include <list>
00006 #include "../libSock/Socket.h"
00007 #include "Datagram.h"
00008 #include "DgmQueue.h"
00009 
00010 //#define CM_CARE_FOR_REPLY
00011 
00012 class CommManager
00013 {
00014         protected :
00015                 bool terminate;
00016                 Socket * sock;
00017                 DgmQueue Q;
00018                 pthread_t in_thread;
00019                 pthread_mutex_t sockmtx;
00020 
00021                 unsigned int verbose;
00022                 friend void * commmanager_inthread(void *);
00023                 void run();
00024                 bool sendInitSeq();
00025                 bool reconnect();
00026 
00027                 std::vector<Datagram> init_seq;
00028 #ifdef CM_CARE_FOR_REPLY
00029                 std::vector<Datagram> init_reply;
00030 #endif
00031 
00032         public :
00033                 CommManager(const char * initseq_filename = NULL);
00034                 ~CommManager();
00035 
00036                 bool open(const char * hostname, unsigned int port);
00037                 bool close();
00038 
00039                 bool send(Datagram & dgm);
00040                 bool wait(unsigned char id, Datagram & dgm, double timeout=1.0);
00041 
00042                 bool addToReceptionField(unsigned char id);
00043                 bool removeFromReceptionField(unsigned char id);
00044                 bool resetReceptionField();
00045 
00046                 void setVerboseLevel(unsigned int v); 
00047 };
00048 
00049 
00050 
00051 
00052 
00053 #endif


canon_vbc50i
Author(s): Cedric Pradalier
autogenerated on Sun Oct 5 2014 23:47:45