Ejemplo n.º 1
0
HostIO_TCP::HostIO_TCP(void)
{
	m_log = new QSILog(_T("QSIINTERFACELOG.TXT"), _T("LOGTCPTOFILE"), _T("TCP"));
	m_log->TestForLogging();
	QSI_Registry reg;
	//
	// Get timeouts in ms.
	//
	m_IOTimeouts.ShortRead = SHORT_READ_TIMEOUT;
	m_IOTimeouts.ShortWrite = SHORT_WRITE_TIMEOUT;
	m_IOTimeouts.StandardRead = reg.GetUSBReadTimeout( READ_TIMEOUT );
	m_IOTimeouts.StandardWrite = reg.GetUSBWriteTimeout( WRITE_TIMEOUT );
	m_IOTimeouts.ExtendedRead= reg.GetUSBExReadTimeout( LONG_READ_TIMEOUT );
	m_IOTimeouts.ExtendedWrite = reg.GetUSBExWriteTimeout( LONG_WRITE_TIMEOUT );

	m_ReadTimeout = READ_TIMEOUT;
	m_WriteTimeout = WRITE_TIMEOUT;

	m_TCP_Stack_OK = false;

#ifdef WIN32
	int iResult = WSAStartup(MAKEWORD(2,2), &m_wsaData);
	switch (iResult)
	{
		case NO_ERROR:
			m_log->Write(2, _T("TCP/IP WSAStartup OK"));
			m_TCP_Stack_OK = true;
			break;
		case WSASYSNOTREADY:		// The underlying network subsystem is not ready for network communication.
			m_log->Write(2, _T("TCP/IP The underlying network subsystem is not ready for network communication."));
			break;
		case WSAVERNOTSUPPORTED:	// The version of Windows Sockets support requested is not provided by this particular Windows Sockets implementation.
			m_log->Write(2, _T("TCP/IP The version of Windows Sockets support requested is not provided by this particular Windows Sockets implementation."));
			break; 
		case WSAEINPROGRESS:		// A blocking Windows Sockets 1.1 operation is in progress.
			m_log->Write(2, _T("TCP/IP A blocking Windows Sockets 1.1 operation is in progress."));
			break; 
		case WSAEPROCLIM :			// A limit on the number of tasks supported by the Windows Sockets implementation has been reached.
			m_log->Write(2, _T("TCP/IP A limit on the number of tasks supported by the Windows Sockets implementation has been reached."));
			break; 
		case WSAEFAULT:				//	The lpWSAData parameter is not a valid pointer.
			m_log->Write(2, _T("TCP/IP The lpWSAData parameter is not a valid pointer."));
			break;
		default:
			m_log->Write(2, _T("TCP/IP WSAStartup Unknown error code returned."));
			break;
	}
#else
	m_TCP_Stack_OK = true;
#endif 

	m_log->Write(2, _T("TCP/IP Constructor Done."));
}
Ejemplo n.º 2
0
HostIO_CyUSB::HostIO_CyUSB(void)
{
	m_log = new QSILog(_T("QSIINTERFACELOG.TXT"), _T("LOGUSBTOFILE"), _T("CYUSB"));
	m_log->TestForLogging();
	QSI_Registry reg;
	//
	// Get USB timeouts in ms.
	//
	m_IOTimeouts.ShortRead		= SHORT_READ_TIMEOUT;
	m_IOTimeouts.ShortWrite		= SHORT_WRITE_TIMEOUT;
	m_IOTimeouts.StandardRead	= reg.GetUSBReadTimeout( READ_TIMEOUT );
	m_IOTimeouts.StandardWrite	= reg.GetUSBWriteTimeout( WRITE_TIMEOUT );
	m_IOTimeouts.ExtendedRead	= reg.GetUSBExReadTimeout( LONG_READ_TIMEOUT );
	m_IOTimeouts.ExtendedWrite	= reg.GetUSBExWriteTimeout( LONG_WRITE_TIMEOUT );
}