////////////////////////////////////////////////////////////////////////////////////
// neovi.h
// 4/23/2001
// Header file for using the neoVI API in C/C++
// Copyright Intrepid Control Systems, Inc. 2000-2001
// www.intrepidcs.com
////////////////////////////////////////////////////////////////////////////////////

// include the standard message data structures
#include        "icsSpyData.h"

// comment the following line out for Visual C++ and LabWindows
//#define		BORLANDC


//
// If borland c is defined we need to have "extern "c" added
// before each api call and a closing bracket after each api call
#ifdef BORLANDC
	#define BORLANDC_HEADER		extern "C" {
	#define BORLANDC_FOOTER		}
#else
	#define BORLANDC_HEADER	
	#define BORLANDC_FOOTER	
#endif


// OpenPort "OpenType" Argument Constants
#define		NEOVI_COMMTYPE_RS232		0
#define		NEOVI_COMMTYPE_USB_BULK		1
#define		NEOVI_COMMTYPE_USB_ISO		2
#define		NEOVI_COMMTYPE_USB_BULK_SN	3
#define		NEOVI_COMMTYPE_USB_ISO_SN	4

// Driver Type Constants
#define INTREPIDCS_DRIVER_STANDARD		0
#define	INTREPIDCS_DRIVER_TEST			1

// neoVI Subsystem ID's
#define		NETID_DEVICE		        0
#define		NETID_HSCAN			1
#define		NETID_MSCAN			2
#define		NETID_SWCAN			3
#define		NETID_LSFTCAN		        4
#define		NETID_FORDSCP		        5
#define		NETID_J1708			6
#define		NETID_AUX			7
#define		NETID_JVPW			8
#define		NETID_ISO			9
#define		NETID_ISOPIC		        10
#define		NETID_MAIN51		        11
#define		NETID_HOST			12

// neoVI Error Constants ///////////////////////////////////////////////////////////
const unsigned long NEOVI_ERROR_DLL_TX_BUFFER_OVERFLOW = 0;
const unsigned long NEOVI_ERROR_DLL_ERROR_BUFFER_OVERFLOW = 1;
const unsigned long NEOVI_ERROR_DLL_USB_SEND_DATA_ERROR = 2;
const unsigned long NEOVI_ERROR_DLL_ISO_DATA_BUFFER_ALLOC = 3;
const unsigned long NEOVI_ERROR_DLL_ISO_DATA_READ_BUFFER = 4;
const unsigned long NEOVI_ERROR_DLL_ISO_DATA_ZERO_PACKETS =5;
const unsigned long NEOVI_ERROR_DLL_RX_MSG_BUFFER_OVERFLOW =6;
const unsigned long NEOVI_ERROR_DLL_STOP_ISO_STREAM =7;
const unsigned long NEOVI_ERROR_DLL_INVALID_NETID =8;
const unsigned long NEOVI_ERROR_DLL_PROBLEM_STOPPING_RX_THREAD =9;
const unsigned long NEOVI_ERROR_DLL_PROBLEM_STOPPING_TX_THREAD =10;
const unsigned long NEOVI_ERROR_DLL_MAIN_PIC_BUFFER_OVERFLOW =11;
const unsigned long NEOVI_ERROR_DLL_INVALID_DEVICE_RESPONSE =12;
const unsigned long NEOVI_ERROR_DLL_ISOTX_DATA_BUFFER_ALLOC =13;
const unsigned long NEOVI_ERROR_DLL_RX_CMD_BUFFER_OVERFLOW=14;
const unsigned long NEOVI_ERROR_DLL_RS232_RX_BUFFER_OVERFLOW=15;
const unsigned long NEOVI_ERROR_DLL_RS232_ERR_READCOMERR =16;
const unsigned long NEOVI_ERROR_DLL_RS232_ERR_READ=17;
const unsigned long NEOVI_ERROR_DLL_RS232_BUFFER_ALLOC=18;
const unsigned long NEOVI_ERROR_DLL_RS232_TX_BUFFER_OVERFLOW=19;
const unsigned long NEOVI_ERROR_DLL_RS232_MISC_ERROR=20;
const unsigned long NEOVI_ERROR_DLL_RS232_FIND_WRITE=21;
const unsigned long NEOVI_ERROR_DLL_RS232_FIND_BUFFER_ALLOC=22;
const unsigned long NEOVI_ERROR_DLL_RS232_FIND_CLEARCOMM=23;
const unsigned long NEOVI_ERROR_DLL_RS232_FIND_READCOMM=24;
const unsigned long NEOVI_ERROR_DLL_RS232_FIND_TIMEOUT=25;
const unsigned long NEOVI_ERROR_DLL_RS232_ERR_BREAK=26;
const unsigned long NEOVI_ERROR_DLL_RS232_ERR_FRAME=27;
const unsigned long NEOVI_ERROR_DLL_RS232_ERR_IOE=28;
const unsigned long NEOVI_ERROR_DLL_RS232_ERR_OVERRUN=29;
const unsigned long NEOVI_ERROR_DLL_RS232_ERR_PARITY=30;
const unsigned long NEOVI_ERROR_DLL_RS232_TXBUFFER_ALLOC=31; 
const unsigned long NEOVI_ERROR_DLL_USB_TX_RS232_ERROR=32;
const unsigned long NEOVI_ERROR_DLL_RS232_CREATE_FILE=33;
const unsigned long NEOVI_ERROR_DLL_RS232_GET_COMM_STATE=34;
const unsigned long NEOVI_ERROR_DLL_RS232_SET_COMM_STATE=35;
const unsigned long NEOVI_ERROR_DLL_RS232_START_COMM_RX_THREAD=36;
const unsigned long NEOVI_ERROR_DLL_RS232_START_COMM_TX_THREAD=37;
const unsigned long NEOVI_ERROR_DLL_SYNC_COUNT_ERR=38;
const unsigned long NEOVI_ERROR_DLL_RX_MSG_FRAME_ERR=39;
const unsigned long NEOVI_ERROR_DLL_RX_MSG_FIFO_OVER=40;
const unsigned long NEOVI_ERROR_DLL_RX_MSG_CHK_SUM_ERR=41;
const unsigned long NEOVI_ERROR_DLL_PROBLEM_STOPPING_BULKIN_THREAD=42;
const unsigned long NEOVI_ERROR_DLL_BULKIN_ERR_READ=43;
const unsigned long NEOVI_ERROR_DLL_MAIN51_RX_FIFO_OVERFLOW=44;
const unsigned long NEOVI_ERROR_DLL_MAIN51_TX_FIFO_OVERFLOW=45;
const unsigned long NEOVI_ERROR_DLL_MAIN51_DEV_FIFO_OVERFLOW=46;
const unsigned long NEOVI_ERROR_DLL_RESET_STATUS_CHANGED=47;

// Constants used to calculate the timestamp
const double NEOVI_TIMESTAMP_2 = 0.1048576;
const double NEOVI_TIMESTAMP_1 = 0.0000016;

// Win32 DLL prototypes 
BORLANDC_HEADER int _stdcall  icsneoOpenPort(int lPortNumber, int lPortType,
                        int lDriverType,unsigned char * bNetworkID,
                        unsigned char * bSCPIDs,  int * hObject); BORLANDC_FOOTER
BORLANDC_HEADER int _stdcall icsneoClosePort(int hObject, int * pNumberOfErrors); BORLANDC_FOOTER
BORLANDC_HEADER void  _stdcall  icsneoFreeObject(int hObject); BORLANDC_FOOTER
BORLANDC_HEADER int _stdcall icsneoGetMessages(int hObject, icsSpyMessage * pMsg,
                                int * pNumberOfMessages,
                                int * pNumberOfErrors); BORLANDC_FOOTER
BORLANDC_HEADER int _stdcall icsneoTxMessages(int hObject,icsSpyMessage * pMsg,
                                        int lNetworkID, int lNumMessages); BORLANDC_FOOTER
BORLANDC_HEADER int _stdcall icsneoGetErrorMessages(int hObject, int * pErrorMsgs,
                                        int * pNumberOfErrors); BORLANDC_FOOTER



