9 |
#include <vector> |
#include <vector> |
10 |
#include <string> |
#include <string> |
11 |
#include <stdexcept> |
#include <stdexcept> |
|
typedef std::vector<unsigned char> UCVector; |
|
12 |
|
|
13 |
#ifndef _MSC_VER // |
#ifndef _MSC_VER // |
14 |
inline void Sleep(int x) { usleep(x*1000);} |
inline void Sleep(int x) { usleep(x*1000);} |
57 |
int readByte(); |
int readByte(); |
58 |
void writeByte(unsigned char out); |
void writeByte(unsigned char out); |
59 |
|
|
60 |
|
void writeBytes(unsigned char* buf, unsigned int len); |
61 |
|
int readBytes(unsigned char* buf, unsigned int maxLen); |
62 |
|
|
63 |
#ifdef _MSC_VER |
#ifdef _MSC_VER |
64 |
COMSTAT getComstat() const; |
COMSTAT getComstat() const; |
65 |
#endif |
#endif |
70 |
|
|
71 |
bool isOpen() { return mIsopen; } |
bool isOpen() { return mIsopen; } |
72 |
|
|
|
//void writeBytes(UCVector out); |
|
|
//UCVector readBytes(int maxcount); |
|
73 |
protected: |
protected: |
74 |
|
|
75 |
void printByte(char* description, unsigned char byte); |
void printByte(char* description, unsigned char byte); |
76 |
int convertBaudrate(Baudrate rate); |
int convertBaudrate(Baudrate rate); |
77 |
|
|
78 |
#ifdef _MSC_VER |
#ifdef _MSC_VER |
79 |
void openWindows(); |
void openWindows(); |
80 |
|
int readBytesWindows(unsigned char*buf, unsigned int maxLen); |
81 |
|
void writeBytesWindows(unsigned char* buf, unsigned int len); |
82 |
#else |
#else |
83 |
void openLinux(); |
void openLinux(); |
84 |
|
int readBytesLinux(unsigned char* buf, unsigned int maxLen); |
85 |
|
void writeBytesLinux(unsigned char* buf, unsigned int len); |
86 |
#endif |
#endif |
87 |
}; |
}; |