MMDevice 70
Public Types | Public Member Functions | List of all members
CStateDeviceBase< U > Class Template Reference

Base class for creating state device adapters such as filter wheels, objectives, turrets, etc. More...

#include <DeviceBase.h>

Inheritance diagram for CStateDeviceBase< U >:
CDeviceBase< MM::State, U > MM::State MM::Device

Public Types

typedef CStateDeviceBase< U > CStateBase
 
- Public Types inherited from CDeviceBase< MM::State, U >
typedef MM::Action< U > CPropertyAction
 
typedef MM::ActionEx< U > CPropertyActionEx
 

Public Member Functions

virtual int SetPosition (long pos)
 Set the state (position) of the device based on the state index.
 
virtual int SetPosition (const char *label)
 Set the state (position) of the device based on the state label.
 
virtual int SetGateOpen (bool open)
 Implement a gate, i.e., a position where the state device is closed.
 
virtual int GetGateOpen (bool &open)
 
virtual int GetPosition (long &pos) const
 Obtain the state (position) index of the device.
 
virtual int GetPosition (char *label) const
 Obtain the state (position) label of the device.
 
virtual int GetPositionLabel (long pos, char *label) const
 Obtain the label associated with the position (state).
 
virtual int SetPositionLabel (long pos, const char *label)
 Create new label for the given position, or override the existing one.
 
virtual int GetLabelPosition (const char *label, long &pos) const
 Obtain the position associated with a label.
 
int OnLabel (MM::PropertyBase *pProp, MM::ActionType eAct)
 Implement the default Label property action.
 
int OnStateChanged (long position)
 Signal to the core that the state has changed, so that both "State" and "Label" properties should be updated.
 
- Public Member Functions inherited from CDeviceBase< MM::State, U >
virtual void SetModuleName (const char *name)
 Assign a name for the module (for use only by the calling code).
 
virtual void GetModuleName (char *name) const
 Return the module name (for use only by the calling code).
 
virtual void SetDescription (const char *descr)
 Assign description string for a device (for use only by the calling code).
 
virtual void GetDescription (char *name) const
 Return device description (for use only by the calling code).
 
virtual void SetLabel (const char *label)
 Set the device label (for use only by the calling code).
 
virtual void GetLabel (char *name) const
 Return the device label (for use only by the calling code).
 
virtual double GetDelayMs () const
 Return device delay used for synchronization by the calling code.
 
virtual void SetDelayMs (double delay)
 Set the device delay used for synchronization by the calling code.
 
virtual void SetCallback (MM::Core *cbk)
 Set the callback for accessing parent functionality (used only by the calling code).
 
virtual bool UsesDelay ()
 Signal if the device responds to different delay settings.
 
virtual unsigned GetNumberOfProperties () const
 Return the number of properties.
 
virtual int GetProperty (const char *name, char *value) const
 Obtain the value of the property.
 
int GetProperty (const char *name, double &val)
 Obtain the value of the property.
 
int GetProperty (const char *name, long &val)
 Obtain the value of the property.
 
bool IsPropertyEqualTo (const char *name, const char *val) const
 Check if the property value is equal to a specific string.
 
virtual int GetPropertyReadOnly (const char *name, bool &readOnly) const
 Check whether the property is read-only.
 
virtual int GetPropertyInitStatus (const char *name, bool &preInit) const
 Check whether the property is pre-init.
 
virtual int HasPropertyLimits (const char *name, bool &hasLimits) const
 
virtual int GetPropertyLowerLimit (const char *name, double &lowLimit) const
 Provide lower limit for a property that has property limits.
 
virtual int GetPropertyUpperLimit (const char *name, double &hiLimit) const
 Provide upper limit for a property that has property limits.
 
virtual int IsPropertySequenceable (const char *name, bool &sequenceable) const
 Check whether the property can be run in a sequence.
 
virtual int GetPropertySequenceMaxLength (const char *name, long &nrEvents) const
 Provide the maximum number of events that can be executed by this sequenceable property.
 
virtual int StartPropertySequence (const char *name)
 Start a (TTL-triggered) sequence for the given property.
 
virtual int StopPropertySequence (const char *name)
 Stop a (TTL-triggered) sequence for the given property.
 
virtual int ClearPropertySequence (const char *name)
 Clear a property sequence.
 
virtual int AddToPropertySequence (const char *name, const char *value)
 Add to a property sequence.
 
virtual int SendPropertySequence (const char *name)
 Send the property sequence to the device.
 
virtual bool GetPropertyName (unsigned uIdx, char *name) const
 Obtain the property name given the index.
 
virtual int GetPropertyType (const char *name, MM::PropertyType &pt) const
 Obtain property type (string, float, or integer).
 
virtual int SetProperty (const char *name, const char *value)
 Set the property value.
 
virtual bool HasProperty (const char *name) const
 Check if device supports a given property.
 
virtual unsigned GetNumberOfPropertyValues (const char *propertyName) const
 Return the number of allowed property values.
 
virtual bool GetPropertyValueAt (const char *propertyName, unsigned index, char *value) const
 Return the allowed value of the property, given its index.
 
int CreateProperty (const char *name, const char *value, MM::PropertyType eType, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false)
 Create a new property for the device.
 
int CreatePropertyWithHandler (const char *name, const char *value, MM::PropertyType eType, bool readOnly, int(U::*memberFunction)(MM::PropertyBase *pProp, MM::ActionType eAct), bool isPreInitProperty=false)
 Create a new property for the device.
 
int CreateIntegerProperty (const char *name, long value, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false)
 Create an integer-valued property for the device.
 
int CreateFloatProperty (const char *name, double value, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false)
 Create a float-valued property for the device.
 
int CreateStringProperty (const char *name, const char *value, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false)
 Create a string-valued property for the device.
 
int SetPropertyLimits (const char *name, double low, double high)
 Define limits for properties with a continuous range of values.
 
int SetAllowedValues (const char *name, std::vector< std::string > &values)
 Set an entire array of allowed values.
 
int ClearAllowedValues (const char *name)
 Clear allowed values, and make any value valid.
 
int AddAllowedValue (const char *name, const char *value)
 Add a single allowed value.
 
int AddAllowedValue (const char *name, const char *value, long data)
 Add a single allowed value, plus additional data.
 
int GetPropertyData (const char *name, const char *value, long &data)
 Obtain data field associated with the allowed property value.
 
int GetCurrentPropertyData (const char *name, long &data)
 Obtain data field associated with the currently applied property value.
 
int UpdateStatus ()
 Refresh the entire state of the device and synchronize property values with the actual state of the hardware.
 
int UpdateProperty (const char *name)
 Update property value from the hardware.
 
int ApplyProperty (const char *name)
 Apply the current property value to the hardware.
 
virtual bool GetErrorText (int errorCode, char *text) const
 Obtain the error text associated with the error code.
 
virtual bool SupportsDeviceDetection (void)
 
virtual MM::DeviceDetectionStatus DetectDevice (void)
 
virtual void SetParentID (const char *parentId)
 
virtual void GetParentID (char *parentID) const
 
- Public Member Functions inherited from MM::State
virtual DeviceType GetType () const
 
virtual unsigned long GetNumberOfPositions () const =0
 
- Public Member Functions inherited from MM::Device
virtual bool Busy ()=0
 
virtual int Initialize ()=0
 
virtual int Shutdown ()=0
 Shut down (unload) the device.
 
virtual void GetName (char *name) const =0
 

Additional Inherited Members

- Static Public Attributes inherited from MM::State
static const DeviceType Type = StateDevice
 
- Protected Member Functions inherited from CDeviceBase< MM::State, U >
void SetErrorText (int errorCode, const char *text)
 Define the error text associated with the code.
 
const char * GetMorePropertyErrorInfo (void) const
 
void SetMorePropertyErrorInfo (const char *ptext) const
 
int LogMessage (const char *msg, bool debugOnly=false) const
 Output the specified text message to the log stream.
 
int LogMessage (const std::string &msg, bool debugOnly=false) const
 Output the specified text message to the log stream.
 
int LogMessageCode (const int errorCode, bool debugOnly=false) const
 Output the text message of specified code to the log stream.
 
int LogTimeDiff (MM::MMTime start, MM::MMTime end, const std::string &message, bool debugOnly=false) const
 Output time difference between two time stamps.
 
int LogTimeDiff (MM::MMTime start, MM::MMTime end, bool debugOnly=false) const
 Output time difference between two time stamps.
 
void InitializeDefaultErrorMessages ()
 Set up the standard set of error codes and error messages.
 
MM::DeviceGetDevice (const char *deviceLabel) const
 Get the handle (pointer) to the specified device label.
 
void GetLoadedDeviceOfType (MM::DeviceType devType, char *deviceName, const unsigned int deviceIterator)
 Provide access to the names of devices of a given type.
 
int WriteToComPort (const char *portLabel, const unsigned char *buf, unsigned bufLength)
 Send an array of bytes to the COM port.
 
int SendSerialCommand (const char *portName, const char *command, const char *term)
 Send an ASCII string with the specified terminating characters to the serial port.
 
int GetSerialAnswer (const char *portName, const char *term, std::string &ans)
 Get the received string from the serial port, waiting for the terminating character sequence.
 
int ReadFromComPort (const char *portLabel, unsigned char *buf, unsigned bufLength, unsigned long &read)
 Read the current contents of Rx serial buffer.
 
int PurgeComPort (const char *portLabel)
 Clear the serial port buffers.
 
MM::PortType GetSerialPortType (const char *portLabel)
 TODO-BRIEF.
 
int OnPropertiesChanged ()
 Signal that something changed in the property structure.
 
int OnPropertyChanged (const char *propName, const char *propValue)
 Signal to the core that a property value has changed.
 
int OnStagePositionChanged (double pos)
 Signal that the stage has arrived at a new position.
 
int OnXYStagePositionChanged (double xPos, double yPos)
 Signal that the XY stage has arrived at a new position.
 
int OnExposureChanged (double exposure)
 Signal that the exposure has changed.
 
int OnSLMExposureChanged (double exposure)
 Signal that the SLM exposure has changed.
 
int OnMagnifierChanged ()
 Signal that the magnifier has changed.
 
unsigned long GetClockTicksUs ()
 Get the system ticks in microseconds.
 
MM::MMTime GetCurrentMMTime ()
 Get current time.
 
bool IsCallbackRegistered () const
 Check if we have callback mechanism set up.
 
MM::CoreGetCoreCallback () const
 Get the callback object.
 
void EnableDelay (bool state=true)
 Enable response to delay settings.
 
void CreateHubIDProperty ()
 Create read-only property displaying parentID (hub label).
 
MM::HubGetParentHub () const
 Return the parent Hub device pointer, or null if there isn't any.
 
T_HUB * AssignToHub ()
 Return the parent Hub device pointer, or null if there isn't any.
 

Detailed Description

template<class U>
class CStateDeviceBase< U >

Base class for creating state device adapters such as filter wheels, objectives, turrets, etc.

Member Function Documentation

◆ GetGateOpen()

template<class U >
virtual int CStateDeviceBase< U >::GetGateOpen ( bool &  open)
inlinevirtual

Implements MM::State.

◆ GetLabelPosition()

template<class U >
virtual int CStateDeviceBase< U >::GetLabelPosition ( const char *  label,
long &  pos 
) const
inlinevirtual

Obtain the position associated with a label.

Implements MM::State.

Referenced by CStateDeviceBase< U >::OnLabel().

◆ GetPosition() [1/2]

template<class U >
virtual int CStateDeviceBase< U >::GetPosition ( char *  label) const
inlinevirtual

Obtain the state (position) label of the device.

Assumes that "State" property is implemented for the device.

Implements MM::State.

References CStateDeviceBase< U >::GetPosition(), and CStateDeviceBase< U >::GetPositionLabel().

◆ GetPosition() [2/2]

template<class U >
virtual int CStateDeviceBase< U >::GetPosition ( long &  pos) const
inlinevirtual

Obtain the state (position) index of the device.

Assumes that "State" property is implemented for the device.

Implements MM::State.

References CDeviceBase< MM::State, U >::GetProperty(), and CDeviceBase< MM::State, U >::HasProperty().

Referenced by CStateDeviceBase< U >::GetPosition(), CStateDeviceBase< U >::OnLabel(), and CStateDeviceBase< U >::SetGateOpen().

◆ GetPositionLabel()

template<class U >
virtual int CStateDeviceBase< U >::GetPositionLabel ( long  pos,
char *  label 
) const
inlinevirtual

Obtain the label associated with the position (state).

Implements MM::State.

References CDeviceUtils::CopyLimitedString().

Referenced by CStateDeviceBase< U >::GetPosition(), and CStateDeviceBase< U >::OnStateChanged().

◆ SetGateOpen()

template<class U >
virtual int CStateDeviceBase< U >::SetGateOpen ( bool  open)
inlinevirtual

Implement a gate, i.e., a position where the state device is closed.

The gate needs to be implemented in the adapter's OnState function (which is called through SetPosition).

Implements MM::State.

References CStateDeviceBase< U >::GetPosition(), and CStateDeviceBase< U >::SetPosition().

◆ SetPosition() [1/2]

template<class U >
virtual int CStateDeviceBase< U >::SetPosition ( const char *  label)
inlinevirtual

Set the state (position) of the device based on the state label.

Assumes that "State" property is implemented for the device.

Implements MM::State.

References CStateDeviceBase< U >::SetPosition().

◆ SetPosition() [2/2]

template<class U >
virtual int CStateDeviceBase< U >::SetPosition ( long  pos)
inlinevirtual

Set the state (position) of the device based on the state index.

Assumes that "State" property is implemented for the device.

Implements MM::State.

References CDeviceUtils::ConvertToString(), and CDeviceBase< MM::State, U >::SetProperty().

Referenced by CStateDeviceBase< U >::OnLabel(), CStateDeviceBase< U >::SetGateOpen(), and CStateDeviceBase< U >::SetPosition().

◆ SetPositionLabel()

template<class U >
virtual int CStateDeviceBase< U >::SetPositionLabel ( long  pos,
const char *  label 
)
inlinevirtual

Create new label for the given position, or override the existing one.

Implements MM::State.

References CDeviceBase< MM::State, U >::SetAllowedValues().


The documentation for this class was generated from the following file: