コード例 #1
0
void AMDetectorAcquisitionAction::startImplementation(){
	// If you still don't have a detector, check the exposed detectors one last time.
	if(!detector_)
		detector_ = AMBeamline::bl()->exposedDetectorByInfo(*(detectorAcquisitionInfo()->detectorInfo()));

	if(!detector_) {
		AMErrorMon::alert(this,
						  AMDETECTORACQUISITIONACTION_NO_VALID_DETECTOR,
						  QString("There was an error acquiring with the detector '%1', because the detector was not found. Please report this problem to the Acquaman developers.").arg(detectorAcquisitionInfo()->name()));
		setFailed();
		return;
	}

	if( (detectorAcquisitionInfo()->readMode() != AMDetectorDefinitions::SingleRead) && !detector_->canContinuousAcquire()){
		AMErrorMon::alert(this,
						  AMDETECTORACQUISITIONACTION_NOT_VALID_READMODE,
						  QString("There was an error acquiring with the detector '%1', because continuous reads are not supported for this detector. Please report this problem to the Acquaman developers.").arg(detectorAcquisitionInfo()->name()));
		setFailed();
		return;
	}

	// connect to detector initialization signals
	connect(detector_, SIGNAL(acquiring()), this, SLOT(onAcquisitionStarted()));
	connect(detector_, SIGNAL(acquisitionSucceeded()), this, SLOT(onAcquisitionSucceeded()));
	connect(detector_, SIGNAL(acquisitionFailed()), this, SLOT(onAcquisitionFailed()));

	detector_->acquire(detectorAcquisitionInfo()->readMode());
}
コード例 #2
0
void AMDetectorTriggerAction::startImplementation(){
	// If you still don't have a detector, check the exposed detectors one last time.
	//if(!detector_)
	//	detector_ = AMBeamline::bl()->exposedDetectorByInfo(*(detectorTriggerInfo()->detectorInfo()));
	if(!detector_ && AMBeamlineSupport::beamlineDetectorAPI())
		detector_ = AMBeamlineSupport::beamlineDetectorAPI()->exposedDetectorByInfo(*(detectorTriggerInfo()->detectorInfo()));

	if(!detector_) {
		AMErrorMon::alert(this,
						  AMDETECTORTRIGGERACTION_NO_VALID_DETECTOR,
						  QString("There was an error trigger the detector '%1', because the detector was not found. Please report this problem to the Acquaman developers.").arg(detectorTriggerInfo()->name()));
		setFailed();
		return;
	}

	if( (detectorTriggerInfo()->readMode() != AMDetectorDefinitions::SingleRead) && !detector_->canContinuousAcquire()){
		AMErrorMon::alert(this,
						  AMDETECTORTRIGGERACTION_NOT_VALID_READMODE,
						  QString("There was an error triggering the detector '%1', because continuous reads are not supported for this detector. Please report this problem to the Acquaman developers.").arg(detectorTriggerInfo()->name()));
		setFailed();
		return;
	}


	if(detector_->detectorTriggerSource()){
		triggerSource_ = detector_->detectorTriggerSource();
		connect(triggerSource_, SIGNAL(triggered(AMDetectorDefinitions::ReadMode)), this, SLOT(onAcquisitionStarted()));
		connect(triggerSource_, SIGNAL(succeeded()), this, SLOT(onAcquisitionSucceeded()));
		connect(triggerSource_, SIGNAL(failed()), this, SLOT(onAcquisitionFailed()));

		detectorTriggerInfo()->setShortDescription(QString("Trigger %1").arg(triggerSource_->name()));
		detectorTriggerInfo()->setLongDescription(QString("Trigger %1").arg(triggerSource_->name()));
		triggerSource_->trigger(detectorTriggerInfo()->readMode());
	}
	else{
		// connect to detector initialization signals
		connect(detector_, SIGNAL(acquiring()), this, SLOT(onAcquisitionStarted()));
		connect(detector_, SIGNAL(acquisitionSucceeded()), this, SLOT(onAcquisitionSucceeded()));
		connect(detector_, SIGNAL(acquisitionFailed()), this, SLOT(onAcquisitionFailed()));

		if (detector_->isReadyForAcquisition())
			detector_->acquire(detectorTriggerInfo()->readMode());

		else
			connect(detector_, SIGNAL(readyForAcquisition()), this, SLOT(onDetectorReadyForAcquisition()));
	}
}