05.11.2011 - stable version, 0.1.0, self-test program, work at GCC 2.95 - 4.5, VC 2010, MinGW, Linux, Windows, QNX
This commit is contained in:
36
piserial.h
36
piserial.h
@@ -4,23 +4,23 @@
|
||||
#include "pithread.h"
|
||||
#include "pistring.h"
|
||||
#ifndef WINDOWS
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
# include <termios.h>
|
||||
# include <fcntl.h>
|
||||
#else
|
||||
#define B110 110
|
||||
#define B300 300
|
||||
#define B600 600
|
||||
#define B1200 1200
|
||||
#define B2400 2400
|
||||
#define B4800 4800
|
||||
#define B9600 9600
|
||||
#define B14400 14400
|
||||
#define B19200 19200
|
||||
#define B38400 38400
|
||||
#define B57600 57600
|
||||
#define B115200 115200
|
||||
#define B128000 128000
|
||||
#define B256000 256000
|
||||
# define B110 110
|
||||
# define B300 300
|
||||
# define B600 600
|
||||
# define B1200 1200
|
||||
# define B2400 2400
|
||||
# define B4800 4800
|
||||
# define B9600 9600
|
||||
# define B14400 14400
|
||||
# define B19200 19200
|
||||
# define B38400 38400
|
||||
# define B57600 57600
|
||||
# define B115200 115200
|
||||
# define B128000 128000
|
||||
# define B256000 256000
|
||||
#endif
|
||||
|
||||
#define BUFFER_SIZE 4096
|
||||
@@ -64,6 +64,9 @@ public:
|
||||
bool init();
|
||||
bool initialized() const {return fd != -1;}
|
||||
void terminate();
|
||||
|
||||
PIByteArray lastHeader() {return mheader;}
|
||||
PIByteArray internalBuffer() {return PIByteArray(sbuffer, BUFFER_SIZE);}
|
||||
|
||||
private:
|
||||
int convertSpeed(PISerial::Speed speed);
|
||||
@@ -85,6 +88,7 @@ private:
|
||||
PIString devName;
|
||||
SerialFunc ret_func;
|
||||
char buffer[BUFFER_SIZE], sbuffer[BUFFER_SIZE], * hbuffer, * pbuffer;
|
||||
PIByteArray mheader;
|
||||
void * headerPtr, * data;
|
||||
int dataSize, headerSize, sbuffIndex, startIndex, backIndex;
|
||||
PIFlags<PISerial::Parameters> params;
|
||||
|
||||
Reference in New Issue
Block a user