Example #1
0
void FilterWheel::DeleteFromRegistry(std::string strSerialNumber)
{
	QSI_Registry reg;

	std::string strWheelNames = KEY_QSI  + strSerialNumber + "/FilterWheel/Names";
	reg.RegDelKey(strWheelNames, Name);

	std::string strKeyPath = KEY_QSI  + strSerialNumber + _T("/FilterWheels/");
	reg.RegDelnode (strKeyPath + this->Name);
}
Example #2
0
bool FilterWheel::LoadFromRegistry(std::string strSerialNumber, std::string strWheelName, int iNumFiltersExpected )
{
	QSI_Registry reg;

	std::string strValue;
	std::string strKeyPath = KEY_QSI + strSerialNumber;
	strKeyPath = strKeyPath + "/FilterWheels/";
	strKeyPath = strKeyPath + strWheelName;

	Name = strWheelName;
	Filters.clear();
	m_iNumFilters = 0;

	// open registry key

	m_iNumFilters = reg.GetNumber(strKeyPath, SUBKEY_NumFilters, 0);

	if (m_iNumFilters == 0)
		return false;

	for (int i = 0; i < m_iNumFilters; i++)
	{
		Filter filter;

		std::string  strFilterNum;
		//strFilterNum.Format("%d", i+1);
		strFilterNum = StringOf(i+1);

		std::string  strFilterNameValue = SUBKEY_FilterName + strFilterNum;
		std::string  strName = reg.GetString( strKeyPath, strFilterNameValue, "Unnamed" );
		if (strName == "") strName = "Position " + StringOf(i+1); //strName.Format("Position %d", i+1);
			
		filter.Name = std::string( strName );

		std::string  strFilterOffsetValue = SUBKEY_FilterFocus + strFilterNum;
		filter.Offset = reg.GetNumber( strKeyPath, strFilterOffsetValue, 0 );

		std::string  strFilterTrimValue = SUBKEY_FilterTrim + strFilterNum;
		filter.Trim = reg.GetNumber( strKeyPath, strFilterTrimValue, 0 );

		this->Filters.push_back(filter);
	}

	// Now check to see if we need to expand the wheel size to match the camera's current wheel.
	if (iNumFiltersExpected > m_iNumFilters)
	{
		Filter filter;
		for (int i = m_iNumFilters; i < iNumFiltersExpected; i++)
		{
			AddFilter( filter );
		}
	}
	
	return true;
}
Example #3
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."));
}
Example #4
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 );
}
Example #5
0
void FilterWheel::GetWheels( std::string strSerialNumber, std::vector<FilterWheel> * Wheels, int iNumFiltersExpected )
{
	QSI_Registry reg;
	std::vector<std::string> vKeys;
	std::string strKeyPath = KEY_QSI + strSerialNumber + "/FilterWheel/Names";

	reg.GetAllKeys(strKeyPath, &vKeys);

	for (int i=0; i < vKeys.size(); i++)
	{
		FilterWheel fwWheel;
		if (fwWheel.LoadFromRegistry(strSerialNumber, vKeys[i], iNumFiltersExpected) )
			Wheels->push_back(fwWheel);
	}

	return;
}
Example #6
0
int HostIO_TCP::ListDevices(std::vector<CameraID> &vID)
{
	QSI_Registry reg;
	in_addr ipAddr;
	vID.clear();
//
// TODO
// No TCP devices for now
//
#ifdef HASTCPIP
	ipAddr.S_un.S_addr = reg.GetIPv4Addresss(true, MAKEIPADDRESS(0,0,0,0));
	CameraID cID("", ipAddr);
	vID.push_back(cID);

	ipAddr.S_un.S_addr = reg.GetIPv4Addresss(false, MAKEIPADDRESS(0,0,0,0));
	CameraID cgID("", ipAddr);
	vID.push_back(cgID);
#endif
	m_log->Write(2, _T("TCP/IP ListDevices Done."));
	return 0;
}
Example #7
0
void FilterWheel::SaveToRegistry(std::string  strSerialNumber)
{
	QSI_Registry reg;
	std::string strValue;
	std::string strWheelName = this->Name;
	std::string strWheelNames = KEY_QSI  + strSerialNumber + "/FilterWheel/Names";
	reg.SetString(strWheelNames, Name.c_str(), "");

	std::string strKeyPath = KEY_QSI  + strSerialNumber + "/FilterWheels/" + this->Name.c_str();

	// Save filter count, no all position maybe named (below)
	reg.SetNumber(strKeyPath, SUBKEY_NumFilters, m_iNumFilters);

	for (int i = 0; i < m_iNumFilters; i++)
	{
		std::string strFilterNum;
		//strFilterNum.Format("%d", i+1);
		strFilterNum = StringOf(i+1);

		std::string strFilterNameValue = SUBKEY_FilterName + strFilterNum;
		strValue = this->Filters[i].Name.c_str();
		reg.SetString( strKeyPath, strFilterNameValue, strValue );

		std::string strFilterOffsetValue = SUBKEY_FilterFocus + strFilterNum;
		reg.SetNumber( strKeyPath, strFilterOffsetValue, this->Filters[i].Offset);

		std::string  strFilterTrimValue = SUBKEY_FilterTrim + strFilterNum;
		reg.SetNumber( strKeyPath, strFilterTrimValue, this->Filters[i].Trim);
	}
	return;
}