1 |
#include "StdAfx.h" |
//#ifdef _MSC_VER |
2 |
#include ".\slipserial.h" |
#include "stdafx.h" |
3 |
|
//#endif |
4 |
|
|
5 |
|
#include "SlipSerial.h" |
6 |
|
|
7 |
#include <iomanip> |
#include <iomanip> |
8 |
|
|
19 |
#define SLIP_ESCAPED_ESC 221 |
#define SLIP_ESCAPED_ESC 221 |
20 |
|
|
21 |
|
|
22 |
CSlipSerial::CSlipSerial(char* port, int bitrate) |
CSlipSerial::CSlipSerial(char* port, Baudrate bitrate) |
23 |
: CSerial(port,bitrate) |
: CSerial(port,bitrate) |
24 |
{ |
{ |
25 |
} |
} |
42 |
|
|
43 |
while ( /*bytesReady() >0 &&*/ state != SlipStopped) |
while ( /*bytesReady() >0 &&*/ state != SlipStopped) |
44 |
{ |
{ |
45 |
unsigned char data = readByte(); |
int c = readByte(); |
46 |
|
if (c == -1) |
47 |
|
{ |
48 |
|
Sleep(1); |
49 |
|
continue; |
50 |
|
} |
51 |
|
unsigned char data = (unsigned char) c; |
52 |
switch (state) |
switch (state) |
53 |
{ |
{ |
54 |
case SlipNormal: |
case SlipNormal: |
114 |
} |
} |
115 |
else |
else |
116 |
writeByte( out ); |
writeByte( out ); |
|
} |
|
117 |
|
} |