コード例 #1
0
ファイル: qcplugin.cpp プロジェクト: SeisComP3/seiscomp3
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void QcPlugin::sendMessages(const Core::Time &rectime) {
	_timer.restart();

	if ( _firstRecord ) {
		_lastArchiveTime = rectime;
		_lastReportTime = rectime;
		_lastAlertTime = rectime;
		_firstRecord = false;
	}

	if ( _qcBuffer->empty() )
		return;

	//! DEBUG
	if ( rectime == Core::Time() ) {
		try {
			SEISCOMP_DEBUG("%s: %d sec timeout reached for stream: %s.", _name.c_str(),  _qcConfig->reportTimeout(), _streamID.c_str());
		}
		catch ( QcConfigException ) {}
	}

	Core::TimeSpan diff;

	//! A R C H I V E
	if ( _qcConfig->archiveInterval() >= 0 && rectime != Core::Time() ) {
		diff = rectime - _lastArchiveTime;
		if ( diff > Core::TimeSpan(_qcConfig->archiveInterval()) || _app->exitRequested() ) {
			QcBufferCPtr archiveBuffer = _qcBuffer->qcParameter(_qcConfig->archiveBuffer());
			if ( !archiveBuffer->empty() ) {
				generateReport(archiveBuffer.get());
				sendObjects(true); // as notifier msg
				_lastArchiveTime = rectime;
			}
		}
	}

	//! R E P O R T
	if ( _qcConfig->reportInterval() >= 0 ) {
		diff = rectime - _lastReportTime;
		if ( diff > Core::TimeSpan(_qcConfig->reportInterval()) || rectime == Core::Time()) {
			QcBufferCPtr reportBuffer = _qcBuffer->qcParameter(_qcConfig->reportBuffer());
			generateReport(reportBuffer.get());
			sendObjects(false);
			_lastReportTime = rectime;
		}
	}
	
	//! A L E R T
	// in archive mode we don't want alert msg
	if ( !_app->archiveMode() && _qcConfig->alertInterval() >= 0 ) {
		diff = rectime - _lastAlertTime;
		if ( ( diff > Core::TimeSpan(_qcConfig->alertInterval()) && (int)_qcBuffer->length() >= _qcConfig->alertBuffer() ) || rectime == Core::Time()) {
			QcBufferCPtr alertBuffer = _qcBuffer->qcParameter(_qcConfig->alertBuffer());
			if (alertBuffer->empty()) return;
			generateAlert(alertBuffer.get(), _qcBuffer.get());
			sendObjects(false);
			_lastAlertTime = rectime;
		}
	}
}
コード例 #2
0
void Faceanomaly1Plugin::inputData(const QStringList& strList, QList<QImage> imageList){

    int i;

    frameNum=strList.at(1);

    if (!strList.at(0).isEmpty())
        i= strList.at(0).split(" ")[0].toInt();

    if(!imageList.isEmpty()){

        imageList.at(0);
        updateFrameViewer("Output",imageList.at(0).copy());


    }

    if( i>=threasholdFaceCount){

        debugMsg(QString("<FONT COLOR='#ff0000'>%1 faces detected on frame %2 ").arg(threasholdFaceCount).arg(frameNum));
        generateAlert("Output","Too many people",nooba::RedAlert);
    }
    i=0;

}
コード例 #3
0
ファイル: NoobaPlugin.cpp プロジェクト: Asitha/NoobaVSS
void NoobaPlugin::onGenerateAlert(const QString &frameViewerTitle, const QString& msg, nooba::AlertType alert)
{
    emit generateAlert(frameViewerTitle, msg, alert, this);
}