/[H9]/trunk/FlisServer/Serial.h
ViewVC logotype

Annotation of /trunk/FlisServer/Serial.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (hide annotations) (download)
Tue Nov 27 15:26:42 2007 UTC (16 years, 6 months ago) by kevin
File MIME type: text/plain
File size: 833 byte(s)
added FlisServer to the project - containing the server software
1 kevin 70 /*
2     * Serial.h & Serial.cpp - (C) 2007 by Torben H. Nielsen
3     *
4     * A wrapper class for communicating with a serial port
5     */
6    
7     #pragma once
8    
9     #include <vector>
10    
11     typedef std::vector<unsigned char> UCVector;
12    
13     class CSerial
14     {
15     HANDLE mComport;
16     DCB mDcbRestore;
17     CString mPortstr;
18     int mBitrate;
19     bool mIsopen;
20    
21     protected:
22     void printByte(char* description, unsigned char byte);
23     void open();
24    
25     public:
26     CSerial();
27     CSerial(char* port, int bitrate);
28     ~CSerial(void);
29    
30     void close();
31     void open(CString port, int bitrate);
32    
33     unsigned char readByte();
34     void writeByte(unsigned char out);
35    
36    
37     COMSTAT getComstat() const;
38     int bytesReady() const;
39     int outQueueSize() const;
40     CString getPort() const {return mPortstr;}
41     int getBitrate() const {return mBitrate;}
42    
43     bool isOpen() { return mIsopen; }
44    
45     };

  ViewVC Help
Powered by ViewVC 1.1.20