areaDetector  3-5-0
EPICS areaDetector framework
cl_com_port2.h
Go to the documentation of this file.
1 
10 /*
11  * Include files.
12  */
13 #include <windows.h>
14 
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string>
18 #include "time.h"
19 #include "comportInterface.h"
20 #include "ccd_exception.h"
21 #include "logfile.h"
22 /*
23  * Double incluson protection.
24  */
25 #ifndef _CL_COM_PORT_H
26 #define _CL_COM_PORT_H
27 
28 /*
29  * Class for
30  */
31 
32 class cl_com_port : public comportInterface {
33  public:
34  cl_com_port(char *name,log_file *lf_);
35  ~cl_com_port();
36  /*
37  * ports we can write to
38  */
39 
40  virtual void open(void);
41  virtual void open(int baud, int parity, int nbits, int nstop);
42 
43  virtual void open(int baud, int parity, int nbits, int nstop, int rdtimeout);
44 
45  virtual void write(unsigned char *buffer, int length);
46  virtual void read(unsigned char *buffer, int length);
47  virtual void write(unsigned char c);
48  virtual unsigned char read(void);
49  virtual void close(void);
50  virtual void flush(void);
51  virtual void clearPipe();
52 
53  virtual void setPortName(char *n);
54 
55  virtual void wait(int us);
56 
57  // for timing things. call tic. toc returns time in s since last tic.
58  virtual void tic();
59  virtual double toc();
60 
61  protected:
62  bool is_open;
63 
65 
66  char INBUFFER[500];
67 
68  char OUTBUFFER[20];
69 
70  DWORD bytes_read; // Number of bytes read from port
71 
72  DWORD bytes_written; // Number of bytes written to the port
73 
74  HANDLE comport; // Handle COM port
75 
76  int bStatus;
77 
78  DCB comSettings; // Contains various port settings
79 
80  COMMTIMEOUTS CommTimeouts;
81 
82  char port_name[64];
84 };
85 
86 #endif
virtual unsigned char read(void)
Class for general serial port.
Definition: cl_com_port2.h:32
log_file * lf
Definition: cl_com_port2.h:83
char port_name[64]
Definition: cl_com_port2.h:82
Interface to a com port, on a grabber.
Definition: comportInterface.h:24
name
Definition: makeDbAndEdl.py:232
double elapsedtime
Definition: cl_com_port2.h:64
virtual double toc()
virtual void clearPipe()
HANDLE comport
Definition: cl_com_port2.h:74
int bStatus
Definition: cl_com_port2.h:76
COMMTIMEOUTS CommTimeouts
Definition: cl_com_port2.h:80
bool is_open
Definition: cl_com_port2.h:62
virtual void close(void)
virtual void open(void)
cl_com_port(char *name, log_file *lf_)
double currenttime
Definition: cl_com_port2.h:64
virtual void setPortName(char *n)
Class LOG_FILE.
Definition: logfile.h:38
char OUTBUFFER[20]
Definition: cl_com_port2.h:68
virtual void wait(int us)
virtual void write(unsigned char *buffer, int length)
DWORD bytes_read
Definition: cl_com_port2.h:70
char INBUFFER[500]
Definition: cl_com_port2.h:66
DWORD bytes_written
Definition: cl_com_port2.h:72
virtual void tic()
virtual void flush(void)
DCB comSettings
Definition: cl_com_port2.h:78
#define DWORD
Definition: pco_structures.h:443