示例#1
0
void SSMprotocol2::resetCUdata()
{
	// RESET COMMUNICATION:
	if (_SSMP2com != NULL)
	{
		// Disconnect communication error and data signals:
		disconnect( _SSMP2com, SIGNAL( commError() ), this, SIGNAL( commError() ) );
		disconnect( _SSMP2com, SIGNAL( commError() ), this, SLOT( resetCUdata() ) );
		disconnect( _SSMP2com, SIGNAL( receivedData(const std::vector<char>&, int) ),
				this, SLOT( processDCsRawdata(const std::vector<char>&, int) ) );
		disconnect( _SSMP2com, SIGNAL( receivedData(const std::vector<char>&, int) ),
				this, SLOT( processMBSWrawData(const std::vector<char>&, int) ) );
		// Try to stop active communication processes:
		// NOTE: DO NOT CALL any communicating member functions here because of possible recursions !
		if (_SSMP2com->stopCommunication() && (_state == state_ActTesting))
		{
			unsigned int dataadr = 0x61;
			char currentdatabyte = '\x0';
			if (_SSMP2com->readMultipleDatabytes(0x0, &dataadr, 1, &currentdatabyte))
			{
				// Check if test mode is active:
				if (currentdatabyte & 0x20)
				{
					bool ok = false;
					// Stop all actuator tests:
					for (unsigned int k=0; k<_allActByteAddr.size(); k++)
					{
						ok =_SSMP2com->writeDatabyte(_allActByteAddr.at(k), 0x00);
						if (!ok) break;
					}
					_state = state_needSetup;	// MUST BE DONE AFTER ALL CALLS OF MEMBER-FUNCTIONS AND BEFORE EMITTING SIGNALS
					if (ok)
						emit stoppedActuatorTest();
				}
			}
		}
		_state = state_needSetup;	// MUST BE DONE AFTER ALL CALLS OF MEMBER-FUNCTIONS AND BEFORE EMITTING SIGNALS
		delete _SSMP2com;
		_SSMP2com = NULL;
		// Emit stoppedXXX()-signals (_SSMP2com has been deleted, so we are sure they have finished):
		if (_state == state_MBSWreading)
		{
			emit stoppedMBSWreading();
		}
		else if (_state == state_DCreading)
		{
			emit stoppedDCreading();
		}
	}
示例#2
0
SSMprotocol2::SSMprotocol2(AbstractDiagInterface *diagInterface, QString language) : SSMprotocol(diagInterface, language)
{
	_SSMP2com = NULL;
	resetCUdata();
}
示例#3
0
SSMprotocol2::~SSMprotocol2()
{
	resetCUdata();
}
示例#4
0
SSMprotocol1::~SSMprotocol1()
{
	resetCUdata();
}