My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
OptCam.h
Go to the documentation of this file.
1 #ifndef OPTCAM_H
2 #define OPTCAM_H
3 
11 #include <string>
12 #include <sys/time.h>
13 #include <sys/types.h>
14 #include <unistd.h>
15 #include <sys/ioctl.h> // Needed for FIONBIO
16 
17 #include "gcp/control/code/unix/libunix_src/common/optcam.h"
18 #include "gcp/control/code/unix/libunix_src/common/netbuf.h"
19 
20 #include "gcp/util/common/Exception.h"
21 #include "gcp/util/common/GenericTask.h"
22 #include "gcp/util/common/NetReadStr.h"
23 #include "gcp/util/common/NetSendStr.h"
24 
25 #include "gcp/mediator/specific/OptCamMsg.h"
26 
27 namespace gcp {
28 namespace mediator {
29 
34  class Master;
35 
40  class OptCam :
41  public gcp::util::GenericTask<OptCamMsg> {
42 
43  public:
44 
48  ~OptCam();
49 
53  bool isConnected();
54 
55  private:
56 
60  friend class Master;
61 
65  Master* master_;
66 
71  int fd_;
72 
76  fd_set read_fds_;
77 
81  fd_set write_fds_;
82 
86  int fd_set_size_;
87 
91  std::string host_;
92 
96  bool connected_;
97 
101  bool ready_;
102 
106  gcp::util::NetReadStr* nrs_;
107 
112  gcp::util::NetSendStr* nss_;
113 
118  signed actual_[3];
119 
124  signed expected_[3];
125 
126  unsigned int utc_[2];
131  unsigned char* image_net_buffer_;
132 
137  unsigned short* image_;
138 
143  OptCam(Master* master);
144 
149  void registerReadFd(int fd);
150 
155  void registerWriteFd(int fd);
156 
161  void clearFromReadFd(int fd);
162 
167  void clearFromWriteFd(int fd);
168 
178  void readCommand();
179 
183  void fillImage();
184 
190  void sendImage();
191 
195  bool connect();
196 
200  void disconnect();
201 
205  void run();
206 
207  void processMsg(OptCamMsg* taskMsg);
208 
209  }; // End class OptCam
210 
211 
212 } // End namespace mediator
213 } // End namespace gcp
214 
215 #endif // End #ifndef
Definition: NetSendStr.h:30
~OptCam()
Definition: OptCam.cc:74
Definition: Master.h:64
Definition: OptCamMsg.h:16
Definition: OptCam.h:40
bool isConnected()
Definition: OptCam.cc:326
Definition: NetReadStr.h:30
Definition: GenericTask.h:33