CUcontent_DCs_stopCodes::~CUcontent_DCs_stopCodes()
{
#ifndef SMALL_RESOLUTION
	disconnect(printDClist_pushButton, SIGNAL( released() ), this, SLOT( printDCprotocol() ));
#endif
	disconnectGUIelements();
}
bool CUcontent_DCs_stopCodes::setup(SSMprotocol *SSMPdev)
{
	bool ok = false;
	bool currOrTempDTCs_sup = false;
	QString title;

	_SSMPdev = SSMPdev;
	// Reset data:
	_supportedDCgroups = SSMprotocol::noDCs_DCgroup;
	_currOrTempDTCs.clear();
	_currOrTempDTCdescriptions.clear();

	// Get CU information:
	ok = (_SSMPdev != NULL);
	if (ok)
		ok =_SSMPdev->getSupportedDCgroups(&_supportedDCgroups);
	if (ok)
	{
		currOrTempDTCs_sup = ((_supportedDCgroups & SSMprotocol::currentDTCs_DCgroup) || (_supportedDCgroups & SSMprotocol::temporaryDTCs_DCgroup));
	}
	// Set titles of the DTC-tables
	title = tr("Current Stop Code:");
	currOrTempDTCsTitle_label->setText( title );

	// DC-tables and titles:
	if (ok && !currOrTempDTCs_sup)
		setDCtableContent(currOrTempDTCs_tableWidget, QStringList(""), QStringList(tr("----- Not supported by ECU -----")));
	else
		setDCtableContent(currOrTempDTCs_tableWidget, QStringList(""), QStringList(""));
	currOrTempDTCsTitle_label->setEnabled(currOrTempDTCs_sup);
	currOrTempDTCs_tableWidget->setEnabled(currOrTempDTCs_sup);
#ifndef SMALL_RESOLUTION
	// Deactivate and disconnect "Print"-button:
	printDClist_pushButton->setEnabled(false);
	disconnect(printDClist_pushButton, SIGNAL( released() ), this, SLOT( printDCprotocol() ));
#endif
	// Connect start-slot:
	if (_SSMPdev)
	{
		if (ok && (_supportedDCgroups != SSMprotocol::noDCs_DCgroup))
			connect(_SSMPdev, SIGNAL( startedDCreading() ), this, SLOT( callStart() ));
		else
			disconnect(_SSMPdev, SIGNAL( startedDCreading() ), this, SLOT( callStart() ));
	}
	// Return result;
	return ok;
}
CUcontent_DCs_stopCodes::~CUcontent_DCs_stopCodes()
{
	disconnect(printDClist_pushButton, SIGNAL( released() ), this, SLOT( printDCprotocol() ));
	disconnectGUIelements();
}
	return ok;
}


void CUcontent_DCs_stopCodes::connectGUIelements()
{
	if (!_SSMPdev) return;
	// DTCs:   disable tables of unsupported DTCs, initial output, connect slots:
	if ((_supportedDCgroups & SSMprotocol::currentDTCs_DCgroup) || (_supportedDCgroups & SSMprotocol::temporaryDTCs_DCgroup))
	{
		updateCurrentOrTemporaryDTCsContent(QStringList(""), QStringList(tr("----- Reading data... Please wait ! -----")));
		connect(_SSMPdev, SIGNAL( currentOrTemporaryDTCs(QStringList, QStringList, bool, bool) ), this, SLOT( updateCurrentOrTemporaryDTCsContent(QStringList, QStringList) ));
	}
	// Connect and disable print-button temporary (until all memories have been read once):
	printDClist_pushButton->setDisabled(true);
	connect(printDClist_pushButton, SIGNAL( released() ), this, SLOT( printDCprotocol() ));
	// NOTE: using released() instead of pressed() as workaround for a Qt-Bug occuring under MS Windows
}


void CUcontent_DCs_stopCodes::disconnectGUIelements()
{
	if (!_SSMPdev) return;	// avoid NULL-pointer-warning-message
	disconnect(_SSMPdev, SIGNAL( currentOrTemporaryDTCs(QStringList, QStringList, bool, bool) ), this, SLOT( updateCurrentOrTemporaryDTCsContent(QStringList, QStringList) ));
}


void CUcontent_DCs_stopCodes::updateCurrentOrTemporaryDTCsContent(QStringList currOrTempDTCs, QStringList currOrTempDTCdescriptions)
{
	if ((currOrTempDTCs != _currOrTempDTCs) || (currOrTempDTCdescriptions != _currOrTempDTCdescriptions))
	{
bool CUcontent_DCs_engine::setup(SSMprotocol *SSMPdev)
{
	bool ok = false;
	bool TMsup = false;
	bool currOrTempDTCs_sup = false;
	bool histOrMemDTCs_sup = false;
	bool latestCCCCs_sup = false;
	bool memCCCCs_sup = false;
	QString title;

	_SSMPdev = SSMPdev;
	// Reset data:
	_obd2DTCformat = true;
	_testMode = false;
	_DCheckActive = false;
	_supportedDCgroups = SSMprotocol::noDCs_DCgroup;
	_currOrTempDTCs.clear();
	_currOrTempDTCdescriptions.clear();
	_histOrMemDTCs.clear();
	_histOrMemDTCdescriptions.clear();
	_latestCCCCs.clear();
	_latestCCCCdescriptions.clear();
	_memorizedCCCCs.clear();
	_memorizedCCCCdescriptions.clear();
	// Get CU information:
	ok = (_SSMPdev != NULL);
	if (ok)
		ok =_SSMPdev->getSupportedDCgroups(&_supportedDCgroups);
	if (ok)
	{
		ok = _SSMPdev->hasTestMode(&TMsup);
		if (ok && TMsup)
			ok = _SSMPdev->isInTestMode(&_testMode); // NOTE: CURRENTLY, THIS WILL FAIL IF DC-READING IS ALREADY IN PROGRESS
	}
	if (ok)
	{
		if ((_supportedDCgroups & SSMprotocol::currentDTCs_DCgroup) || (_supportedDCgroups & SSMprotocol::historicDTCs_DCgroup))
			_obd2DTCformat = false;
		currOrTempDTCs_sup = ((_supportedDCgroups & SSMprotocol::currentDTCs_DCgroup) || (_supportedDCgroups & SSMprotocol::temporaryDTCs_DCgroup));
		histOrMemDTCs_sup = ((_supportedDCgroups & SSMprotocol::historicDTCs_DCgroup) || (_supportedDCgroups & SSMprotocol::memorizedDTCs_DCgroup));
		latestCCCCs_sup = (_supportedDCgroups & SSMprotocol::CClatestCCs_DCgroup);
		memCCCCs_sup = (_supportedDCgroups & SSMprotocol::CCmemorizedCCs_DCgroup);
	}
	// Set titles of the DTC-tables
	setTitleOfFirstDTCtable(_obd2DTCformat, _testMode);
	if ( _obd2DTCformat )
		title = tr("Memorized Diagnostic Trouble Code(s):");
	else
		title = tr("Historic Diagnostic Trouble Code(s):");
	histOrMemDTCsTitle_label->setText( title );
	// DC-tables and titles:
	if (ok && !currOrTempDTCs_sup)
		setDCtableContent(currOrTempDTCs_tableWidget, QStringList(""), QStringList(tr("----- Not supported by ECU -----")));
	else
		setDCtableContent(currOrTempDTCs_tableWidget, QStringList(""), QStringList(""));
	currOrTempDTCsTitle_label->setEnabled(currOrTempDTCs_sup);
	currOrTempDTCs_tableWidget->setEnabled(currOrTempDTCs_sup);
	if (ok && !histOrMemDTCs_sup)
		setDCtableContent(histOrMemDTCs_tableWidget, QStringList(""), QStringList(tr("----- Not supported by ECU -----")));
	else
		setDCtableContent(histOrMemDTCs_tableWidget, QStringList(""), QStringList(""));
	histOrMemDTCsTitle_label->setEnabled(histOrMemDTCs_sup);
	histOrMemDTCs_tableWidget->setEnabled(histOrMemDTCs_sup);
	if (ok && !latestCCCCs_sup)
		setDCtableContent(latestCCCCs_tableWidget, QStringList(""), QStringList(tr("----- Not supported by ECU -----")));
	else
		setDCtableContent(latestCCCCs_tableWidget, QStringList(""), QStringList(""));
	latestCCCCsTitle_label->setEnabled(latestCCCCs_sup);
	latestCCCCs_tableWidget->setEnabled(latestCCCCs_sup);
	if (ok && !memCCCCs_sup)
		setDCtableContent(memorizedCCCCs_tableWidget, QStringList(""), QStringList(tr("----- Not supported by ECU -----")));
	else
		setDCtableContent(memorizedCCCCs_tableWidget, QStringList(""), QStringList(""));
	memorizedCCCCsTitle_label->setEnabled(memCCCCs_sup);
	memorizedCCCCs_tableWidget->setEnabled(memCCCCs_sup);
	// Deactivate and disconnect "Print"-button:
	printDClist_pushButton->setEnabled(false);
	disconnect(printDClist_pushButton, SIGNAL( released() ), this, SLOT( printDCprotocol() ));
	// Enable/disable "Cruise Control"-tab:
	if (ok && (latestCCCCs_sup || memCCCCs_sup))
		DCgroups_tabWidget->setTabEnabled(1, true);
	else
	{
		DCgroups_tabWidget->setCurrentIndex(0);
		DCgroups_tabWidget->setTabEnabled(1, false);
	}
	// Connect start-slot:
	if (_SSMPdev)
	{
		if (ok && (_supportedDCgroups != SSMprotocol::noDCs_DCgroup))
			connect(_SSMPdev, SIGNAL( startedDCreading() ), this, SLOT( callStart() ));
		else
			disconnect(_SSMPdev, SIGNAL( startedDCreading() ), this, SLOT( callStart() ));
	}
	// Return result;
	return ok;
}