bool CLogitechMediaServer::StopHardware()
{
	StopHeartbeatThread();

	try {
		if (m_thread)
		{
			m_stoprequested = true;
			m_thread->join();
			m_thread.reset();

			//Make sure all our background workers are stopped
			int iRetryCounter = 0;
			while ((m_iThreadsRunning > 0) && (iRetryCounter<15))
			{
				sleep_milliseconds(500);
				iRetryCounter++;
			}
		}
	}
	catch (...)
	{
		//Don't throw from a Stop command
	}
	m_bIsStarted = false;
	return true;
}
Example #2
0
bool CTeleinfoSerial::StopHardware()
{
	terminate();
	StopHeartbeatThread();
	m_bIsStarted = false;
	return true;
}
Example #3
0
bool SolarEdgeTCP::StopHardware()
{
	m_bIsStarted=false;
	m_stoprequested=true;
	if (m_pTCPProxy==NULL)
		return true;
	m_pTCPProxy->stop();
	delete m_pTCPProxy;
	m_pTCPProxy=NULL;
	StopHeartbeatThread();
	return true;
}
Example #4
0
bool C1Wire::StopHardware()
{
	if (m_thread)
	{
		m_stoprequested = true;
		m_thread->join();
	}
	m_bIsStarted=false;
	if (m_system)
	{
		delete m_system;
		m_system=NULL;
	}
	StopHeartbeatThread();
	return true;
}
Example #5
0
bool Teleinfo::StopHardware()
{
	if (isOpen())
	{
		try {
			clearReadCallback();
			close();
		} catch(...)
		{
			//Don't throw from a Stop command
		}
	}
	StopHeartbeatThread();
	m_bIsStarted=false;
	return true;
}
Example #6
0
bool S0MeterSerial::StopHardware()
{
	m_bIsStarted=false;
	if (isOpen())
	{
		try {
			clearReadCallback();
			close();
			doClose();
			setErrorStatus(true);
		} catch(...)
		{
			//Don't throw from a Stop command
		}
	}
	StopHeartbeatThread();
	return true;
}
Example #7
0
bool CPanasonic::StopHardware()
{
	StopHeartbeatThread();

	try {
		if (m_thread)
		{
			m_stoprequested = true;
			m_thread->join();
			m_thread.reset();
		}
	}
	catch (...)
	{
		//Don't throw from a Stop command
	}
	m_bIsStarted = false;
	return true;
}
Example #8
0
bool MQTT::StopHardware()
{
	StopHeartbeatThread();
	m_stoprequested=true;
	try {
		if (m_thread)
		{
			m_thread->join();
			m_thread.reset();
		}
	}
	catch (...)
	{
		//Don't throw from a Stop command
	}
	if (m_sConnection.connected())
		m_sConnection.disconnect();
	m_IsConnected = false;
	return true;
}
Example #9
0
bool CGpio::StopHardware()
{
	m_stoprequested=true;

	if (m_thread_poller != NULL)
		m_thread_poller->join();

	boost::mutex::scoped_lock lock(m_pins_mutex);
	for(std::vector<CGpioPin>::iterator it = pins.begin(); it != pins.end(); ++it)
	{
		if (m_thread_interrupt[it->GetPin()] != NULL)
			m_thread_interrupt[it->GetPin()]->join();
	}

	for(std::vector<CGpioPin>::iterator it = pins.begin(); it != pins.end(); ++it)
		if (it->GetReadValueFd() != -1)
			close(it->GetReadValueFd());

	pins.clear();
	m_bIsStarted=false;
	StopHeartbeatThread();
	_log.Log(LOG_NORM, "GPIO: Hardware stopped");
	return true;
}