/[H7]/trunk/H7 Server/Serial.h
ViewVC logotype

Annotation of /trunk/H7 Server/Serial.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 36 - (hide annotations) (download)
Thu Feb 1 09:21:43 2007 UTC (17 years, 4 months ago) by hedin
File MIME type: text/plain
File size: 833 byte(s)
GUI fix, and a few "features"
1 torben 23 /*
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 hedin 36 void open();
24    
25 torben 23 public:
26     CSerial();
27     CSerial(char* port, int bitrate);
28     ~CSerial(void);
29    
30     void close();
31 hedin 34 void open(CString port, int bitrate);
32 torben 23
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