+ harbour/src/rtl/hbcomhb.c
* harnour/src/rtl/Makefile
* harbour/include/hbextern.ch
+ added wrapper functions for Serial communication port API
The list of exported functions is:
HB_COMCLOSE( nPort ) --> lSuccess
HB_COMDISCARDCHAR( nPort, nChar | cChar ) --> lSuccess
HB_COMERRORCHAR( nPort, nChar | cChar ) --> lSuccess
HB_COMFLOWCHARS( nPort, nXONchar | cXONchar, nXOFFchar | cXOFFchar ) --> lSuccess
HB_COMFLOWCONTROL( nPort, @iValue, nFlow ) --> lSuccess
HB_COMFLOWSET( nPort, nFlow ) --> lSuccess
HB_COMFLUSH( nPort, [ nType = HB_COM_IOFLUSH ] ) --> lSuccess
HB_COMGETDEVICE( nPort ) --> cDeviceName
HB_COMGETERROR( nPort ) --> nError
HB_COMGETOSERROR( nPort ) --> nError
HB_COMINIT( nPort, nBaud, cParity, nSize, nStop ) --> lSuccess
HB_COMINPUTCOUNT( nPort ) --> nCount
HB_COMINPUTSTATE( nPort ) --> nState
HB_COMLASTNUM() --> nLastPortNumber
HB_COMLSR( nPort, @nValue ) --> lSuccess
HB_COMMCR( nPort, @nValue, nClear, nSet ) --> lSuccess
HB_COMMSR( nPort, @nValue ) --> lSuccess
HB_COMOPEN( nPort ) --> lSuccess
HB_COMOUTPUTCOUNT( nPort ) --> nCount
HB_COMOUTPUTSTATE( nPort ) --> nState
HB_COMSENDBREAK( nPort, [ nDuration = 50 ] ) --> lSuccess
HB_COMSETDEVICE( nPort, cDeviceName ) --> lSuccess
HB_COMRECV( nPort, @cBuffer, [ nLen = LEN( cBuffer ) ], [ nTimeout = 0 ] ) --> nBytesRecv
HB_COMSEND( nPort, cBuffer, [ nLen = LEN( cBuffer ) ], [ nTimeout = 0 ] ) --> nBytesSent
+ harbour/include/hbcom.ch
* harbour/include/hbapicom.h
* moved HB_COM_* constants to .ch file
+ harbour/examples/commouse
+ harbour/examples/commouse/commouse.prg
+ sample application to decode and display COM port mouse data.
Two types of mouse protocol is supported. You just need to
find COM port mouse! :)
* harbour/src/rtl/hbcom.c
! fixed timeouts on Windows platform (thanks Przemek!)
94 lines
3.8 KiB
C
94 lines
3.8 KiB
C
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Harbour Project source code:
|
|
* serial communication functions and constant values
|
|
*
|
|
* Copyright 2010 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
|
* 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.
|
|
*
|
|
*/
|
|
|
|
#ifndef HB_APICOM_H_
|
|
#define HB_APICOM_H_
|
|
|
|
#include "hbcom.ch"
|
|
#include "hbapi.h"
|
|
|
|
#define HB_COM_PORT_MAX 256
|
|
|
|
#define HB_COM_DEV_NAME_MAX 64
|
|
|
|
#define HB_COM_ANY -1
|
|
#define HB_COM_DISABLED 0
|
|
#define HB_COM_ENABLED 1
|
|
#define HB_COM_OPEN 2
|
|
|
|
extern int hb_comLastNum( void );
|
|
extern int hb_comOpen( int iPort );
|
|
extern int hb_comClose( int iPort );
|
|
extern int hb_comInit( int iPort, int iBaud, int iParity, int iSize, int iStop );
|
|
extern long hb_comSend( int iPort, const void * data, long len, HB_MAXINT timeout );
|
|
extern long hb_comRecv( int iPort, void * data, long len, HB_MAXINT timeout );
|
|
extern int hb_comGetError( int iPort );
|
|
extern int hb_comGetOsError( int iPort );
|
|
extern int hb_comInputCount( int iPort );
|
|
extern int hb_comOutputCount( int iPort );
|
|
extern int hb_comFlush( int iPort, int iType );
|
|
extern int hb_comMCR( int iPort, int * piValue, int iClr, int iSet );
|
|
extern int hb_comMSR( int iPort, int * piValue );
|
|
extern int hb_comLSR( int iPort, int * piValue );
|
|
extern int hb_comSendBreak( int iPort, int iDurationInMilliSecs );
|
|
extern int hb_comFlowControl( int iPort, int *piFlow, int iFlow );
|
|
extern int hb_comFlowSet( int iPort, int iFlow );
|
|
extern int hb_comFlowChars( int iPort, int iXONchar, int iXOFFchar );
|
|
extern int hb_comDiscardChar( int iPort, int iChar );
|
|
extern int hb_comErrorChar( int iPort, int iChar );
|
|
extern int hb_comOutputState( int iPort );
|
|
extern int hb_comInputState( int iPort );
|
|
extern int hb_comSetDevice( int iPort, const char * szDevName );
|
|
extern const char * hb_comGetDevice( int iPort, char * buffer, int size );
|
|
|
|
#endif /* HB_APICOM_H_ */
|