/*
  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.
*/
#ifndef _MXDK02_H_
#define _MXDK02_H_

#ifdef __cplusplus
extern "C" {
#endif

struct slot_info {
	int     num;
	int     value;// 1 for on, 0 for off
};

/**
 * Open the Moxa EPM-DK02 device 
 * @return  0 on failure, otherwise return fd
 */
unsigned int mxdk02_open(); 

/**
 * Close the fd of Moxa EPM-DK02 device
 * @param fd the file descriptor of device
 * @return  None
 */
#ifdef WIN32
int mxdk02_close(unsigned int fd);
#else /* Linux */
#define mxdk02_close(fd)			close((int)fd)
#endif

/**
 * Power on /off a slot's USB interface in EPM-DK02 module
 * @param fd the file descriptor of device
 * @param slot_num the slot number to be control
 * @param on 1: power on the slot, 0: power off the slot
 * @return  0 on success, otherwise returns a negative value
 */
int	mxdk02_set_slot(unsigned int fd, int slot_num, int on);

/**
 * Get a slot's USB interface status in EPM-DK02 module
 * @param fd the file descriptor of device
 * @param slot_num the slot number to be control
 * @return  0: power off 1:power on , otherwise returns a negative value
 */
int	mxdk02_get_slot(unsigned int fd, int slot_num);

#ifdef __cplusplus
}
#endif
#endif /* _MXDK02_H_ */
