/*  Copyright (C) MOXA Inc. All rights reserved.

    This software is distributed under the terms of the
    MOXA License.  See the file COPYING-MOXA for details.
*/
#include <windows.h>

#ifdef __cplusplus    // If used by C++ code, 
extern "C" {          // we need to export the C interface
#endif

/*
	Initialize Digitial I/O
	
	param:
		None  :		
				
	Return value:
		HANDLE:			return digital I/O handle
*/
HANDLE mxdgio_open();

/*
	get digital input
	
	param:
		(in)HANDLE hDIO  :	Handle of digital I/O		
				
	Return value:
		int:			return digital input data 
*/
int mxdgio_get_input_signal(HANDLE fd, int port);

/*
	set digital output
	
	param:
		(in)HANDLE fd  :	Handle of digital I/O		
		(in)int port	 :	index of digital output bit		
	
	Return value:
		BOOL:			TRUE indicates success, FALSE indicates failure.
*/
int mxdgio_set_output_signal_high(HANDLE fd, unsigned int port);

/*
	set digital output
	
	param:
		(in)HANDLE fd  :	Handle of digital I/O		
		(in)int port	 :	index of digital output bit		
		
	Return value:
		BOOL:			TRUE indicates success, FALSE indicates failure.
*/
int mxdgio_set_output_signal_low(HANDLE fd, unsigned int port);

/*
	get digital output
	
	param:
		(in)HANDLE hDIO  :	Handle of digital I/O		
		(in)int port	 :	index of digital output			
	Return value:
		int:			return digital output data 
*/
int mxdgio_get_output_signal(HANDLE fd, int port);

/*
	close digital I/O
	
	param:
		(in)HANDLE hDIO  :	Handle of digital I/O		
				
	Return value:
		BOOL:			TRUE indicates success, FALSE indicates failure. 
*/
void mxdgio_close(HANDLE fd);


#ifdef __cplusplus    // If used by C++ code, 
}
#endif
