diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d7f7eb3dbc..c6cc15f875 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,17 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-09-11 14:58 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbwin/hbwin.h + + contrib/hbwin/tests/testcom1.prg + + contrib/hbwin/tests/testcom2.prg + * contrib/hbwin/tests/testprt1.prg + - contrib/hbwin/tests/testprt2.prg + * contrib/hbwin/win_tcom.prg + * contrib/hbwin/win_com.c + ! Tests synced with lib. + * Formatting. + 2009-09-11 14:38 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/Makefile - contrib/hbwin/win_tprt.prg diff --git a/harbour/contrib/hbwin/hbwin.h b/harbour/contrib/hbwin/hbwin.h index fc999b9dce..060b326f8a 100644 --- a/harbour/contrib/hbwin/hbwin.h +++ b/harbour/contrib/hbwin/hbwin.h @@ -3,11 +3,11 @@ */ /* - * xHarbour Project source code: + * Harbour Project source code: * Windows communications library * - * Copyright 2005 Alex Strickland - * www - http://www.xharbour.org + * Copyright 2005-2009 Alex Strickland + * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,9 +59,9 @@ #define FCNCLOSEHANDLE 7 #define FCNWRITEFILE 8 #define FCNREADFILE 9 -#define FCNGETCOMMMODEMSTATUS 10 /* WinPort:Status() */ +#define FCNGETCOMMMODEMSTATUS 10 /* win_com:Status() */ #define FCNPURGECOMM 11 -#define FCNCLEARCOMMERROR 12 /* WinPort:QueueStatus() */ +#define FCNCLEARCOMMERROR 12 /* win_com:QueueStatus() */ #define ESCAPECOMMFUNCTION 13 #define FCNGETCOMMPROPERTIES 14 #define FCNMAX 14 diff --git a/harbour/contrib/hbwin/tests/testprt1.prg b/harbour/contrib/hbwin/tests/testcom1.prg similarity index 67% rename from harbour/contrib/hbwin/tests/testprt1.prg rename to harbour/contrib/hbwin/tests/testcom1.prg index 3a6385e42b..fc693873a6 100644 --- a/harbour/contrib/hbwin/tests/testprt1.prg +++ b/harbour/contrib/hbwin/tests/testcom1.prg @@ -3,11 +3,11 @@ */ /* - * xHarbour Project source code: + * Harbour Project source code: * Windows communications library * - * Copyright 2005 Alex Strickland - * www - http://www.xharbour.org + * Copyright 2005-2009 Alex Strickland + * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,32 +52,32 @@ #include "hbwin.ch" -procedure main(cPortName) +PROCEDURE Main( cPortName ) - local oWinPort := Win_Port():Init(cPortName, CBR_9600, NOPARITY, 8, ONESTOPBIT) - local cString := "ATE0" + chr(13) + "ATI3" + chr(13) - local nResult + LOCAL oWinPort := win_Com():Init( cPortName, CBR_9600, NOPARITY, 8, ONESTOPBIT ) + LOCAL cString := "ATE0" + Chr( 13 ) + "ATI3" + Chr( 13 ) + LOCAL nResult - if !oWinPort:Open() - ? "Open() failed :", oWinPort:Error() - else - ? "Open() succeeded" - ? - if oWinPort:SetDTR(.t.) - ? "SetDTR(.t.) succeeded" - else - ? "SetDTR(.t.) failed :", oWinPort:Error() - endif - if (nResult := oWinPort:Write(cString)) == len(cString) - ? "Write() succeeded" - else - ? "Write() failed, returned ", nResult, " expected ", len(cString) - endif - ? "Scan something... we'll not read it but purge it, press enter" - inkey(0) - ? "Read() ", oWinPort:Read(@cString, 32), len(cString), cString - ? oWinPort:Error() - ? "Close", oWinPort:Close() - endif + IF ! oWinPort:Open() + ? "Open() failed :", oWinPort:Error() + ELSE + ? "Open() succeeded" + ? + IF oWinPort:SetDTR( .T. ) + ? "SetDTR( .T. ) succeeded" + ELSE + ? "SetDTR( .T. ) failed :", oWinPort:Error() + ENDIF + IF ( nResult := oWinPort:Write( cString ) ) == Len( cString ) + ? "Write() succeeded" + ELSE + ? "Write() failed, returned ", nResult, " expected ", Len(cString) + ENDIF + ? "Scan something... we'll not read it but purge it, press enter" + Inkey( 0 ) + ? "Read() ", oWinPort:Read( @cString, 32 ), Len( cString ), cString + ? oWinPort:Error() + ? "Close", oWinPort:Close() + ENDIF -return + RETURN diff --git a/harbour/contrib/hbwin/tests/testcom2.prg b/harbour/contrib/hbwin/tests/testcom2.prg new file mode 100644 index 0000000000..295793a8e2 --- /dev/null +++ b/harbour/contrib/hbwin/tests/testcom2.prg @@ -0,0 +1,246 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Windows communications library + * + * Copyright 2005-2009 Alex Strickland + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status o such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbwin.ch" + +PROCEDURE Main( cPortName ) + + LOCAL oWinPort + LOCAL cString := Space( 32 ) + LOCAL lCTS, lDSR, lRing, lDCD + LOCAL lCTSHold, lDSRHold, lDCDHold, lXoffHold, lXoffSent, nInQueue, nOutQueue + LOCAL nResult + + IF Empty( cPortName ) + ? "Usage : winport portname" + RETURN + ENDIF + + ? "Attach a scanner now ..." + ? + Inkey( 0 ) + + oWinPort := win_Com():Init( cPortName, CBR_9600, ODDPARITY, 7, ONESTOPBIT ) + IF ! oWinPort:Open() + ? "Open() failed :", oWinPort:Error() + ELSE + ? "Open() succeeded" + ? + IF oWinPort:Status( @lCTS, @lDSR, @lRing, @lDCD ) + ? "Status() succeeded : CTS ", lCTS, ", DSR ", lDSR, ", Ring ", lRing, ", DCD ", lDCD + ELSE + ? "Status() failed :", oWinPort:Error() + ENDIF + ? + ? "Testing DTR, configure a scanner to require DTR" + ? "Scan something... and press enter (shouldn't scan)" + Inkey( 0 ) + ? "Read() ", oWinPort:Read( @cString, 32 ), Len( cString ), cString + ? + IF oWinPort:SetDTR( .T. ) + ? "SetDTR( .T. ) succeeded" + ELSE + ? "SetDTR( .T. ) failed :", oWinPort:Error() + ENDIF + ? "Scan something... and press enter (read should work)" + Inkey( 0 ) + ? + IF oWinPort:QueueStatus( @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue ) + ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; + ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue + ELSE + ? "QueueStatus() failed :", oWinPort:Error() + ENDIF + ? + ? "Read() ", oWinPort:Read( @cString, 32 ), Len( cString ), cString + ? + IF oWinPort:QueueStatus( @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue ) + ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; + ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue + ELSE + ? "QueueStatus() failed :", oWinPort:Error() + ENDIF + ? + IF oWinPort:RTSFlow( RTS_CONTROL_HANDSHAKE ) + ? "RTSFlow( RTS_CONTROL_HANDSHAKE ) succeeded" + ELSE + ? "RTSFlow( RTS_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() + ENDIF + ? oWinPort:DebugDCB(WPDBGFLOW) + IF oWinPort:SetRTS( .F. ) + ? "SetRTS( .F. ) succeeded (it shouldn't according to docs!)" + ELSE + ? "SetRTS( .F. ) failed (it should) :", oWinPort:Error() + ENDIF + ? + IF oWinPort:RTSFlow( RTS_CONTROL_DISABLE ) + ? "RTSFlow( RTS_CONTROL_DISABLE ) succeeded" + ELSE + ? "RTSFlow( RTS_CONTROL_DISABLE ) failed :", oWinPort:Error() + ENDIF + ? oWinPort:DebugDCB( WPDBGFLOW ) + IF oWinPort:SetRTS( .F. ) + ? "SetRTS( .F. ) succeeded (it should)" + ELSE + ? "SetRTS( .F. ) failed :", oWinPort:Error() + ENDIF + ? + ? "Scan something... we'll not read it but purge it, press enter" + Inkey( 0 ) + IF oWinPort:QueueStatus( @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue ) + ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; + ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue + ELSE + ? "QueueStatus() failed :", oWinPort:Error() + ENDIF + IF oWinPort:Purge( .T., .T. ) + ? "Purge() succeeded" + ELSE + ? "Purge() failed :", oWinPort:Error() + ENDIF + ? "InQueue should be zero" + IF oWinPort:QueueStatus( @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue ) + ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; + ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue + ELSE + ? "QueueStatus() failed :", oWinPort:Error() + ENDIF + ? + ? "Read ", oWinPort:Read( @cString, 32 ), Len( cString ), cString + ? + ? "Close", oWinPort:Close() + ENDIF + + ? + ? "This is going to fail, so no device needed" + Inkey( 0 ) + + oWinPort := WinPort():Init( cPortName, CBR_9600, NOPARITY, 99, ONESTOPBIT ) + IF !oWinPort:Open + ? "Open() failed :", oWinPort:Error() + ELSE + ? "Open succeeded" + ? "Close", oWinPort:Close() + ENDIF + + ? "Attach a printer now ..." + ? + Inkey( 0 ) + + oWinPort := WinPort():Init( cPortName, CBR_9600, NOPARITY, 8, ONESTOPBIT ) + IF ! oWinPort:Open + ? "Open() failed :", oWinPort:Error() + ELSE + ? "Open succeeded" + ? + ? oWinPort:DebugDCB( WPDBGFLOW ) + ? "Printers will probably have CTS, DSR and DCD high, IF they are off they'll all be low" + IF oWinPort:Status( @lCTS, @lDSR, @lRing, @lDCD ) + ? "Status() succeeded : CTS ", lCTS, ", DSR ", lDSR, ", Ring ", lRing, ", DCD ", lDCD + ELSE + ? "Status() failed :", oWinPort:Error() + ENDIF + ? + + ? "With no flow control the write should succeed whether printer is on or off" + cString := "this is a test string " + Replicate( "012356789", 30 ) + Chr( 13 ) + Chr( 10 ) + IF ( nResult := oWinPort:Write( cString ) ) == Len( cString ) + ? "Write() succeeded" + ELSE + ? "Write() failed, returned ", nResult, " expected ", Len( cString ) + ENDIF + IF oWinPort:QueueStatus( @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue ) + ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; + ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue + ELSE + ? "QueueStatus() failed :", oWinPort:Error() + ENDIF + + ? + ? "Switch all handshaking on (normally only hardware and RTS)" + IF oWinPort:RTSFlow( DTR_CONTROL_HANDSHAKE ) + ? "RTSFlow( RTS_CONTROL_HANDSHAKE ) succeeded" + ELSE + ? "RTSFlow( RTS_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() + ENDIF + IF oWinPort:DTRFlow( DTR_CONTROL_HANDSHAKE ) + ? "DTRFlow( DTR_CONTROL_HANDSHAKE ) succeeded" + ELSE + ? "DTRFlow( DTR_CONTROL_HANDSHAKE ) failed :", oWinPort:Error() + ENDIF + IF oWinPort:XonXoffFlow( .T. ) + ? "XonXoffFlow( .T. ) ", oWinPort:XonXoffFlow( .T. ) + ELSE + ? "XonXoffFlow( .T. ) failed :", oWinPort:Error() + ENDIF + ? + ? oWinPort:DebugDCB( WPDBGFLOW ) + + ? "If it's on then no Hold status should be on, IF off then probably CTS and DSR" + IF oWinPort:QueueStatus( @lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue ) + ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; + ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue + ELSE + ? "QueueStatus() failed :", oWinPort:Error() + ENDIF + ? + ? Seconds() + IF ( nResult := oWinPort:Write( cString ) ) == Len( cString ) + ? "Write() succeeded" + ELSE + ? "Write() failed, returned ", nResult, " expected ", Len( cString ) + ENDIF + ? Seconds() + ? "Close", oWinPort:Close() + ENDIF + + RETURN diff --git a/harbour/contrib/hbwin/tests/testprt2.prg b/harbour/contrib/hbwin/tests/testprt2.prg deleted file mode 100644 index 85cecf426d..0000000000 --- a/harbour/contrib/hbwin/tests/testprt2.prg +++ /dev/null @@ -1,246 +0,0 @@ -/* - * $Id$ - */ - -/* - * xHarbour Project source code: - * Windows communications library - * - * Copyright 2005 Alex Strickland - * www - http://www.xharbour.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status o such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - */ - -#include "hbwin.ch" - -procedure main(cPortName) - - local oWinPort - local cString := space(32) - local lCTS, lDSR, lRing, lDCD - local lCTSHold, lDSRHold, lDCDHold, lXoffHold, lXoffSent, nInQueue, nOutQueue - local nResult - - if empty(cPortName) - ? "Usage : winport portname" - return - endif - - ? "Attach a scanner now ..." - ? - inkey(0) - - oWinPort := Win_Port():Init(cPortName, CBR_9600, ODDPARITY, 7, ONESTOPBIT) - if !oWinPort:Open() - ? "Open() failed :", oWinPort:Error() - else - ? "Open() succeeded" - ? - if oWinPort:Status(@lCTS, @lDSR, @lRing, @lDCD) - ? "Status() succeeded : CTS ", lCTS, ", DSR ", lDSR, ", Ring ", lRing, ", DCD ", lDCD - else - ? "Status() failed :", oWinPort:Error() - endif - ? - ? "Testing DTR, configure a scanner to require DTR" - ? "Scan something... and press enter (shouldn't scan)" - inkey(0) - ? "Read() ", oWinPort:Read(@cString, 32), len(cString), cString - ? - if oWinPort:SetDTR(.t.) - ? "SetDTR(.t.) succeeded" - else - ? "SetDTR(.t.) failed :", oWinPort:Error() - endif - ? "Scan something... and press enter (read should work)" - inkey(0) - ? - if oWinPort:QueueStatus(@lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue) - ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; - ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue - else - ? "QueueStatus() failed :", oWinPort:Error() - endif - ? - ? "Read() ", oWinPort:Read(@cString, 32), len(cString), cString - ? - if oWinPort:QueueStatus(@lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue) - ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; - ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue - else - ? "QueueStatus() failed :", oWinPort:Error() - endif - ? - if oWinPort:RTSFlow(RTS_CONTROL_HANDSHAKE) - ? "RTSFlow(RTS_CONTROL_HANDSHAKE) succeeded" - else - ? "RTSFlow(RTS_CONTROL_HANDSHAKE) failed :", oWinPort:Error() - endif - ? oWinPort:DebugDCB(WPDBGFLOW) - if oWinPort:SetRTS(.f.) - ? "SetRTS(.f.) succeeded (it shouldn't according to docs!)" - else - ? "SetRTS(.f.) failed (it should) :", oWinPort:Error() - endif - ? - if oWinPort:RTSFlow(RTS_CONTROL_DISABLE) - ? "RTSFlow(RTS_CONTROL_DISABLE) succeeded" - else - ? "RTSFlow(RTS_CONTROL_DISABLE) failed :", oWinPort:Error() - endif - ? oWinPort:DebugDCB(WPDBGFLOW) - if oWinPort:SetRTS(.f.) - ? "SetRTS(.f.) succeeded (it should)" - else - ? "SetRTS(.f.) failed :", oWinPort:Error() - endif - ? - ? "Scan something... we'll not read it but purge it, press enter" - inkey(0) - if oWinPort:QueueStatus(@lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue) - ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; - ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue - else - ? "QueueStatus() failed :", oWinPort:Error() - endif - if oWinPort:Purge(.t., .t.) - ? "Purge() succeeded" - else - ? "Purge() failed :", oWinPort:Error() - endif - ? "InQueue should be zero" - if oWinPort:QueueStatus(@lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue) - ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; - ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue - else - ? "QueueStatus() failed :", oWinPort:Error() - endif - ? - ? "Read ", oWinPort:Read(@cString, 32), len(cString), cString - ? - ? "Close", oWinPort:Close() - endif - - ? - ? "This is going to fail, so no device needed" - inkey(0) - - oWinPort := WinPort():Init(cPortName, CBR_9600, NOPARITY, 99, ONESTOPBIT) - if !oWinPort:Open - ? "Open() failed :", oWinPort:Error() - else - ? "Open succeeded" - ? "Close", oWinPort:Close() - endif - - ? "Attach a printer now ..." - ? - inkey(0) - - oWinPort := WinPort():Init(cPortName, CBR_9600, NOPARITY, 8, ONESTOPBIT) - if !oWinPort:Open - ? "Open() failed :", oWinPort:Error() - else - ? "Open succeeded" - ? - ? oWinPort:DebugDCB(WPDBGFLOW) - ? "Printers will probably have CTS, DSR and DCD high, if they are off they'll all be low" - if oWinPort:Status(@lCTS, @lDSR, @lRing, @lDCD) - ? "Status() succeeded : CTS ", lCTS, ", DSR ", lDSR, ", Ring ", lRing, ", DCD ", lDCD - else - ? "Status() failed :", oWinPort:Error() - endif - ? - - ? "With no flow control the write should succeed whether printer is on or off" - cString := "this is a test string " + replicate("012356789", 30) + chr(13) + chr(10) - if (nResult := oWinPort:Write(cString)) == len(cString) - ? "Write() succeeded" - else - ? "Write() failed, returned ", nResult, " expected ", len(cString) - endif - if oWinPort:QueueStatus(@lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue) - ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; - ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue - else - ? "QueueStatus() failed :", oWinPort:Error() - endif - - ? - ? "Switch all handshaking on (normally only hardware and RTS)" - if oWinPort:RTSFlow(DTR_CONTROL_HANDSHAKE) - ? "RTSFlow(RTS_CONTROL_HANDSHAKE) succeeded" - else - ? "RTSFlow(RTS_CONTROL_HANDSHAKE) failed :", oWinPort:Error() - endif - if oWinPort:DTRFlow(DTR_CONTROL_HANDSHAKE) - ? "DTRFlow(DTR_CONTROL_HANDSHAKE) succeeded" - else - ? "DTRFlow(DTR_CONTROL_HANDSHAKE) failed :", oWinPort:Error() - endif - if oWinPort:XonXoffFlow(.t.) - ? "XonXoffFlow(.t.) ", oWinPort:XonXoffFlow(.t.) - else - ? "XonXoffFlow(.t.) failed :", oWinPort:Error() - endif - ? - ? oWinPort:DebugDCB(WPDBGFLOW) - - ? "If it's on then no Hold status should be on, if off then probably CTS and DSR" - if oWinPort:QueueStatus(@lCTSHold, @lDSRHold, @lDCDHold, @lXoffHold, @lXoffSent, @nInQueue, @nOutQueue) - ? "QueueStatus() : CTSHold", lCtsHold, ", DSRHold", lDsrHold, ", DCDHold", lDCDHold, ", XoffHold", lXoffHold, ; - ", Xoff Sent ", lXoffSent, ", InQueue ", nInQueue, ", nOutQueue ", nOutQueue - else - ? "QueueStatus() failed :", oWinPort:Error() - endif - ? - ? seconds() - if (nResult := oWinPort:Write(cString)) == len(cString) - ? "Write() succeeded" - else - ? "Write() failed, returned ", nResult, " expected ", len(cString) - endif - ? seconds() - ? "Close", oWinPort:Close() - endif - -return diff --git a/harbour/contrib/hbwin/win_com.c b/harbour/contrib/hbwin/win_com.c index bef1be6f71..cd30c38223 100644 --- a/harbour/contrib/hbwin/win_com.c +++ b/harbour/contrib/hbwin/win_com.c @@ -3,7 +3,7 @@ */ /* - * xHarbour Project source code: + * Harbour Project source code: * Windows communications library * * Copyright 2005-2009 Alex Strickland diff --git a/harbour/contrib/hbwin/win_tcom.prg b/harbour/contrib/hbwin/win_tcom.prg index b23b1c5b4d..3ccbf5b178 100644 --- a/harbour/contrib/hbwin/win_tcom.prg +++ b/harbour/contrib/hbwin/win_tcom.prg @@ -3,7 +3,7 @@ */ /* - * xHarbour Project source code: + * Harbour Project source code: * Windows communications library * * Copyright 2005-2009 Alex Strickland