2010-06-07 11:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbtpathy/Makefile
  * contrib/hbtpathy/hbtpathy.hbp
  * contrib/hbtpathy/hbtpathy.hbc
  * contrib/hbtpathy/telepath.ch
  - contrib/hbtpathy/tpcommon.c
  - contrib/hbtpathy/tpwin.c
  - contrib/hbtpathy/tpos2.c
  - contrib/hbtpathy/tpunix.c
  - contrib/hbtpathy/tpdos.c
  * contrib/hbtpathy/telepath.prg
    * Changed to use hbct lib COM functions.
    * Changed some misc functions to .prg from .c.
    - Deleted all .c files.
    ; NO GUARANTEES. PLEASE TEST AND REVIEW IT. All my testing
      was to make sure the lib and test app builds properly.

  * contrib/hbtpathy/tests/testtp.prg
    * Formatting.
This commit is contained in:
Viktor Szakats
2010-06-07 09:56:55 +00:00
parent b0c8a35e2d
commit 4a32694328
12 changed files with 129 additions and 1118 deletions

View File

@@ -17,6 +17,26 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-06-07 11:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbtpathy/Makefile
* contrib/hbtpathy/hbtpathy.hbp
* contrib/hbtpathy/hbtpathy.hbc
* contrib/hbtpathy/telepath.ch
- contrib/hbtpathy/tpcommon.c
- contrib/hbtpathy/tpwin.c
- contrib/hbtpathy/tpos2.c
- contrib/hbtpathy/tpunix.c
- contrib/hbtpathy/tpdos.c
* contrib/hbtpathy/telepath.prg
* Changed to use hbct lib COM functions.
* Changed some misc functions to .prg from .c.
- Deleted all .c files.
; NO GUARANTEES. PLEASE TEST AND REVIEW IT. All my testing
was to make sure the lib and test app builds properly.
* contrib/hbtpathy/tests/testtp.prg
* Formatting.
2010-06-06 22:29 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* external/minizip/ioapi.h
! Fixed for watcom compilers (turned off 64-bit file IO)

View File

@@ -8,13 +8,6 @@ include $(TOP)$(ROOT)config/global.mk
LIBNAME := hbtpathy
C_SOURCES := \
tpcommon.c \
tpunix.c \
tpwin.c \
tpos2.c \
tpdos.c \
PRG_SOURCES := \
telepath.prg \

View File

@@ -5,3 +5,5 @@
incpaths=.
libs=${hb_name}
libs=../hbct/hbct.hbc

View File

@@ -10,10 +10,4 @@
-w3 -es2
tpcommon.c
tpunix.c
tpwin.c
tpos2.c
tpdos.c
telepath.prg

View File

@@ -53,8 +53,6 @@
#ifndef TELEPATH_CH_
#define TELEPATH_CH_
/* NOTE: This file is also used by C code. */
#define TP_MAXPORTS 8
/* Error code definitions */

View File

@@ -8,7 +8,8 @@
*
* Copyright 2000, 2001 Dan Levitt <dan@boba-fett.net>
* Copyright 2004, 2005 Maurilio Longo <maurilio.longo@libero.it>
* www - http://www.xharbour.org
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
* www - http://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
@@ -57,9 +58,7 @@
so you can always retrieve them (see CVS docs on how to)
*/
#include "common.ch"
#include "fileio.ch"
#include "telepath.ch"
@@ -80,7 +79,9 @@ THREAD STATIC t_nErrorCode := 0 // Error code from last operation, 0 if no
FUNCTION tp_baud( nPort, nNewBaud )
DEFAULT nNewBaud TO 0
IF ! ISNUMBER( nNewBaud )
nNewBaud := 0
ENDIF
IF ! isport( nPort ) .OR. Empty( t_aPorts[ nPort, TPFP_NAME ] )
RETURN TE_NOPORT
@@ -91,12 +92,7 @@ FUNCTION tp_baud( nPort, nNewBaud )
ENDIF
IF nNewBaud > 0
IF __tp_InitPortSpeed( t_aPorts[ nPort, TPFP_HANDLE ] ,;
nNewBaud,;
t_aPorts[ nPort, TPFP_DBITS ] ,;
t_aPorts[ nPort, TPFP_PARITY ] ,;
t_aPorts[ nPort, TPFP_SBITS ] ) == 0
IF com_Init( t_aPorts[ nPort, TPFP_HANDLE ], nNewBaud, t_aPorts[ nPort, TPFP_PARITY ], t_aPorts[ nPort, TPFP_DBITS ], t_aPorts[ nPort, TPFP_SBITS ] )
t_aPorts[ nPort, TPFP_BAUD ] := nNewBaud
ELSE
// set error code
@@ -117,7 +113,9 @@ FUNCTION tp_idle( lNewval )
PROCEDURE tp_delay( nTime )
DEFAULT nTime TO 0
IF ! ISNUMBER( nTime )
nTime := 0
ENDIF
IF nTime < 0
RETURN
@@ -131,7 +129,9 @@ PROCEDURE tp_delay( nTime )
FUNCTION tp_close( nPort, nTimeout )
DEFAULT nTimeout TO 0
IF ! ISNUMBER( nTimeout )
nTimeout := 0
ENDIF
/* Clipper returns 0 even if a port is not open */
IF ! isopenport( nPort )
@@ -144,7 +144,7 @@ FUNCTION tp_close( nPort, nTimeout )
IF t_aPorts[ nPort, TPFP_HANDLE ] >= 0
FClose( t_aPorts[ nPort, TPFP_HANDLE ] )
com_Close( t_aPorts[ nPort, TPFP_HANDLE ] )
/* Port parameters should stay the same for the case the port
gets reopened
@@ -174,50 +174,32 @@ FUNCTION tp_reopen( nPort, nInSize, nOutSize )
FUNCTION tp_open( nPort, nInSize, nOutSize, nBaud, nData, cParity, nStop, cPortname )
LOCAL nRes
#if defined( __PLATFORM__UNIX )
LOCAL lPortExist
LOCAL nFileCase
LOCAL nDirCase
#endif
DEFAULT nInSize TO 1536
DEFAULT nOutSize TO 1536
DEFAULT nBaud TO 1200
DEFAULT nData TO 8
DEFAULT cParity TO "N"
DEFAULT nStop TO 1
/* Serial ports name are made up of cPortName + nPort if nPort is not NIL */
#if defined( __PLATFORM__UNIX )
DEFAULT cPortName TO "/dev/ttyS" + iif( ISNUMBER( nPort ), hb_ntos( nPort - 1 ), "" )
#else
IF hb_osIsWinNT()
DEFAULT cPortName TO "\\.\COM" + iif( ISNUMBER( nPort ), hb_ntos( nPort ), "" )
ELSE
DEFAULT cPortName TO "COM" + iif( ISNUMBER( nPort ), hb_ntos( nPort ), "" )
ENDIF
#endif
#if defined( __PLATFORM__UNIX )
nFileCase := Set( _SET_FILECASE, 0 )
nDirCase := Set( _SET_DIRCASE, 0 )
lPortExist := File( cPortname ) /* Must be File(), hb_FileExists() won't work */
Set( _SET_FILECASE, nFileCase )
Set( _SET_DIRCASE, nDirCase )
IF ! lPortExist
RETURN TE_NOPORT
ENDIF
#endif
IF ! isport( nPort )
RETURN TE_NOPORT
ENDIF
IF ! ISNUMBER( nInSize )
nInSize := 1536
ENDIF
IF ! ISNUMBER( nOutSize )
nOutSize := 1536
ENDIF
IF ! ISNUMBER( nBaud )
nBaud := 1200
ENDIF
IF ! ISNUMBER( nData )
nData := 8
ENDIF
IF ! ISCHARACTER( cParity )
cParity := "N"
ENDIF
IF ! ISNUMBER( nStop )
nStop := 1
ENDIF
IF ISCHARACTER( cPortname )
com_DevName( nPort, cPortname )
ENDIF
t_aPorts[ nPort, TPFP_NAME ] := cPortname
t_aPorts[ nPort, TPFP_BAUD ] := nBaud
t_aPorts[ nPort, TPFP_DBITS ] := nData
@@ -226,34 +208,21 @@ FUNCTION tp_open( nPort, nInSize, nOutSize, nBaud, nData, cParity, nStop, cPortn
t_aPorts[ nPort, TPFP_OC ] := .F.
t_aPorts[ nPort, TPFP_INBUF ] := ""
t_aPorts[ nPort, TPFP_INBUF_SIZE ] := nInSize
t_aPorts[ nPort, TPFP_HANDLE ] := -1
// Maybe we should have a __tp_Open() on every platform
#if defined( __PLATFORM__UNIX )
t_aPorts[ nPort, TPFP_HANDLE ] := __tp_Open( cPortname )
#else
t_aPorts[ nPort, TPFP_HANDLE ] := FOpen( cPortname, FO_READWRITE ) // FO_EXCLUSIVE
#endif
IF com_Open( nPort )
IF t_aPorts[ nPort, TPFP_HANDLE ] != F_ERROR
/* low level C functions are prefixed __tp_ */
IF ( nRes := __tp_InitPortSpeed( t_aPorts[ nPort, TPFP_HANDLE ] ,;
t_aPorts[ nPort, TPFP_BAUD ] ,;
t_aPorts[ nPort, TPFP_DBITS ] ,;
t_aPorts[ nPort, TPFP_PARITY ] ,;
t_aPorts[ nPort, TPFP_SBITS ] ) ) == 0
t_aPorts[ nPort, TPFP_HANDLE ] := nPort
IF com_Init( t_aPorts[ nPort, TPFP_HANDLE ], t_aPorts[ nPort, TPFP_BAUD ], t_aPorts[ nPort, TPFP_PARITY ], t_aPorts[ nPort, TPFP_DBITS ], t_aPorts[ nPort, TPFP_SBITS ] )
t_aPorts[ nPort, TPFP_OC ] := .T.
RETURN nRes
RETURN 0
ELSE
tp_Close( t_aPorts[ nPort, TPFP_HANDLE ] )
RETURN nRes
RETURN TE_PARAM
ENDIF
ENDIF
// set error code to a static var to have tp_error() work as expected
//cnHandle := FError()
t_aPorts[ nPort, TPFP_NAME ] := ""
t_aPorts[ nPort, TPFP_HANDLE ] := -1
t_aPorts[ nPort, TPFP_BAUD ] := 1200
@@ -264,15 +233,19 @@ FUNCTION tp_open( nPort, nInSize, nOutSize, nBaud, nData, cParity, nStop, cPortn
t_aPorts[ nPort, TPFP_INBUF ] := ""
t_aPorts[ nPort, TPFP_INBUF_SIZE ] := 0
RETURN TE_CONFL // maybe should return something different?
RETURN TE_CONFL /* maybe should return something different? */
FUNCTION tp_recv( nPort, nLength, nTimeout )
LOCAL nDone
LOCAL cRet
DEFAULT nLength TO t_aPorts[ nPort, TPFP_INBUF_SIZE ]
DEFAULT nTimeout TO 0
IF ! ISNUMBER( nLength )
nLength := t_aPorts[ nPort, TPFP_INBUF_SIZE ]
ENDIF
IF ! ISNUMBER( nTimeout )
nTimeout := 0
ENDIF
FetchChars( nPort )
@@ -302,8 +275,12 @@ FUNCTION tp_send( nPort, cString, nTimeout )
LOCAL nWritten, nTotWritten, nDone
DEFAULT cString TO ""
DEFAULT nTimeout TO 0
IF ! ISCHARACTER( cString )
cString := ""
ENDIF
IF ! ISNUMBER( nTimeout )
nTimeout := 0
ENDIF
IF ! isopenport( nPort )
RETURN 0
@@ -319,7 +296,7 @@ FUNCTION tp_send( nPort, cString, nTimeout )
DO WHILE nTotWritten < Len( cString ) .AND. ;
( nTimeout < 0 .OR. Seconds() <= nDone )
nWritten := __tp_WritePort( t_aPorts[ nPort, TPFP_HANDLE ], SubStr( cString, nTotWritten + 1 ) )
nWritten := com_send( t_aPorts[ nPort, TPFP_HANDLE ], SubStr( cString, nTotWritten + 1 ) )
IF nWritten >= 0
@@ -343,8 +320,12 @@ FUNCTION tp_send( nPort, cString, nTimeout )
FUNCTION tp_sendsub( nPort, cString, nStart, nLength, nTimeout )
DEFAULT nStart TO 1
DEFAULT nLength TO Len( cString )
IF ! ISNUMBER( nStart )
nStart := 1
ENDIF
IF ! ISNUMBER( nLength )
nLength := Len( cString )
ENDIF
RETURN tp_send( nPort, SubStr( cString, nStart, nLength ), nTimeout )
@@ -364,8 +345,12 @@ FUNCTION tp_recvto( nPort, cDelim, nMaxlen, nTimeout )
RETURN ""
ENDIF
DEFAULT nMaxlen TO 64999 /* dos telepathy def. on xharbour could be higher */
DEFAULT nTimeout TO 0
IF ! ISNUMBER( nMaxlen )
nMaxlen := 64999 /* dos telepathy def. on xharbour could be higher */
ENDIF
IF ! ISNUMBER( nTimeout )
nTimeout := 0
ENDIF
FetchChars( nPort )
@@ -511,8 +496,12 @@ FUNCTION tp_waitfor( ... )
RETURN 0
ENDIF
// DEFAULT nTimeout TO -1
// DEFAULT lIgnorecase TO .F.
// IF ! ISNUMBER( nTimeout )
// nTimeout := -1
// ENDIF
// IF ! ISLOGICAL( lIgnorecase )
// lIgnorecase := .F.
// ENDIF
/*
@@ -612,7 +601,7 @@ FUNCTION tp_isdcd( nPort )
RETURN .F.
ENDIF
RETURN __tp_isdcd( t_aPorts[ nPort, TPFP_HANDLE ] )
RETURN com_DCD( t_aPorts[ nPort, TPFP_HANDLE ] )
FUNCTION tp_isri( nPort )
@@ -620,7 +609,7 @@ FUNCTION tp_isri( nPort )
RETURN .F.
ENDIF
RETURN __tp_isri( t_aPorts[ nPort, TPFP_HANDLE ] )
RETURN com_Ring( t_aPorts[ nPort, TPFP_HANDLE ] )
FUNCTION tp_isdsr( nPort )
@@ -628,7 +617,7 @@ FUNCTION tp_isdsr( nPort )
RETURN .F.
ENDIF
RETURN __tp_isdsr( t_aPorts[ nPort, TPFP_HANDLE ] )
RETURN com_DSR( t_aPorts[ nPort, TPFP_HANDLE ] )
FUNCTION tp_iscts( nPort )
@@ -636,42 +625,15 @@ FUNCTION tp_iscts( nPort )
RETURN .F.
ENDIF
RETURN __tp_iscts( t_aPorts[ nPort, TPFP_HANDLE ] )
#if defined( __PLATFORM__UNIX )
// NB: On linux i don't know how to make a drain with a timeout, so here
// I'll wait as long as it takes to drain the port.
FUNCTION tp_flush( nPort, nTimeout )
//LOCAL nStart := Seconds()
LOCAL nRes
DEFAULT nTimeout TO 0
IF ! isopenport( nPort )
RETURN TE_CLOSED
ENDIF
nRes := __tp_drain( t_aPorts[ nPort, TPFP_HANDLE ] )
// Sleep rest of timeout
/*
IF nTimeout > 0 .AND. Seconds() - nStart < nTimeout
hb_idleSleep( nTimeout - ( Seconds() - nStart ) )
ENDIF
*/
// NB: returns timeout on error trying to reach compatibility with other platforms
// to be tested
RETURN iif( nRes == 0, 0, TE_TMOUT )
#else
RETURN com_CTS( t_aPorts[ nPort, TPFP_HANDLE ] )
FUNCTION tp_flush( nPort, nTimeout )
LOCAL nDone
DEFAULT nTimeout TO -1
IF ! ISNUMBER( nTimeout )
nTimeout := -1
ENDIF
IF ! isopenport( nPort )
RETURN TE_CLOSED
@@ -689,7 +651,6 @@ FUNCTION tp_flush( nPort, nTimeout )
ENDDO
RETURN iif( tp_OutFree( nPort ) > 0, TE_TMOUT, 0 )
#endif
/*
@@ -733,7 +694,7 @@ STATIC FUNCTION FetchChars( nPort )
RETURN 0
ENDIF
cStr := __tp_ReadPort( t_aPorts[ nPort, TPFP_HANDLE ] )
cStr := com_read( t_aPorts[ nPort, TPFP_HANDLE ] )
IF Len( cStr ) > 0
t_aPorts[ nPort, TPFP_INBUF ] += cStr
@@ -806,3 +767,27 @@ FUNCTION tp_debug( nDebugLevel, cString )
PROCEDURE tp_uninstall()
/* NOTE: dummy function, solely for compatibility. */
RETURN
STATIC FUNCTION __TP_INFREE()
RETURN -1
STATIC FUNCTION __TP_OUTFREE()
RETURN -1
STATIC FUNCTION __TP_CTRLCTS( nPort, nValue )
RETURN com_Hard( nPort, iif( ISNUMBER( nValue ), nValue != 0, NIL ), .F. )
STATIC FUNCTION __TP_CTRLDTR( nPort, nValue )
RETURN com_Hard( nPort, iif( ISNUMBER( nValue ), nValue != 0, NIL ), .T. )
FUNCTION BIN_AND( ... )
RETURN HB_BITAND( ... )
FUNCTION BIN_OR( ... )
RETURN HB_BITOR( ... )
FUNCTION BIN_XOR( ... )
RETURN HB_BITXOR( ... )
FUNCTION BIN_NOT( ... )
RETURN HB_BITNOT( ... )

View File

@@ -66,11 +66,11 @@
com port.
*/
function main
PROCEDURE Main()
? tp_open( 1,,, 9600, 8, "N", 1 )
tp_send( 1, "Hi there Bob", 1 ) // One second timeout
tp_inkey( .5 )
? tp_recv( 1 )
?
tp_Close( 1 )
return nil
RETURN

View File

@@ -1,81 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Telepathy emulation library
*
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
* www - http://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 of 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 "hbapi.h"
HB_FUNC_EXTERN( HB_BITAND );
HB_FUNC( BIN_AND )
{
HB_FUNC_EXEC( HB_BITAND );
}
HB_FUNC_EXTERN( HB_BITOR );
HB_FUNC( BIN_OR )
{
HB_FUNC_EXEC( HB_BITOR );
}
HB_FUNC_EXTERN( HB_BITXOR );
HB_FUNC( BIN_XOR )
{
HB_FUNC_EXEC( HB_BITXOR );
}
HB_FUNC_EXTERN( HB_BITNOT );
HB_FUNC( BIN_NOT )
{
HB_FUNC_EXEC( HB_BITNOT );
}

View File

@@ -1,99 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Telepathy emulation library (DOS low-level - stubs)
*
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
* www - http://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 of 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 "hbapi.h"
#if defined( HB_OS_DOS )
#include "telepath.ch"
HB_FUNC( __TP_INITPORTSPEED )
{
}
HB_FUNC( __TP_READPORT )
{
}
HB_FUNC( __TP_WRITEPORT )
{
}
HB_FUNC( __TP_INFREE )
{
}
HB_FUNC( __TP_OUTFREE )
{
}
HB_FUNC( __TP_CTRLCTS )
{
}
HB_FUNC( __TP_ISDCD )
{
}
HB_FUNC( __TP_ISRI )
{
}
HB_FUNC( __TP_ISDSR )
{
}
HB_FUNC( __TP_ISCTS )
{
}
#endif /* HB_OS_DOS */

View File

@@ -1,237 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Telepathy emulation library
* C low level module for OS/2 serial communication
*
* Copyright 2004 - Maurilio Longo <maurilio.longo@libero.it>
* www - http://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 of 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 "hbapi.h"
#include "hbapiitm.h"
#include "hbapifs.h"
#if defined( HB_OS_OS2 )
#include "telepath.ch"
#define INCL_BASE
#define INCL_DOS
#define INCL_DOSERROR
#define INCL_DOSDEVICES
#define INCL_DOSDEVIOCTL
#include <os2.h>
HB_FUNC( __TP_INITPORTSPEED )
{
LINECONTROL lctl;
DCBINFO dcb;
USHORT Baud = ( USHORT ) hb_parnl( 2 );
const char * ptr = hb_parcx( 4 );
memset( &dcb, 0, sizeof( dcb ) );
memset( &lctl, 0, sizeof( lctl ) );
/* OS/2 has Mark and Space parity options */
switch( *ptr )
{
case 'N':
case 'n':
lctl.bParity = 0;
break;
case 'O':
case 'o':
lctl.bParity = 1;
break;
case 'E':
case 'e':
lctl.bParity = 2;
break;
case 'M':
case 'm':
lctl.bParity = 3;
break;
case 'S':
case 's':
lctl.bParity = 4;
}
lctl.bDataBits = hb_parnl( 3 );
lctl.bStopBits = hb_parnl( 5 ) == 1 ? 0 : hb_parnl( 5 ); /* 1 == 1.5 stop bits only valid with 5 data bits */
lctl.fTransBreak = 0;
if( DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_SETBAUDRATE, &Baud,
sizeof( USHORT ), NULL, NULL, 0L, NULL ) == NO_ERROR )
{
if( DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_SETLINECTRL,
&lctl, sizeof( LINECONTROL ), NULL, NULL, 0L, NULL ) == NO_ERROR )
{
/* tp_ help says: on port open
DTR ON (value 1)
CTS OFF
DCD IGNORE
DSR OFF
RTS ON (value 1)
XON/XOFF OFF
*/
dcb.fbCtlHndShake = MODE_DTR_HANDSHAKE | MODE_RTS_HANDSHAKE;
/* 0x20 == full duplex */
dcb.fbFlowReplace = MODE_RTS_HANDSHAKE | 0x20;
dcb.fbTimeout = MODE_NO_WRITE_TIMEOUT | MODE_NOWAIT_READ_TIMEOUT;
if( DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_SETDCBINFO, &dcb,
sizeof(DCBINFO), 0L, NULL, 0L, NULL ) == NO_ERROR )
hb_retnl( 0 );
else
hb_retnl( -3 );
}
else
hb_retnl( -2 );
}
else
hb_retnl( -1 );
}
HB_FUNC( __TP_READPORT )
{
char Buffer[ 512 ];
ULONG nRead = 0;
APIRET rc = DosRead( ( HFILE ) hb_parnl( 1 ), Buffer, sizeof( Buffer ), &nRead );
hb_retclen( rc == NO_ERROR ? Buffer : NULL, nRead );
}
HB_FUNC( __TP_WRITEPORT )
{
ULONG nWritten = 0;
APIRET rc = DosWrite( ( HFILE ) hb_parnl( 1 ), ( void * ) hb_parcx( 2 ), hb_parclen( 2 ), &nWritten );
hb_retnl( rc == NO_ERROR ? ( long ) nWritten : -1 ); /* Put GetLastError() on error, or better a second byref param? */
}
HB_FUNC( __TP_INFREE )
{
APIRET rc;
RXQUEUE rxqueue;
memset( &rxqueue, 0, sizeof( rxqueue ) );
if( ( rc = DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_GETINQUECOUNT,
NULL, 0L, NULL, &rxqueue, sizeof( RXQUEUE ), NULL ) ) == NO_ERROR )
hb_retnl( rxqueue.cb - rxqueue.cch );
else
hb_retnl( -1 ); /* Put GetLastError() here, or better a second byref param? */
}
HB_FUNC( __TP_OUTFREE )
{
APIRET rc;
RXQUEUE rxqueue;
memset( &rxqueue, 0, sizeof( rxqueue ) );
if( ( rc = DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_GETOUTQUECOUNT,
NULL, 0L, NULL, &rxqueue, sizeof( RXQUEUE ), NULL ) ) == NO_ERROR )
hb_retnl( rxqueue.cb - rxqueue.cch );
else
hb_retnl( -1 ); /* Put GetLastError() here, or better a second byref param? */
}
HB_FUNC( __TP_ISDCD )
{
BYTE instat;
/* if DosDevIOCtl() returns an error, return no DCD */
if( DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_GETMODEMINPUT,
NULL, 0, NULL, &instat, sizeof( instat ), NULL ) == NO_ERROR )
hb_retl( ( instat & DCD_ON ) == DCD_ON );
else
hb_retl( HB_FALSE );
}
HB_FUNC( __TP_ISRI )
{
BYTE instat;
if( DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_GETMODEMINPUT,
NULL, 0, NULL, &instat, sizeof( instat ), NULL ) == NO_ERROR )
hb_retl( ( instat & RI_ON ) == RI_ON );
else
hb_retl( HB_FALSE );
}
HB_FUNC( __TP_ISDSR )
{
BYTE instat;
if( DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_GETMODEMINPUT,
NULL, 0, NULL, &instat, sizeof( instat ), NULL ) == NO_ERROR )
hb_retl( ( instat & DSR_ON ) == DSR_ON );
else
hb_retl( HB_FALSE );
}
HB_FUNC( __TP_ISCTS )
{
BYTE instat;
if( DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_GETMODEMINPUT,
NULL, 0, NULL, &instat, sizeof( instat ), NULL ) == NO_ERROR )
hb_retl( ( instat & CTS_ON ) == CTS_ON );
else
hb_retl( HB_FALSE );
}
HB_FUNC( __TP_CTRLCTS )
{
hb_retni( 0 );
}
#endif /* HB_OS_OS2 */

View File

@@ -1,365 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Telepathy emulation library
* C low level module for *nix serial communication
*
* Copyright 2005 - Maurilio Longo <maurilio.longo@libero.it>
* www - http://harbour-project.org
*
* Lots of code from http://www.easysw.com/~mike/serial/serial.html
*
* 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 of 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 "hbapi.h"
#include "hbapiitm.h"
#include "hbapifs.h"
#if defined( HB_OS_UNIX )
#include "telepath.ch"
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
HB_FUNC( __TP_OPEN )
{
int fd = open( hb_parcx( 1 ), O_RDWR | O_NOCTTY | O_NDELAY ); /* File descriptor for the port */
if( fd != -1 )
fcntl( fd, F_SETFL, 0 );
hb_retnl( fd );
}
/*
p_InitPortSpeed( aPorts[ nPort, TPFP_HANDLE ] ,;
aPorts[ nPort, TPFP_BAUD ] ,;
aPorts[ nPort, TPFP_DBITS ] ,;
aPorts[ nPort, TPFP_PARITY ] ,;
aPorts[ nPort, TPFP_SBITS ] )
*/
HB_FUNC( __TP_INITPORTSPEED )
{
struct termios options;
int port = hb_parnl( 1 );
int baud = B300;
const char * ptr = hb_parcx( 4 );
int rc;
tcgetattr( port, &options );
/* let's set baud rate */
switch( hb_parnl( 2 ) )
{
case 0: baud = B0; break; /* Drop line */
case 50: baud = B50; break;
case 75: baud = B75; break;
case 110: baud = B110; break;
case 150: baud = B150; break;
case 200: baud = B200; break;
case 300: baud = B300; break;
case 600: baud = B600; break;
case 1200: baud = B1200; break;
case 1800: baud = B1800; break;
case 2400: baud = B2400; break;
case 4800: baud = B4800; break;
case 9600: baud = B9600; break;
case 19200: baud = B19200; break;
case 38400: baud = B38400; break;
#if defined( B57600 )
case 57600: baud = B57600; break;
#endif
#if defined( B115200 )
case 115200: baud = B115200; break;
#endif
#if defined( B230400 )
case 230400: baud = B230400; break;
#endif
#ifdef B460800
case 460800: baud = B460800; break;
#endif
#ifdef B500000
case 500000: baud = B500000; break;
#endif
#ifdef B576000
case 576000: baud = B576000; break;
#endif
#ifdef B921600
case 921600: baud = B921600; break;
#endif
}
cfsetispeed( &options, baud );
cfsetospeed( &options, baud );
/* Enable the receiver and set local mode... */
options.c_cflag |= ( CLOCAL | CREAD );
#if defined( cfmakeraw )
/* Raw input from device */
cfmakeraw( &options );
#else
options.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP | \
INLCR | IGNCR | ICRNL | IXON );
options.c_oflag &= ~OPOST;
options.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
options.c_cflag &= ~( CSIZE | PARENB );
options.c_cflag |= CS8;
#endif
/* Reset data bits ( cfmakeraw() puts it to CS8 ) */
options.c_cflag &= ~CSIZE;
/* Data bits */
if( hb_parni( 3 ) == 8 )
options.c_cflag |= CS8;
else
options.c_cflag |= CS7;
/* Stop bits */
if( hb_parni( 5 ) == 1 )
options.c_cflag &= ~CSTOPB;
/* Parity, only No, Even, Odd supported */
switch ( *ptr )
{
case 'N':
case 'n':
options.c_cflag &= ~PARENB;
options.c_iflag &= ~(INPCK); /* disable input parity checking */
break;
case 'O':
case 'o':
options.c_cflag |= PARENB;
options.c_cflag |= PARODD;
options.c_iflag |= INPCK;
break;
case 'E':
case 'e':
options.c_cflag |= PARENB;
options.c_cflag &= ~PARODD;
options.c_iflag |= INPCK;
break;
}
/* Every read() call returns as soon as a char is available OR after 3 tenths of a second */
options.c_cc[ VMIN ] = 0;
options.c_cc[ VTIME ] = 3;
/* Set the new options for the port... */
rc = tcsetattr( port, TCSAFLUSH, &options );
hb_retnl( rc );
}
HB_FUNC( __TP_READPORT )
{
char Buffer[ 512 ];
int nRead = read( hb_parnl( 1 ), Buffer, sizeof( Buffer ) );
hb_retclen( nRead > 0 ? Buffer : NULL, nRead );
}
HB_FUNC( __TP_WRITEPORT )
{
long n = write( hb_parnl( 1 ), hb_parcx( 2 ), hb_parclen( 2 ) );
hb_retnl( n < 0 ? -1 : n );
}
HB_FUNC( __TP_DRAIN )
{
hb_retnl( tcdrain( hb_parnl( 1 ) ) );
}
HB_FUNC( __TP_INFREE )
{
hb_retnl( -1 );
}
HB_FUNC( __TP_OUTFREE )
{
#if 0
APIRET rc;
RXQUEUE rxqueue = { 0 };
if ( ( rc = DosDevIOCtl( ( HFILE ) hb_parnl( 1 ), IOCTL_ASYNC, ASYNC_GETOUTQUECOUNT,
NULL, 0L, NULL, &rxqueue, sizeof( RXQUEUE ), NULL ) ) == NO_ERROR )
hb_retnl( rxqueue.cb - rxqueue.cch );
else
hb_retnl( -1 ); /* Put GetLastError() here, or better a second byref param? */
#endif
}
HB_FUNC( __TP_ISDCD )
{
#if defined( TIOCMGET )
int status;
if ( ioctl( hb_parnl( 1 ), TIOCMGET, &status ) == 0 )
hb_retl( ( status & TIOCM_CD ) == TIOCM_CD );
else
#endif
hb_retl( HB_FALSE );
}
HB_FUNC( __TP_ISRI )
{
#if defined( TIOCMGET )
int status;
if ( ioctl( hb_parnl( 1 ), TIOCMGET, &status ) == 0 )
hb_retl( ( status & TIOCM_RI ) == TIOCM_RI );
else
#endif
hb_retl( HB_FALSE );
}
HB_FUNC( __TP_ISDSR )
{
#if defined( TIOCMGET )
int status;
if ( ioctl( hb_parnl( 1 ), TIOCMGET, &status ) == 0 )
hb_retl( ( status & TIOCM_DSR ) == TIOCM_DSR );
else
#endif
hb_retl( HB_FALSE );
}
HB_FUNC( __TP_ISCTS )
{
#if defined( TIOCMGET )
int status;
if ( ioctl( hb_parnl( 1 ), TIOCMGET, &status ) == 0 )
hb_retl( ( status & TIOCM_CTS ) == TIOCM_CTS );
else
#endif
hb_retl( HB_FALSE );
}
#if ! defined( CRTSCTS )
/* if you find compiler which does not support it then please check
* if such flow control is supported. If yes then check exact value
* for this switch on given OS and define it only for this compiler
* and OS
*/
#if defined( HB_OS_LINUX ) && defined( __WATCOMC__ )
#define CRTSCTS 020000000000
#endif
#endif
HB_FUNC( __TP_CTRLCTS )
{
#if defined( CRTSCTS )
struct termios options;
int port = hb_parnl( 1 );
int newvalue = hb_pcount() == 2 ? hb_parnl( 2 ) : -1;
int curvalue;
int rc;
tcgetattr( port, &options );
curvalue = ( options.c_cflag & CRTSCTS ) == CRTSCTS;
if( newvalue == 0 )
options.c_cflag &= ~CRTSCTS;
else if( newvalue == 1 )
options.c_cflag |= CRTSCTS;
if( newvalue >= 0 )
rc = tcsetattr( port, TCSAFLUSH, &options );
hb_retni( curvalue ? 1 : 0 );
#else
int iTODO;
hb_retni( 0 );
#endif
}
#if 0
/* Inline function moved here from telepath.prg */
HB_FUNC( __TP_CTRLDTR )
{
double nph = hb_parnd( 1 );
double nnewval, noldval;
unsigned int result = 0;
ioctl( nph, TIOCMGET, &result );
if( result & TIOCM_DTR )
noldval = 1;
else
noldval = 0;
if( noldval != nnewval )
{
if( nnewval == 0 )
result &= ~TIOCM_DTR;
else
result |= TIOCM_DTR;
ioctl( nph, TIOCMSET, &result );
}
hb_stornd( nnewval, 2 );
hb_stornd( noldval, 3 );
}
#endif
#endif /* HB_OS_UNIX */

View File

@@ -1,199 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Telepathy emulation library
* C low level module for Windows serial communication
*
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
* Copyright 2004 Maurilio Longo <maurilio.longo@libero.it>
* www - http://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 of 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 "hbapi.h"
#include "hbapiitm.h"
#include "hbapifs.h"
#if defined( HB_OS_WIN )
#include <windows.h>
#include "telepath.ch"
HB_FUNC( __TP_INITPORTSPEED )
{
#if ! defined( HB_OS_WIN_CE )
DCB dcb;
char values[ 20 ];
LPTSTR lpValues;
FillMemory( &dcb, sizeof( dcb ), 0 );
dcb.DCBlength = sizeof( dcb );
hb_snprintf( values, sizeof( values ), "%lu,%1s,%1lu,%1lu", hb_parnl( 2 ), hb_parcx( 4 ), hb_parnl( 3 ), hb_parnl( 5 ) );
lpValues = HB_TCHAR_CONVTO( values );
if( BuildCommDCB( lpValues, &dcb ) )
{
if( SetCommState( ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 ), &dcb ) )
{
COMMTIMEOUTS timeouts;
/* read/write operations return immediatly */
timeouts.ReadIntervalTimeout = MAXDWORD;
timeouts.ReadTotalTimeoutMultiplier = 0;
timeouts.ReadTotalTimeoutConstant = 0;
timeouts.WriteTotalTimeoutMultiplier = 0;
timeouts.WriteTotalTimeoutConstant = 0;
hb_retnl( SetCommTimeouts( ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 ), &timeouts ) ? 0 : -1 );
}
else
hb_retnl( -1 );
}
else
hb_retnl( -1 );
HB_TCHAR_FREE( lpValues );
#else
hb_retnl( -1 );
#endif
}
HB_FUNC( __TP_READPORT )
{
char buffer[ 512 ];
DWORD nRead = 0;
OVERLAPPED Overlapped;
memset( &Overlapped, 0, sizeof( Overlapped ) );
if( ReadFile( ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 ), buffer, sizeof( buffer ), &nRead, &Overlapped ) )
hb_retclen( buffer, nRead );
else
hb_retc_null();
}
HB_FUNC( __TP_WRITEPORT )
{
DWORD nWritten = 0;
OVERLAPPED Overlapped;
memset( &Overlapped, 0, sizeof( Overlapped ) );
if( WriteFile( ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 ), hb_parcx( 2 ), hb_parclen( 2 ), &nWritten, &Overlapped ) )
hb_retnl( ( long ) nWritten ); /* Put GetLastError() on error, or better a second byref param? */
else
hb_retnl( -1 );
}
HB_FUNC( __TP_INFREE )
{
HANDLE hPort = ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 );
COMMPROP CommProp;
if( GetCommProperties( hPort, &CommProp ) )
{
COMSTAT ComStat;
if( ClearCommError( hPort, NULL, &ComStat ) && CommProp.dwCurrentRxQueue != 0 )
hb_retnl( CommProp.dwCurrentRxQueue - ComStat.cbInQue );
else
hb_retnl( -1 );
}
else
hb_retnl( -1 );
}
HB_FUNC( __TP_OUTFREE )
{
HANDLE hPort = ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 );
COMMPROP CommProp;
if( GetCommProperties( hPort, &CommProp ) )
{
COMSTAT ComStat;
if( ClearCommError( hPort, NULL, &ComStat ) && CommProp.dwCurrentTxQueue != 0 )
hb_retnl( CommProp.dwCurrentTxQueue - ComStat.cbOutQue );
else
hb_retnl( -1 );
}
else
hb_retnl( -1 );
}
HB_FUNC( __TP_CTRLCTS )
{
hb_retni( 0 ); /* dummy */
}
HB_FUNC( __TP_ISDCD )
{
DWORD dwModemStat = 0;
BOOL bRet = GetCommModemStatus( ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 ), &dwModemStat );
hb_retl( bRet ? ( dwModemStat & MS_RLSD_ON ) != 0 : HB_FALSE ); /* The RLSD (receive-line-signal-detect) signal is on. Also is DCD. */
}
HB_FUNC( __TP_ISRI )
{
DWORD dwModemStat = 0;
BOOL bRet = GetCommModemStatus( ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 ), &dwModemStat );
hb_retl( bRet ? ( dwModemStat & MS_RING_ON ) != 0 : HB_FALSE );
}
HB_FUNC( __TP_ISDSR )
{
DWORD dwModemStat = 0;
BOOL bRet = GetCommModemStatus( ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 ), &dwModemStat );
hb_retl( bRet ? ( dwModemStat & MS_DSR_ON ) != 0 : HB_FALSE );
}
HB_FUNC( __TP_ISCTS )
{
DWORD dwModemStat = 0;
BOOL bRet = GetCommModemStatus( ( HANDLE ) ( HB_PTRUINT ) hb_parnint( 1 ), &dwModemStat );
hb_retl( bRet ? ( dwModemStat & MS_CTS_ON ) != 0 : HB_FALSE );
}
#endif /* HB_OS_WIN */