void AmptekSDD123Detector::onSpectrumPacketEventReceived(AmptekSpectrumPacketEvent* event)
{

    QByteArray spectrumByteArray = event->spectrumByteArray_;
    int channelCount = event->channelCount_;
    QByteArray statusDataArray = event->statusDataArray_;

    AMDSFlatArray *spectrumArray = readSpectrumData(spectrumByteArray, channelCount);
    readStatusData(statusDataArray);

    if(spectrumReceiver_) {

//		qDebug() << "At the AmptekSDD123Detector level: dwellStartTime, dwellEndTime, dwellReplyTime: " << event->dwellStartTime_ << event->dwellEndTime_ << event->dwellReplyTime_;

        AMDSDwellStatusData statusData(fastCounts(), slowCounts(), detectorTemperature(), accumulationTime(), liveTime(), realTime(), generalPurposeCounter(), event->dwellStartTime_, event->dwellEndTime_, event->dwellReplyTime_);

        AmptekSpectrumEvent *spectrumEvent = new AmptekSpectrumEvent();
        spectrumEvent->detectorSourceName_ = name();
        spectrumEvent->spectrum_ = spectrumArray;
        spectrumEvent->statusData_ = statusData;

        QCoreApplication::postEvent(spectrumReceiver_, spectrumEvent);
    } else {
        AMDSRunTimeSupport::debugMessage(AMDSRunTimeSupport::AlertMsg, this, AMPTEK_ALERT_NO_SPECTRUM_EVENT_RECEIVER, QString("No spectrum receiver"));
    }
}
Пример #2
0
void CIRCDDBGatewayThread::readStatusFile(const wxString& filename, unsigned int n, wxString& var)
{
	wxFileName name(wxFileName::GetHomeDir(), filename);

	wxString text;

	bool res = wxFile::Exists(name.GetFullPath());
	if (res) {
		wxTextFile textFile(name.GetFullPath());
		bool res = textFile.Open();
		if (res) {
			text = textFile.GetFirstLine();
			textFile.Close();
		}
	}

	if (!var.IsSameAs(text)) {
		wxLogMessage(wxT("Status %u message set to \"%s\""), n + 1U, text.c_str());
		CStatusData statusData(text, n);
		CRepeaterHandler::writeStatus(statusData);
		var = text;
	}
}