MMDevice 70
|
#include <DeviceBase.h>
Public Types | |
typedef MM::Action< U > | CPropertyAction |
typedef MM::ActionEx< U > | CPropertyActionEx |
Public Member Functions | |
virtual HDEVMODULE | GetModuleHandle () const |
virtual void | SetModuleName (const char *name) |
virtual void | GetModuleName (char *name) const |
virtual void | SetDescription (const char *descr) |
virtual void | GetDescription (char *name) const |
virtual void | SetModuleHandle (HDEVMODULE hModule) |
virtual void | SetLabel (const char *label) |
virtual void | GetLabel (char *name) const |
virtual double | GetDelayMs () const |
virtual void | SetDelayMs (double delay) |
virtual void | SetCallback (MM::Core *cbk) |
virtual bool | UsesDelay () |
virtual unsigned | GetNumberOfProperties () const |
virtual int | GetProperty (const char *name, char *value) const |
int | GetProperty (const char *name, double &val) |
int | GetProperty (const char *name, long &val) |
bool | IsPropertyEqualTo (const char *name, const char *val) const |
virtual int | GetPropertyReadOnly (const char *name, bool &readOnly) const |
virtual int | GetPropertyInitStatus (const char *name, bool &preInit) const |
virtual int | HasPropertyLimits (const char *name, bool &hasLimits) const |
virtual int | GetPropertyLowerLimit (const char *name, double &lowLimit) const |
virtual int | GetPropertyUpperLimit (const char *name, double &hiLimit) const |
virtual int | IsPropertySequenceable (const char *name, bool &sequenceable) const |
virtual int | GetPropertySequenceMaxLength (const char *name, long &nrEvents) const |
virtual int | StartPropertySequence (const char *name) |
virtual int | StopPropertySequence (const char *name) |
virtual int | ClearPropertySequence (const char *name) |
virtual int | AddToPropertySequence (const char *name, const char *value) |
virtual int | SendPropertySequence (const char *name) |
virtual bool | GetPropertyName (unsigned uIdx, char *name) const |
virtual int | GetPropertyType (const char *name, MM::PropertyType &pt) const |
virtual int | SetProperty (const char *name, const char *value) |
virtual bool | HasProperty (const char *name) const |
virtual unsigned | GetNumberOfPropertyValues (const char *propertyName) const |
virtual bool | GetPropertyValueAt (const char *propertyName, unsigned index, char *value) const |
int | CreateProperty (const char *name, const char *value, MM::PropertyType eType, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false) |
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) |
int | CreateIntegerProperty (const char *name, long value, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false) |
int | CreateFloatProperty (const char *name, double value, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false) |
int | CreateStringProperty (const char *name, const char *value, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false) |
int | SetPropertyLimits (const char *name, double low, double high) |
int | SetAllowedValues (const char *name, std::vector< std::string > &values) |
int | ClearAllowedValues (const char *name) |
int | AddAllowedValue (const char *name, const char *value) |
int | AddAllowedValue (const char *name, const char *value, long data) |
int | GetPropertyData (const char *name, const char *value, long &data) |
int | GetCurrentPropertyData (const char *name, long &data) |
int | UpdateStatus () |
int | UpdateProperty (const char *name) |
int | ApplyProperty (const char *name) |
virtual bool | GetErrorText (int errorCode, char *text) const |
virtual bool | SupportsDeviceDetection (void) |
virtual MM::DeviceDetectionStatus | DetectDevice (void) |
virtual void | SetParentID (const char *parentId) |
virtual void | GetParentID (char *parentID) const |
Protected Member Functions | |
void | SetErrorText (int errorCode, const char *text) |
const char * | GetMorePropertyErrorInfo (void) const |
void | SetMorePropertyErrorInfo (const char *ptext) const |
int | LogMessage (const char *msg, bool debugOnly=false) const |
int | LogMessage (const std::string &msg, bool debugOnly=false) const |
int | LogMessageCode (const int errorCode, bool debugOnly=false) const |
int | LogTimeDiff (MM::MMTime start, MM::MMTime end, const std::string &message, bool debugOnly=false) const |
int | LogTimeDiff (MM::MMTime start, MM::MMTime end, bool debugOnly=false) const |
void | InitializeDefaultErrorMessages () |
MM::Device * | GetDevice (const char *deviceLabel) const |
void | GetLoadedDeviceOfType (MM::DeviceType devType, char *deviceName, const unsigned int deviceIterator) |
int | WriteToComPort (const char *portLabel, const unsigned char *buf, unsigned bufLength) |
int | SendSerialCommand (const char *portName, const char *command, const char *term) |
int | GetSerialAnswer (const char *portName, const char *term, std::string &ans) |
int | ReadFromComPort (const char *portLabel, unsigned char *buf, unsigned bufLength, unsigned long &read) |
int | PurgeComPort (const char *portLabel) |
MM::PortType | GetSerialPortType (const char *portLabel) |
int | OnPropertiesChanged () |
int | OnPropertyChanged (const char *propName, const char *propValue) |
int | OnStagePositionChanged (double pos) |
int | OnXYStagePositionChanged (double xPos, double yPos) |
int | OnExposureChanged (double exposure) |
int | OnSLMExposureChanged (double exposure) |
int | OnMagnifierChanged () |
unsigned long | GetClockTicksUs () |
MM::MMTime | GetCurrentMMTime () |
bool | IsCallbackRegistered () const |
MM::Core * | GetCoreCallback () const |
void | EnableDelay (bool state=true) |
void | CreateHubIDProperty () |
MM::Hub * | GetParentHub () const |
template<class T_HUB > | |
T_HUB * | AssignToHub () |
Implements functionality common to all devices. Typically used as the base class for actual device adapters. In general, derived class do not override DeviceBase methods, but rather take advantage of using them to simplify development of specific drivers.
|
inline |
Add a single allowed value.
|
inline |
Add a single allowed value, plus an additional data.
|
inlinevirtual |
This function is used by the Core to communicate a sequence to the device
name | - name of the sequenceable property |
|
inline |
Apply the current property value to the hardware.
|
inlineprotected |
Returns the parent Hub device pointer, or null if there isn't any. Makes sure the Parent ID has been assigned.
References CDeviceBase< T, U >::GetParentHub(), and CDeviceBase< T, U >::LogMessage().
|
inline |
Clears allowed values, and makes any value valid.
|
inlinevirtual |
This function is used by the Core to communicate a sequence to the device
name | - name of the sequenceable property |
|
inline |
Create a float-valued property for the device
References CDeviceBase< T, U >::CreateProperty().
|
inlineprotected |
Utility method to create read-only property displaying parentID (hub label). By looking at this HubID property we can see which hub this peripheral belongs to. Can be called anywhere in the device code, but the most logical place is the constructor. Use is optional, to provide useful info.
References CDeviceBase< T, U >::CreateProperty().
|
inline |
Create an integer-valued property for the device
References CDeviceBase< T, U >::CreateProperty().
|
inline |
Creates a new property for the device.
name | - property name |
value | - initial value |
eType | - property type (string, integer or float) |
readOnly | - is the property read-only or not |
pAct | - function object called on the property actions |
isPreInitProperty | - whether to create a "pre-init" property, whose value will be available before Initialize() is called |
Referenced by CDeviceBase< T, U >::CreateFloatProperty(), CDeviceBase< T, U >::CreateHubIDProperty(), CDeviceBase< T, U >::CreateIntegerProperty(), CDeviceBase< T, U >::CreatePropertyWithHandler(), and CDeviceBase< T, U >::CreateStringProperty().
|
inline |
Creates a new property for the device.
name | - property name |
value | - initial value |
eType | - property type (string, integer or float) |
readOnly | - is the property read-only or not |
memberFunction | - Function pointer to the device object "OnProperty" member function, e.g. &MyDevice::OnState |
isPreInitProperty | - whether to create a "pre-init" property, whose value will be available before Initialize() is called |
References CDeviceBase< T, U >::CreateProperty().
|
inline |
Create a string-valued property for the device
References CDeviceBase< T, U >::CreateProperty().
|
inlineprotected |
If this flag is set the device signals to the rest of the system that it will respond to delay settings.
|
inlineprotected |
Gets the system ticks in microseconds. OBSOLETE, use GetCurrentTime()
|
inlineprotected |
Get the callback object.
Referenced by CDeviceBase< T, U >::GetParentHub().
|
inlineprotected |
Gets current time.
|
inline |
Obtains data field associated with the currently applied property value.
|
inlinevirtual |
Returns device delay used for synchronization by the calling code. Delay of 0 means that the device should be synchronized by polling with the Busy() method.
|
inlinevirtual |
Returns device description (for use only by the calling code).
References CDeviceUtils::CopyLimitedString().
|
inlineprotected |
Gets the handle (pointer) to the specified device label. With this method we can get a handle to other devices loaded in the system, if we know the device name.
References MM::Core::GetDevice().
|
inlinevirtual |
Obtains the error text associated with the error code.
References CDeviceUtils::CopyLimitedString().
Referenced by CDeviceBase< T, U >::LogMessageCode().
|
inlinevirtual |
Returns the device label (for use only by the calling code). Labels are usually manipulated by the parent application and used for high-level programming.
References CDeviceUtils::CopyLimitedString().
|
inlineprotected |
Provides access to the names of devices of a given type deviceIterator determines which device in the list of devices of the given type will become accessible in deviceName. If deviceIterator exceeds the number of devices of the given type, no action will be taked (i.e., the memory pointed to by deviceName will be unchanged).
References MM::Core::GetLoadedDeviceOfType().
|
inlinevirtual |
Returns the library handle (for use only by the calling code).
|
inlinevirtual |
Returns the module name (for use only by the calling code).
References CDeviceUtils::CopyLimitedString().
|
inlinevirtual |
Returns the number of properties.
|
inlinevirtual |
Returns the number of allowed property values. If the set of property values is not defined, not bounded, or property does not exist, the call returns 0.
|
inlineprotected |
Returns the parent Hub device pointer, or null if there isn't any. GetParentHub() call Makes sure that the hub pointer belongs to a class from the same module (device library). This is to avoid using dynamic_cast<> which won't work for Linux.
References CDeviceBase< T, U >::GetCoreCallback(), and CDeviceBase< T, U >::IsCallbackRegistered().
Referenced by CDeviceBase< T, U >::AssignToHub().
|
inlinevirtual |
Obtains the value of the property.
name | - property identifier (name) |
value | - the value of the property |
References CDeviceUtils::CopyLimitedString().
|
inline |
Obtains the value of the property.
name | - property identifier (name) |
value | - the value of the property |
|
inline |
Obtains the value of the property.
name | - property identifier (name) |
value | - the value of the property |
|
inline |
Obtains data field associated with the allowed property value.
|
inlinevirtual |
Checks whether the property is read-only.
name | - property identifier (name) |
readOnly | - read-only or not |
|
inlinevirtual |
Provides lower limit for a property that has property limits
name | - property identifier (name) |
lowLimit | - returns lower limit |
|
inlinevirtual |
Obtains the property name given the index. Can be used for enumerating properties.
uIdx | - property index |
name | - property name |
References CDeviceUtils::CopyLimitedString().
|
inlinevirtual |
Checks whether the property is read-only.
name | - property identifier (name) |
readOnly | - read-only or not |
|
inlinevirtual |
Provides the maximum number of events that can be executed by this sequenceable property
name | - property identifier (name) |
nrEvents | - maximum number of events that can be handles by the device |
References CDeviceBase< T, U >::IsPropertySequenceable().
|
inlinevirtual |
Obtain property type (string, float or integer)
|
inlinevirtual |
Provides upper limit for a property that has property limits
name | - property identifier (name) |
hiLimit | - returns upper limit |
|
inlinevirtual |
Returns the allowed value of the property, given its index. Intended for enumerating allowed property values.
propertyName | |
index | |
value |
References CDeviceUtils::CopyLimitedString().
|
inlineprotected |
Gets the received string from the serial port, waiting for the terminating character sequence.
portName | |
term | - terminating string, e.g. CR or CR,LF, or something else |
ans | - answer string without the terminating characters |
|
inlineprotected |
Not to be confused with MM::PortType MM::Serial::GetPortType() const.
|
inlinevirtual |
Checks if device supports a given property.
|
inlineprotected |
Sets-up the standard set of error codes and error messages.
References CDeviceBase< T, U >::SetErrorText().
|
inlineprotected |
Check if we have callback mechanism set up.
Referenced by CDeviceBase< T, U >::GetParentHub().
|
inline |
Check if the property value is equal to a specific string
name | - property identifier (name) |
value | - the value to compare to |
|
inlinevirtual |
Checks whether the property can be run in a sequence
name | - property identifier (name) |
sequenceable | - sequenceable or not |
Referenced by CDeviceBase< T, U >::GetPropertySequenceMaxLength(), CDeviceBase< T, U >::StartPropertySequence(), and CDeviceBase< T, U >::StopPropertySequence().
|
inlineprotected |
Output the specified text message to the log stream.
msg | - message text |
debugOnly | - if true the message will be sent only in the log-debug mode |
References MM::Core::LogMessage().
Referenced by CDeviceBase< T, U >::AssignToHub(), and CDeviceBase< T, U >::SetPropertyLimits().
|
inlineprotected |
Output the specified text message to the log stream.
msg | - message text |
debugOnly | - if true the message will be sent only in the log-debug mode |
References MM::Core::LogMessage().
|
inlineprotected |
Output the text message of specified code to the log stream.
errorCode | - error code |
debugOnly | - if true the message will be sent only in the log-debug mode |
References CDeviceBase< T, U >::GetErrorText(), and MM::Core::LogMessage().
|
inlineprotected |
Outputs time difference between two time stamps. Handy for hardware profiling
start | - Time stamp for start of Process |
end | - Time stamp for end of Process |
debugOnly | - if true the message will be sent only in the log-debug mode |
References CDeviceBase< T, U >::LogTimeDiff().
|
inlineprotected |
Outputs time difference between two time stamps. Handy for hardware profiling
start | - Time stamp for start of Process |
end | - Time stamp for end of Process |
message | - message that will be displayed in output |
debugOnly | - if true the message will be sent only in the log-debug mode |
References MM::Core::LogMessage().
Referenced by CDeviceBase< T, U >::LogTimeDiff().
|
inlineprotected |
Something changed in the property structure. Signals the need for GUI update. This function should be called only after the initialize function finished. Calling it in the constructor or in the Initialize function will cause other device adapters to be called before they are initialized.
|
inlineprotected |
Signals to the core that a property value has changed.
References MM::Core::OnPropertyChanged().
|
inlineprotected |
Clears the serial port buffers
|
inlineprotected |
Reads the current contents of Rx serial buffer.
|
inlinevirtual |
This function is used by the Core to communicate a sequence to the device Sends the sequence to the device by calling the properties functor
name | - name of the sequenceable property |
|
inlineprotected |
Sends an ASCII string withe the specified terminating characters to the serial port.
portName | |
command | - command string |
term | - terminating string, e.g. CR or CR,LF, or something else |
|
inline |
Sets an entire array of allowed values.
|
inlinevirtual |
Sets the callback for accessing parent functionality (used only by the calling code).
|
inlinevirtual |
Returns the device delay used for synchronization by the calling code. Delay of 0 means that the device should be synchronized by polling with the Busy() method.
|
inlinevirtual |
Assigns description string for a device (for use only by the calling code).
|
inlineprotected |
Defines the error text associated with the code.
Referenced by CDeviceBase< T, U >::InitializeDefaultErrorMessages().
|
inlinevirtual |
Sets the device label (for use only by the calling code). Labels are usually manipulated by the parent application and used for high-level programming.
|
inlinevirtual |
Sets the library handle (for use only by the calling code).
|
inlinevirtual |
Assigns a name for the module (for use only by the calling code).
|
inlinevirtual |
Sets the property value.
name | - property name |
value | - property value |
|
inline |
Define limits for properties with continuous range of values
References CDeviceBase< T, U >::LogMessage().
|
inlinevirtual |
Starts a (TTL-triggered) sequence for the given property Should be overridden by the device adapter (when a sequence is implemented)
name | - property for which the sequence should be started |
References CDeviceBase< T, U >::IsPropertySequenceable().
|
inlinevirtual |
Stops a (TTL-triggered) sequence for the given property Should be overridden by the device adapter (when a sequence is implemented)
name | - property for which the sequence should be started |
References CDeviceBase< T, U >::IsPropertySequenceable().
|
inline |
Update property value from the hardware.
|
inline |
Refresh the entire state of the device and synchronize property values with the actual state of the hardware.
|
inlinevirtual |
Signals if the device responds to different delay settings. Default device behavior is to ignore delays and use busy signals instead.
|
inlineprotected |
Sends an array of bytes to the com port.