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

Base class for creating special HUB devices for managing device libraries. More...

#include <DeviceBase.h>

Inheritance diagram for HubBase< U >:
CDeviceBase< MM::Hub, U > MM::Hub MM::Device

Public Member Functions

virtual int DetectInstalledDevices ()
 Detect installed child devices.
 
virtual unsigned GetNumberOfInstalledDevices ()
 Return the number of child devices after DetectInstalledDevices was called.
 
virtual MM::DeviceGetInstalledDevice (int devIdx)
 Return a pointer to the device with index devIdx.
 
virtual void ClearInstalledDevices ()
 Remove all installed devices that were created by DetectInstalledDevices().
 
- Public Member Functions inherited from CDeviceBase< MM::Hub, 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::Hub
virtual DeviceType GetType () const
 
- 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
 

Protected Member Functions

void AddInstalledDevice (MM::Device *pdev)
 
- Protected Member Functions inherited from CDeviceBase< MM::Hub, 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.
 

Additional Inherited Members

- Public Types inherited from CDeviceBase< MM::Hub, U >
typedef MM::Action< U > CPropertyAction
 
typedef MM::ActionEx< U > CPropertyActionEx
 
- Static Public Attributes inherited from MM::Hub
static const DeviceType Type = HubDevice
 

Detailed Description

template<class U>
class HubBase< U >

Base class for creating special HUB devices for managing device libraries.

Member Function Documentation

◆ ClearInstalledDevices()

template<class U >
virtual void HubBase< U >::ClearInstalledDevices ( )
inlinevirtual

Remove all installed devices that were created by DetectInstalledDevices().

(Don't override this method.)

Implements MM::Hub.

◆ DetectInstalledDevices()

template<class U >
virtual int HubBase< U >::DetectInstalledDevices ( )
inlinevirtual

Detect installed child devices.

To provide automatic child device discovery, override this method with code to instantiate child devices and use them to populate "installedDevices" list. If this method is not overridden, it will do nothing and return DEVICE_OK.

Implements MM::Hub.

◆ GetInstalledDevice()

template<class U >
virtual MM::Device * HubBase< U >::GetInstalledDevice ( int  devIdx)
inlinevirtual

Return a pointer to the device with index devIdx.

0 <= devIdx < GetNumberOfInstalledDevices(). (Don't override this method.)

Implements MM::Hub.

◆ GetNumberOfInstalledDevices()

template<class U >
virtual unsigned HubBase< U >::GetNumberOfInstalledDevices ( )
inlinevirtual

Return the number of child devices after DetectInstalledDevices was called.

(Don't override this method.)

Implements MM::Hub.


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