--- a/SerialPort.st Thu Feb 02 18:29:11 2006 +0100
+++ b/SerialPort.st Fri Feb 03 12:19:41 2006 +0100
@@ -124,8 +124,8 @@
stopBitsType Symbol #stop1, #stop1_5 or #stop2
parityType Symbol #odd, #even or #none
dataBits Integer 5, 6, 7, 8
- inFlowCtrlType Symbol #xOnOff or #hardware
- outFlowCtrlType Symbol #xOnOff or #hardware
+ inFlowCtrlType Symbol #xOnOff, #hardware or #none
+ outFlowCtrlType Symbol #xOnOff, #hardware or #none
xOnChar Integer | Character
xOffChar' Integer | Character
"
@@ -179,12 +179,12 @@
"arguments are self describing; nil values mean: leave setting as is"
- ^ (self new
+ ^ self new
setPortName:portName
baudRate:baudRateOrNil stopBitsType:stopBitsTypeOrNil
parityType:parityTypeOrNil dataBits:dataBitsOrNil
inFlowCtrlType:inFlowCtrlTypeOrNil outFlowCtrlType:outFlowCtrlTypeOrNil
- xOnChar:xOnCharOrNil xOffChar:xOffCharOrNil) open
+ xOnChar:xOnCharOrNil xOffChar:xOffCharOrNil
! !
!SerialPort class methodsFor:'debugging'!
@@ -369,14 +369,15 @@
DCB dcb;
#endif /* WIN32 */
-# define XONOFF 1
-# define HARDWARE 2
-# define STOP1 1
-# define STOP2 2
-# define STOP1_5 3
-# define ODD 1
-# define EVEN 2
-# define NONE 3
+# define FLOW_XONOFF 1
+# define FLOW_HARDWARE 2
+# define FLOW_NONE 3
+# define STOP_1 1
+# define STOP_2 2
+# define STOP_1_5 3
+# define PARITY_ODD 1
+# define PARITY_EVEN 2
+# define PARITY_NONE 3
if (__isString(__INST(portName))) {
__portName = __stringVal(__INST(portName));
@@ -426,9 +427,11 @@
}
if (__INST(inFlowCtrlType) == @symbol(xOnOff)) {
- __inFlowCtrl = XONOFF;
+ __inFlowCtrl = FLOW_XONOFF;
} else if (__INST(inFlowCtrlType) == @symbol(hardware)) {
- __inFlowCtrl = HARDWARE;
+ __inFlowCtrl = FLOW_HARDWARE;
+ } else if (__INST(inFlowCtrlType) == @symbol(none)) {
+ __inFlowCtrl = FLOW_NONE;
} else if (__INST(inFlowCtrlType) == nil) {
__setInFlowCtrl = 0;
} else {
@@ -437,9 +440,11 @@
}
if (__INST(outFlowCtrlType) == @symbol(xOnOff)) {
- __outFlowCtrl = XONOFF;
+ __outFlowCtrl = FLOW_XONOFF;
} else if (__INST(outFlowCtrlType) == @symbol(hardware)) {
- __outFlowCtrl = HARDWARE;
+ __outFlowCtrl = FLOW_HARDWARE;
+ } else if (__INST(outFlowCtrlType) == @symbol(none)) {
+ __outFlowCtrl = FLOW_NONE;
} else if (__INST(outFlowCtrlType) == nil) {
__setOutFlowCtrl = 0;
} else {
@@ -448,11 +453,11 @@
}
if (__INST(stopBitsType) == @symbol(stop1)) {
- __stopBits = STOP1;
+ __stopBits = STOP_1;
} else if (__INST(stopBitsType) == @symbol(stop2)) {
- __stopBits = STOP2;
+ __stopBits = STOP_2;
} else if (__INST(stopBitsType) == @symbol(stop1_5)) {
- __stopBits = STOP1_5;
+ __stopBits = STOP_1_5;
} else if (__INST(stopBitsType) == nil) {
__setStopBits = 0;
} else {
@@ -461,11 +466,11 @@
}
if (__INST(parityType) == @symbol(odd)) {
- __parityType = ODD;
+ __parityType = PARITY_ODD;
} else if (__INST(parityType) == @symbol(even)) {
- __parityType = EVEN;
+ __parityType = PARITY_EVEN;
} else if (__INST(parityType) == @symbol(none)) {
- __parityType = NONE;
+ __parityType = PARITY_NONE;
} else if (__INST(parityType) == nil) {
__setParityType = 0;
} else {
@@ -517,9 +522,9 @@
if (__setStopBits) {
/* set stop bits */
switch(__stopBits) {
- case STOP1_5: dcb.StopBits = 1; break; /* 1.5 stop bits */
- case STOP1: dcb.StopBits = 0; break; /* 1 stop bit */
- case STOP2: dcb.StopBits = 2; break; /* 2 stop bits */
+ case STOP_1_5: dcb.StopBits = 1; break; /* 1.5 stop bits */
+ case STOP_1: dcb.StopBits = 0; break; /* 1 stop bit */
+ case STOP_2: dcb.StopBits = 2; break; /* 2 stop bits */
default:
errorSymbol = @symbol(stopBits);
goto errExit;
@@ -529,9 +534,9 @@
if (__setParityType) {
/* set parity */
switch(__parityType) {
- case NONE: dcb.Parity = NOPARITY; break;
- case ODD: dcb.Parity = ODDPARITY; break;
- case EVEN: dcb.Parity = EVENPARITY; break;
+ case PARITY_NONE: dcb.Parity = NOPARITY; break;
+ case PARITY_ODD: dcb.Parity = ODDPARITY; break;
+ case PARITY_EVEN: dcb.Parity = EVENPARITY; break;
default:
errorSymbol = @symbol(parityType);
goto errExit;
@@ -542,15 +547,15 @@
/* set control flow */
dcb.fInX = FALSE;
dcb.fDtrControl = FALSE;
- if (__inFlowCtrl == XONOFF) dcb.fInX = TRUE; /* XOn/XOff handshaking */
- if (__inFlowCtrl == HARDWARE) dcb.fDtrControl = TRUE; /* hardware handshaking */
+ if (__inFlowCtrl == FLOW_XONOFF) dcb.fInX = TRUE; /* XOn/XOff handshaking */
+ if (__inFlowCtrl == FLOW_HARDWARE) dcb.fDtrControl = TRUE; /* hardware handshaking */
}
if (__setOutFlowCtrl) {
dcb.fOutX = FALSE;
dcb.fOutxCtsFlow = FALSE;
- if (__outFlowCtrl == XONOFF) dcb.fOutX = TRUE; /* XOn/XOff handshaking */
- if (__outFlowCtrl == HARDWARE) dcb.fOutxCtsFlow = TRUE; /* hardware handshaking */
+ if (__outFlowCtrl == FLOW_XONOFF) dcb.fOutX = TRUE; /* XOn/XOff handshaking */
+ if (__outFlowCtrl == FLOW_HARDWARE) dcb.fOutxCtsFlow = TRUE; /* hardware handshaking */
}
if (! SetCommState(port, &dcb)) {
@@ -588,14 +593,15 @@
}
getOutOfhere: ;
-# undef XONOFF
-# undef HARDWARE
-# undef STOP1
-# undef STOP2
-# undef STOP1_5
-# undef ODD
-# undef EVEN
-# undef NONE
+# undef FLOW_XONOFF
+# undef FLOW_HARDWARE
+# undef FLOW_NONE
+# undef STOP_1
+# undef STOP_2
+# undef STOP_1_5
+# undef PARITY_ODD
+# undef PARITY_EVEN
+# undef PARITY_NONE
%}.
"all ok?"
@@ -629,5 +635,5 @@
!SerialPort class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/SerialPort.st,v 1.5 2006-02-02 17:29:11 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/SerialPort.st,v 1.6 2006-02-03 11:19:41 cg Exp $'
! !