Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars-Kool committed Aug 21, 2024
2 parents 310645a + f4221fb commit 6aa3a4a
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
76 changes: 76 additions & 0 deletions MMCore/MMCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3571,6 +3571,82 @@ void CMMCore::setCameraDevice(const char* cameraLabel) throw (CMMError)
}
}

/**
* Returns the label of the currently selected PressurePump device.
* @return pressure pump name
*/
std::string CMMCore::getPressurePumpDevice()
{
std::shared_ptr<PressurePumpInstance> pPressurePump = currentPressurePump_.lock();
if (pPressurePump)
{
return pPressurePump->GetLabel();
}
return std::string();
}

/**
* Returns the label of the currently selected VolumetricPump device.
* @return volumetric pump name
*/
std::string CMMCore::getVolumetricPumpDevice()
{
std::shared_ptr<VolumetricPumpInstance> pVolumetricPump = currentVolumetricPump_.lock();
if (pVolumetricPump)
{
return pVolumetricPump->GetLabel();
}
return std::string();
}

/**
* Sets the current PressurePump device.
*/
void CMMCore::setPressurePumpDevice(const char* pressurePumpLabel) throw (CMMError)
{
if (pressurePumpLabel && strlen(pressurePumpLabel) > 0)
{
currentPressurePump_ =
deviceManager_->GetDeviceOfType<PressurePumpInstance>(pressurePumpLabel);
LOG_INFO(coreLogger_) << "Default pressure pump set to " << pressurePumpLabel;
}
else
{
currentPressurePump_.reset();
LOG_INFO(coreLogger_) << "Default pressure pump unset";
}
properties_->Refresh(); // TODO: more efficient
std::string newPumpLabel = getPressurePumpDevice();
{
MMThreadGuard scg(stateCacheLock_);
stateCache_.addSetting(PropertySetting(MM::g_Keyword_CoreDevice, MM::g_Keyword_CorePressurePump, newPumpLabel.c_str()));
}
}

/**
* Sets the current PressurePump device.
*/
void CMMCore::setVolumetricPumpDevice(const char* volumetricPumpLabel) throw (CMMError)
{
if (volumetricPumpLabel && strlen(volumetricPumpLabel) > 0)
{
currentVolumetricPump_ =
deviceManager_->GetDeviceOfType<VolumetricPumpInstance>(volumetricPumpLabel);
LOG_INFO(coreLogger_) << "Default volumetric pump set to " << volumetricPumpLabel;
}
else
{
currentPressurePump_.reset();
LOG_INFO(coreLogger_) << "Default volumetric pump unset";
}
properties_->Refresh(); // TODO: more efficient
std::string newPumpLabel = getVolumetricPumpDevice();
{
MMThreadGuard scg(stateCacheLock_);
stateCache_.addSetting(PropertySetting(MM::g_Keyword_CoreDevice, MM::g_Keyword_CorePressurePump, newPumpLabel.c_str()));
}
}

/**
* Returns all property names supported by the device.
*
Expand Down
6 changes: 6 additions & 0 deletions MMCore/MMCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ class CMMCore
std::string getPressurePumpDevice();
std::string getVolumetricPumpDevice();
std::string getChannelGroup();
std::string getPressurePumpDevice();
std::string getVolumetricPumpDevice();
void setCameraDevice(const char* cameraLabel) throw (CMMError);
void setShutterDevice(const char* shutterLabel) throw (CMMError);
void setFocusDevice(const char* focusLabel) throw (CMMError);
Expand All @@ -293,6 +295,8 @@ class CMMCore
void setPressurePumpDevice(const char* pumpLabel) throw (CMMError);
void setVolumetricPumpDevice(const char* pumpLabel) throw (CMMError);
void setChannelGroup(const char* channelGroup) throw (CMMError);
void setPressurePumpDevice(const char* galvoLabel) throw (CMMError);
void setVolumetricPumpDevice(const char* galvoLabel) throw (CMMError);
///@}

/** \name System state cache.
Expand Down Expand Up @@ -685,6 +689,8 @@ class CMMCore
std::weak_ptr<AutoFocusInstance> currentAutofocusDevice_;
std::weak_ptr<SLMInstance> currentSLMDevice_;
std::weak_ptr<GalvoInstance> currentGalvoDevice_;
std::weak_ptr<PressurePumpInstance> currentPressurePump_;
std::weak_ptr<VolumetricPumpInstance> currentVolumetricPump_;
std::weak_ptr<ImageProcessorInstance> currentImageProcessor_;
std::weak_ptr<PressurePumpInstance> currentPressurePump_;
std::weak_ptr<VolumetricPumpInstance> currentVolumetricPump_;
Expand Down
2 changes: 2 additions & 0 deletions MMDevice/MMDeviceConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ namespace MM {
const char* const g_Keyword_CorePressurePump = "PressurePump";
const char* const g_Keyword_CoreVolumetricPump = "VolumetricPump";
const char* const g_Keyword_CoreTimeoutMs = "TimeoutMs";
const char* const g_Keyword_CorePressurePump = "PressurePump";
const char* const g_Keyword_CoreVolumetricPump = "VolumetricPump";
const char* const g_Keyword_Channel = "Channel";
const char* const g_Keyword_Version = "Version";
const char* const g_Keyword_ColorMode = "ColorMode";
Expand Down

0 comments on commit 6aa3a4a

Please sign in to comment.