Skip to content
Open
16 changes: 16 additions & 0 deletions MMDevice/DeviceBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,14 @@ class CStageBase : public CDeviceBase<MM::Stage, U>
return DEVICE_OK;
}

/**
* @brief Return true when your device adapter uses OnStagePositionChanged callbacks.
*/
virtual bool UsesOnStagePositionChanged()
{
return false;
}

virtual int IsStageLinearSequenceable(bool& isSequenceable) const
{
isSequenceable = false;
Expand Down Expand Up @@ -2103,6 +2111,14 @@ class CXYStageBase : public CDeviceBase<MM::XYStage, U>
return this->SetPositionSteps(xSteps+x, ySteps+y);
}

/**
* @brief Return true when your device adapter uses OnXYStagePositionChanged callbacks.
*/
virtual bool UsesOnXYStagePositionChanged()
{
return false;
}

virtual int Move(double /*vx*/, double /*vy*/)
{
return DEVICE_UNSUPPORTED_COMMAND;
Expand Down
20 changes: 19 additions & 1 deletion MMDevice/MMDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// Header version
// If any of the class definitions changes, the interface version
// must be incremented
#define DEVICE_INTERFACE_VERSION 74
#define DEVICE_INTERFACE_VERSION 75
///////////////////////////////////////////////////////////////////////////////

// N.B.
Expand Down Expand Up @@ -603,6 +603,15 @@ namespace MM {
virtual int SetOrigin() = 0;
virtual int GetLimits(double& lower, double& upper) = 0;

/**
* @brief Stages can use the OnStagePositionChanged callback to signal
* updates about their position. Some adapters do so, others do not,
* in which case the UI code should use polling. This function signals whether
* the device adapters uses callbacks, so that the UI knows it does not need
* to poll this device
*/
virtual bool UsesOnStagePositionChanged() = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious: how do you intend to determine from the UI whether a specific device returns True on this... does it imply that you intend to add another public method to MMCore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point! Completely forgot about that part. Added now. Please feel free to suggest better function names.


/**
* @brief Return the focus direction.
*
Expand Down Expand Up @@ -709,6 +718,15 @@ namespace MM {
virtual int Home() = 0;
virtual int Stop() = 0;

/**
* @brief XY stages can use the OnXYStagePositionChanged callback to signal
* updates about their position. Some stage adapters do so, others do not,
* in which case the UI code can use polling. This function signals whether
* the device adapters uses callbacks, so that the UI knows it does not need
* to poll this device
*/
virtual bool UsesOnXYStagePositionChanged() = 0;

/**
* @brief Define the current position as the (hardware) origin (0, 0).
*/
Expand Down