46const char*
const g_Msg_ERR =
"Unknown error in the device";
70" Either the property already has a set of discrete values, or the range is invalid";
83inline long nint(
double value )
85 return (
long)floor( 0.5 + value);
95template <
class T,
class U>
124 description_ = descr;
201 int nRet = properties_.
Get(name, strVal);
216 int nRet = properties_.
Get(name, strVal);
218 val = atof(strVal.c_str());
231 int nRet = properties_.
Get(name, strVal);
233 val = atol(strVal.c_str());
248 int nRet = properties_.
Get(name, strVal);
250 return strcmp(val, strVal.c_str()) == 0;
463 int ret = GetSequenceableProperty(&pProp, name);
482 int ret = GetSequenceableProperty(&pProp, name);
501 int ret = GetSequenceableProperty(&pProp, name);
519 if (!properties_.
GetName(uIdx, strName))
547 int ret = properties_.
Set(name, value);
600 if (values.size() < index)
620 return properties_.
CreateProperty(name, value, eType, readOnly, pAct, isPreInitProperty);
636 int(U::*memberFunction)(
MM::PropertyBase* pProp,
MM::ActionType eAct), bool isPreInitProperty=false) {
638 return CreateProperty(name, value, eType, readOnly, pAct, isPreInitProperty);
648 std::ostringstream oss;
666 std::ostringstream oss;
693 std::ostringstream os;
694 os <<
"Device adapter requests invalid values ( " << low <<
", ";
695 os << high <<
") for property: " << name;
773 return properties_.
Update(name);
782 return properties_.
Apply(name);
790 std::map<int, std::string>::const_iterator it;
791 it = messages_.find(errorCode);
792 if (it == messages_.end())
795 std::ostringstream osTxt;
796 osTxt <<
"Error code " << errorCode <<
" (" << std::setbase(16) << errorCode <<
" hex)";
802 std::ostringstream stringStreamMessage;
803 stringStreamMessage << it->second.c_str();
805 if( 2<=errorCode && errorCode<=5 )
827 parentID_ = parentId;
861 messages_[errorCode] = text;
866 return morePropertyErrorInfo_.c_str();
871 morePropertyErrorInfo_ = ptext;
881 int LogMessage(
const char* msg,
bool debugOnly =
false)
const
884 return callback_->
LogMessage(
this, msg, debugOnly);
895 int LogMessage(
const std::string& msg,
bool debugOnly =
false)
const
898 return callback_->
LogMessage(
this, msg.c_str(), debugOnly);
915 return callback_->
LogMessage(
this, text, debugOnly);
934 std::ostringstream os;
936 os << message << t.
toString() <<
" seconds";
938 return callback_->
LogMessage(
this, os.str().c_str(), debugOnly);
954 return LogTimeDiff(start, end,
"Process took: " , debugOnly);
1007 return callback_->
GetDevice(
this, deviceLabel);
1036 int WriteToComPort(
const char* portLabel,
const unsigned char* buf,
unsigned bufLength)
1039 return callback_->
WriteToSerial(
this, portLabel, buf, bufLength);
1070 const unsigned long MAX_BUFLEN = 2000;
1071 char buf[MAX_BUFLEN];
1074 int ret = callback_->
GetSerialAnswer(
this, portName, MAX_BUFLEN, buf, term);
1087 int ReadFromComPort(
const char* portLabel,
unsigned char* buf,
unsigned bufLength,
unsigned long& read)
1090 return callback_->
ReadFromSerial(
this, portLabel, buf, bufLength, read);
1236 return callback_ == 0 ? false :
true;
1293 template<
class T_HUB>
1300 hub->GetLabel(hubLabel);
1307 bool PropertyDefined(
const char* propName)
const
1309 return properties_.
Find(propName) != 0;
1322 int GetSequenceableProperty(
MM::Property** pProp,
const char* name)
const
1324 *pProp = properties_.
Find(name);
1331 bool sequenceable = (*pProp)->IsSequenceable();
1332 if (!sequenceable) {
1342 std::string moduleName_;
1343 std::string description_;
1344 std::map<int, std::string> messages_;
1349 mutable std::string morePropertyErrorInfo_;
1350 std::string parentID_;
1392 std::vector<std::string> allowedValues;
1393 allowedValues.push_back(
"0");
1394 allowedValues.push_back(
"1");
1478 for (
const auto& p : addedTags_)
1480 md.
AddTag(p.first.c_str(), p.second.c_str());
1489 bool stopOnOverflow) = 0;
1523 virtual void AddTag(
const char* key,
const char* deviceLabel,
const char* value)
1526 if (deviceLabel != std::string(
"_"))
1532 addedTags_[k] = value;
1537 addedTags_.erase(key);
1556 const unsigned* ,
const unsigned* ,
1563 unsigned* ,
unsigned* ,
unsigned* )
1569 std::map<std::string, std::string> addedTags_;
1601 virtual bool Busy() {
return busy_;}
1638 thd_->
Start(numImages,interval_ms);
1639 stopWhenCBOverflows_ = stopOnOverflow;
1727 enum { default_numImages=1, default_intervalMS = 100 };
1730 :intervalMs_(default_intervalMS)
1731 ,numImages_(default_numImages)
1748 void Start(
long numImages,
double intervalMs)
1752 numImages_=numImages;
1753 intervalMs_=intervalMs;
1802 camera_->
LogMessage(
"SeqAcquisition interrupted by the user\n");
1831 bool stopWhenCBOverflows_;
1844 virtual int GetPositionUm(
double& pos) = 0;
1845 virtual int SetPositionUm(
double pos) = 0;
1852 virtual int SetRelativePositionUm(
double d)
1855 int ret = GetPositionUm(pos);
1858 return SetPositionUm(pos + d);
1861 virtual int SetAdapterOriginUm(
double )
1866 virtual int Move(
double )
1896 virtual int UsesOnStagePositionChanged(
bool& result)
const
1902 virtual int IsStageLinearSequenceable(
bool& isSequenceable)
const
1904 isSequenceable =
false;
1908 virtual int GetStageSequenceMaxLength(
long& )
const
1913 virtual int StartStageSequence()
1918 virtual int StopStageSequence()
1923 virtual int ClearStageSequence()
1928 virtual int AddToStageSequence(
double )
1933 virtual int SendStageSequence()
1938 virtual int SetStageLinearSequence(
double,
long)
1971 bool mirrorX, mirrorY;
1972 GetOrientation(mirrorX, mirrorY);
1974 long xSteps{}, ySteps{};
1984 return {xSteps, ySteps};
1992 bool mirrorX, mirrorY;
1993 GetOrientation(mirrorX, mirrorY);
1995 double x_um{}, y_um{};
2006 return {x_um, y_um};
2012 long xSteps = posSteps.first;
2013 long ySteps = posSteps.second;
2030 bool mirrorX, mirrorY;
2031 GetOrientation(mirrorX, mirrorY);
2032 double xPos = xPos_ + dx;
2033 double yPos = yPos_ + dy;
2057 bool mirrorX, mirrorY;
2058 GetOrientation(mirrorX, mirrorY);
2079 long xSteps, ySteps;
2085 x_um = pos_um.first;
2086 y_um = pos_um.second;
2102 long xSteps, ySteps;
2182 void GetOrientation(
bool& mirrorX,
bool& mirrorY)
2187 mirrorX = strcmp(val,
"1") == 0 ? true :
false;
2191 mirrorY = strcmp(val,
"1") == 0 ? true :
false;
2241 virtual int GetDASequenceMaxLength(
long& )
const
2246 virtual int StartDASequence()
2251 virtual int StopDASequence() {
2255 virtual int ClearDASequence() {
2259 virtual int AddToDASequence(
double )
2264 virtual int SendDASequence() {
2283 virtual int GetSLMSequenceMaxLength(
long& )
const
2288 virtual int StartSLMSequence()
2293 virtual int StopSLMSequence() {
2297 virtual int ClearSLMSequence() {
2301 virtual int AddToSLMSequence(
const unsigned char *
const )
2306 virtual int AddToSLMSequence(
const unsigned int *
const )
2311 virtual int SendSLMSequence() {
2322 double GetXMinimum() {
return 0.0;};
2323 double GetYMinimum() {
return 0.0;};
2371 for (
unsigned i=0; i<installedDevices.size(); i++)
2372 delete installedDevices[i];
2373 installedDevices.clear();
2380 std::vector<MM::Device*> installedDevices;
2419 std::map<std::string, long>::const_iterator it;
2420 it = labels_.find(label);
2421 if (it == labels_.end())
2437 if (gateOpen_ != open) {
2493 std::map<std::string, long>::const_iterator it;
2494 for (it=labels_.begin(); it!=labels_.end(); it++)
2498 if (it->second == pos)
2516 std::map<std::string, long>::iterator it;
2517 it = labels_.find(label);
2518 if (it != labels_.end() && it->second != pos)
2525 for (it=labels_.begin(); it!=labels_.end(); it++)
2527 if (it->second == pos)
2535 labels_[label] = pos;
2539 std::string strLabel(label);
2540 std::vector<std::string> values;
2541 for (it=labels_.begin(); it!=labels_.end(); it++)
2542 values.push_back(it->first);
2553 std::map<std::string, long>::const_iterator it;
2554 it = labels_.find(label);
2555 if (it == labels_.end())
2601 std::vector<std::string> sequence = pProp->
GetSequence();
2602 for (std::vector<std::string>::iterator it = sequence.begin(); it != sequence.end(); ++it) {
2607 std::stringstream s;
2616 std::vector<std::string>::iterator it;
2617 for ( it=sequence.begin() ; it < sequence.end(); it++ )
2663 std::map<std::string, long> labels_;
2677 int InvertDirection(
bool )
const char *const g_Msg_DUPLICATE_PROPERTY
Definition DeviceBase.h:49
const char *const g_Msg_INTERNAL_INCONSISTENCY
Definition DeviceBase.h:53
const char *const g_Msg_DEVICE_NOT_YET_IMPLEMENTED
Definition DeviceBase.h:81
const char *const g_Msg_DEVICE_CAN_NOT_SET_PROPERTY
Definition DeviceBase.h:75
const char *const g_Msg_DEVICE_CAMERA_BUSY_ACQUIRING
Definition DeviceBase.h:74
const char *const g_Msg_EXCEPTION_IN_THREAD
Definition DeviceBase.h:71
const char *const g_Msg_DEVICE_COMM_HUB_MISSING
Definition DeviceBase.h:77
const char *const g_Msg_NO_PROPERTY_DATA
Definition DeviceBase.h:63
const char *const g_Msg_SERIAL_TIMEOUT
Definition DeviceBase.h:61
const char *const g_Msg_EXCEPTION_IN_ON_THREAD_EXITING
Definition DeviceBase.h:72
const char *const g_Msg_UNKNOWN_LABEL
Definition DeviceBase.h:55
const char *const g_Msg_INVALID_PROPERTY
Definition DeviceBase.h:47
const char *const g_Msg_BUFFER_OVERFLOW
Definition DeviceBase.h:66
const char *const g_Msg_SERIAL_INVALID_RESPONSE
Definition DeviceBase.h:60
const char *const g_Msg_DEVICE_PROPERTY_NOT_SEQUENCEABLE
Definition DeviceBase.h:79
const char *const g_Msg_DEVICE_NONEXISTENT_CHANNEL
Definition DeviceBase.h:68
const char *const g_Msg_SERIAL_BUFFER_OVERRUN
Definition DeviceBase.h:59
long nint(double value)
Definition DeviceBase.h:83
const char *const g_Msg_DEVICE_NOT_CONNECTED
Definition DeviceBase.h:76
const char *const g_Msg_DEVICE_SEQUENCE_TOO_LARGE
Definition DeviceBase.h:80
const char *const g_Msg_INVALID_INPUT_PARAM
Definition DeviceBase.h:65
const char *const g_Msg_UNSUPPORTED_COMMAND
Definition DeviceBase.h:56
const char *const g_Msg_SELF_REFERENCE
Definition DeviceBase.h:62
const char *const g_Msg_SEQUENCE_ACQUISITION_THREAD_EXITING
Definition DeviceBase.h:73
const char *const g_Msg_DEVICE_DUPLICATE_LIBRARY
Definition DeviceBase.h:78
const char *const g_Msg_UNSUPPORTED_DATA_FORMAT
Definition DeviceBase.h:52
const char *const g_Msg_SERIAL_COMMAND_FAILED
Definition DeviceBase.h:67
const char *const g_Msg_NOT_SUPPORTED
Definition DeviceBase.h:54
const char *const g_Msg_UNKNOWN_POSITION
Definition DeviceBase.h:57
const char *const g_Msg_DEVICE_INVALID_PROPERTY_LIMTS
Definition DeviceBase.h:69
const char *const g_Msg_INVALID_PROPERTY_VALUE
Definition DeviceBase.h:48
const char *const g_Msg_INVALID_PROPERTY_TYPE
Definition DeviceBase.h:50
const char *const g_Msg_NO_CALLBACK_REGISTERED
Definition DeviceBase.h:58
const char *const g_Msg_DEVICE_DUPLICATE_LABEL
Definition DeviceBase.h:64
const char *const g_Msg_ERR
Definition DeviceBase.h:46
const char *const g_Msg_NATIVE_MODULE_FAILED
Definition DeviceBase.h:51
#define DEVICE_NO_CALLBACK_REGISTERED
Definition MMDeviceConstants.h:60
#define DEVICE_SEQUENCE_TOO_LARGE
Definition MMDeviceConstants.h:86
#define DEVICE_NOT_SUPPORTED
Definition MMDeviceConstants.h:56
#define DEVICE_DUPLICATE_PROPERTY
Definition MMDeviceConstants.h:51
#define DEVICE_SERIAL_INVALID_RESPONSE
Definition MMDeviceConstants.h:63
#define DEVICE_UNKNOWN_LABEL
Definition MMDeviceConstants.h:57
#define DEVICE_PROPERTY_NOT_SEQUENCEABLE
Definition MMDeviceConstants.h:85
#define DEVICE_NO_PROPERTY_DATA
Definition MMDeviceConstants.h:66
#define DEVICE_BUFFER_OVERFLOW
Definition MMDeviceConstants.h:69
#define DEVICE_UNSUPPORTED_DATA_FORMAT
Definition MMDeviceConstants.h:54
#define DEVICE_NONEXISTENT_CHANNEL
Definition MMDeviceConstants.h:70
#define DEVICE_CAMERA_BUSY_ACQUIRING
Definition MMDeviceConstants.h:77
#define DEVICE_UNSUPPORTED_COMMAND
Definition MMDeviceConstants.h:58
#define DEVICE_ERR
Definition MMDeviceConstants.h:48
#define DEVICE_SERIAL_TIMEOUT
Definition MMDeviceConstants.h:64
#define DEVICE_NATIVE_MODULE_FAILED
Definition MMDeviceConstants.h:53
#define DEVICE_OK
Definition MMDeviceConstants.h:47
#define DEVICE_INVALID_PROPERTY_TYPE
Definition MMDeviceConstants.h:52
#define DEVICE_SELF_REFERENCE
Definition MMDeviceConstants.h:65
#define DEVICE_DUPLICATE_LABEL
Definition MMDeviceConstants.h:67
#define DEVICE_SERIAL_BUFFER_OVERRUN
Definition MMDeviceConstants.h:62
#define DEVICE_INTERNAL_INCONSISTENCY
Definition MMDeviceConstants.h:55
#define DEVICE_UNKNOWN_POSITION
Definition MMDeviceConstants.h:59
#define DEVICE_SERIAL_COMMAND_FAILED
Definition MMDeviceConstants.h:61
#define DEVICE_DUPLICATE_LIBRARY
Definition MMDeviceConstants.h:84
#define DEVICE_CAN_NOT_SET_PROPERTY
Definition MMDeviceConstants.h:79
#define DEVICE_INVALID_PROPERTY_VALUE
Definition MMDeviceConstants.h:50
#define DEVICE_INVALID_PROPERTY
Definition MMDeviceConstants.h:49
#define DEVICE_COMM_HUB_MISSING
Definition MMDeviceConstants.h:83
#define DEVICE_INVALID_PROPERTY_LIMTS
Definition MMDeviceConstants.h:71
#define DEVICE_NOT_CONNECTED
Definition MMDeviceConstants.h:82
#define DEVICE_LOCALLY_DEFINED_ERROR
Definition MMDeviceConstants.h:81
#define DEVICE_NOT_YET_IMPLEMENTED
Definition MMDeviceConstants.h:88
#define DEVICE_INVALID_INPUT_PARAM
Definition MMDeviceConstants.h:68
Base class for creating auto-focusing modules.
Definition DeviceBase.h:2223
Base class for creating camera device adapters.
Definition DeviceBase.h:1378
virtual int GetMultiROI(unsigned *, unsigned *, unsigned *, unsigned *, unsigned *)
Definition DeviceBase.h:1562
virtual int StopExposureSequence()
Definition DeviceBase.h:1501
virtual int SetMultiROI(const unsigned *, const unsigned *, const unsigned *, const unsigned *, unsigned)
Definition DeviceBase.h:1555
virtual bool SupportsMultiROI()
Definition DeviceBase.h:1540
virtual unsigned GetImageBytesPerPixel() const =0
Return image buffer pixel depth in bytes.
virtual int GetExposureSequenceMaxLength(long &) const
Definition DeviceBase.h:1491
virtual int StartExposureSequence()
Definition DeviceBase.h:1496
virtual int GetMultiROICount(unsigned &)
Definition DeviceBase.h:1550
CCameraBase()
Definition DeviceBase.h:1389
virtual int StartSequenceAcquisition(double interval)=0
Start continuous sequence acquisition.
virtual unsigned GetImageHeight() const =0
Return image buffer Y-size in pixels.
virtual int StopSequenceAcquisition()=0
Stop and wait for the thread to finish.
virtual void RemoveTag(const char *key)
Remove an existing tag from the metadata associated with this device.
Definition DeviceBase.h:1535
virtual int AddToExposureSequence(double)
Definition DeviceBase.h:1511
virtual int ClearExposureSequence()
Definition DeviceBase.h:1506
virtual unsigned GetNumberOfChannels() const
Return the number of channels.
Definition DeviceBase.h:1436
virtual int StartSequenceAcquisition(long numImages, double interval_ms, bool stopOnOverflow)=0
Start sequence acquisition.
virtual int SendExposureSequence() const
Definition DeviceBase.h:1516
virtual const unsigned char * GetImageBuffer()=0
Return pixel data.
virtual bool IsMultiROISet()
Definition DeviceBase.h:1545
virtual unsigned GetNumberOfComponents() const
Return the number of components in this image.
Definition DeviceBase.h:1425
virtual int SnapImage()=0
Perform exposure and grab a single image.
virtual unsigned GetImageWidth() const =0
Return image buffer X-size in pixels.
virtual void AddTag(const char *key, const char *deviceLabel, const char *value)
Add new tag or modify the value of an existing one.
Definition DeviceBase.h:1523
virtual const unsigned char * GetImageBuffer(unsigned)
Return the image buffer for a specific channel.
Definition DeviceBase.h:1460
virtual bool IsCapturing()=0
Indicate whether sequence acquisition is currently running.
virtual const unsigned int * GetImageBufferAsRGB32()
Return pixel data with interleaved RGB pixels in 32 bpp format.
Definition DeviceBase.h:1467
virtual void GetTags(char *serializedMetadata)
Fill serializedMetadata with the device's metadata tags.
Definition DeviceBase.h:1475
virtual int GetChannelName(unsigned, char *name)
Return the channel name.
Definition DeviceBase.h:1448
Implement functionality common to all devices.
Definition DeviceBase.h:97
MM::Action< U > CPropertyAction
Definition DeviceBase.h:100
virtual bool GetErrorText(int errorCode, char *text) const
Obtain the error text associated with the error code.
Definition DeviceBase.h:788
virtual bool GetPropertyName(unsigned uIdx, char *name) const
Obtain the property name given the index.
Definition DeviceBase.h:516
const char * GetMorePropertyErrorInfo(void) const
Definition DeviceBase.h:864
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.
Definition DeviceBase.h:674
void InitializeDefaultErrorMessages()
Set up the standard set of error codes and error messages.
Definition DeviceBase.h:960
int LogMessageCode(const int errorCode, bool debugOnly=false) const
Output the text message of specified code to the log stream.
Definition DeviceBase.h:909
bool IsPropertyEqualTo(const char *name, const char *val) const
Check if the property value is equal to a specific string.
Definition DeviceBase.h:245
int CreateFloatProperty(const char *name, double value, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false)
Create a float-valued property for the device.
Definition DeviceBase.h:656
void SetErrorText(int errorCode, const char *text)
Define the error text associated with the code.
Definition DeviceBase.h:859
virtual void SetDelayMs(double delay)
Set the device delay used for synchronization by the calling code.
Definition DeviceBase.h:171
unsigned long GetClockTicksUs()
Get the system ticks in microseconds.
Definition DeviceBase.h:1212
CDeviceBase()
Definition DeviceBase.h:850
int UpdateStatus()
Refresh the entire state of the device and synchronize property values with the actual state of the h...
Definition DeviceBase.h:763
int OnPropertiesChanged()
Signal that something changed in the property structure.
Definition DeviceBase.h:1124
int SetPropertyLimits(const char *name, double low, double high)
Define limits for properties with a continuous range of values.
Definition DeviceBase.h:682
int CreateIntegerProperty(const char *name, long value, bool readOnly, MM::ActionFunctor *pAct=0, bool isPreInitProperty=false)
Create an integer-valued property for the device.
Definition DeviceBase.h:644
MM::Hub * GetParentHub() const
Return the parent Hub device pointer, or null if there isn't any.
Definition DeviceBase.h:1280
virtual void GetParentID(char *parentID) const
Definition DeviceBase.h:839
bool IsCallbackRegistered() const
Check if we have callback mechanism set up.
Definition DeviceBase.h:1234
MM::ActionEx< U > CPropertyActionEx
Definition DeviceBase.h:101
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.
Definition DeviceBase.h:618
int OnXYStagePositionChanged(double xPos, double yPos)
Report position change (for XY stage).
Definition DeviceBase.h:1170
int GetProperty(const char *name, long &val)
Obtain the value of the property.
Definition DeviceBase.h:228
int OnSLMExposureChanged(double exposure)
Signal that the SLM exposure has changed.
Definition DeviceBase.h:1190
int PurgeComPort(const char *portLabel)
Clear the serial port buffers.
Definition DeviceBase.h:1097
void EnableDelay(bool state=true)
Enable response to delay settings.
Definition DeviceBase.h:1253
virtual int StartPropertySequence(const char *name)
Start a (TTL-triggered) sequence for the given property.
Definition DeviceBase.h:403
int LogTimeDiff(MM::MMTime start, MM::MMTime end, bool debugOnly=false) const
Output time difference between two time stamps.
Definition DeviceBase.h:952
void CreateHubIDProperty()
Create read-only property displaying parentID (hub label).
Definition DeviceBase.h:1266
void GetLoadedDeviceOfType(MM::DeviceType devType, char *deviceName, const unsigned int deviceIterator)
Provide access to the names of devices of a given type.
Definition DeviceBase.h:1023
int ClearAllowedValues(const char *name)
Clear allowed values, and make any value valid.
Definition DeviceBase.h:712
int LogMessage(const char *msg, bool debugOnly=false) const
Output the specified text message to the log stream.
Definition DeviceBase.h:881
int OnPropertyChanged(const char *propName, const char *propValue)
Signal to the core that a property value has changed.
Definition DeviceBase.h:1134
virtual double GetDelayMs() const
Return device delay used for synchronization by the calling code.
Definition DeviceBase.h:163
virtual bool SupportsDeviceDetection(void)
Definition DeviceBase.h:817
virtual int ClearPropertySequence(const char *name)
Clear a property sequence.
Definition DeviceBase.h:460
virtual bool HasProperty(const char *name) const
Check if device supports a given property.
Definition DeviceBase.h:560
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.
Definition DeviceBase.h:1068
MM::Core * GetCoreCallback() const
Get the callback object.
Definition DeviceBase.h:1242
virtual bool UsesDelay()
Signal if the device responds to different delay settings.
Definition DeviceBase.h:183
int UpdateProperty(const char *name)
Update property value from the hardware.
Definition DeviceBase.h:771
T_HUB * AssignToHub()
Return the parent Hub device pointer, or null if there isn't any.
Definition DeviceBase.h:1294
virtual int AddToPropertySequence(const char *name, const char *value)
Add to a property sequence.
Definition DeviceBase.h:479
MM::PortType GetSerialPortType(const char *portLabel)
TODO-BRIEF.
Definition DeviceBase.h:1109
virtual int GetPropertySequenceMaxLength(const char *name, long &nrEvents) const
Provide the maximum number of events that can be executed by this sequenceable property.
Definition DeviceBase.h:372
virtual int HasPropertyLimits(const char *name, bool &hasLimits) const
Definition DeviceBase.h:295
MM::MMTime GetCurrentMMTime()
Get current time.
Definition DeviceBase.h:1223
virtual int StopPropertySequence(const char *name)
Stop a (TTL-triggered) sequence for the given property.
Definition DeviceBase.h:432
virtual void SetModuleName(const char *name)
Assign a name for the module (for use only by the calling code).
Definition DeviceBase.h:106
virtual unsigned GetNumberOfPropertyValues(const char *propertyName) const
Return the number of allowed property values.
Definition DeviceBase.h:575
virtual int SetProperty(const char *name, const char *value)
Set the property value.
Definition DeviceBase.h:545
virtual int SendPropertySequence(const char *name)
Send the property sequence to the device.
Definition DeviceBase.h:498
virtual void GetLabel(char *name) const
Return the device label (for use only by the calling code).
Definition DeviceBase.h:152
int LogMessage(const std::string &msg, bool debugOnly=false) const
Output the specified text message to the log stream.
Definition DeviceBase.h:895
virtual void GetDescription(char *name) const
Return device description (for use only by the calling code).
Definition DeviceBase.h:130
int WriteToComPort(const char *portLabel, const unsigned char *buf, unsigned bufLength)
Send an array of bytes to the COM port.
Definition DeviceBase.h:1036
virtual void SetLabel(const char *label)
Set the device label (for use only by the calling code).
Definition DeviceBase.h:141
virtual bool GetPropertyValueAt(const char *propertyName, unsigned index, char *value) const
Return the allowed value of the property, given its index.
Definition DeviceBase.h:593
virtual void GetModuleName(char *name) const
Return the module name (for use only by the calling code).
Definition DeviceBase.h:114
int SendSerialCommand(const char *portName, const char *command, const char *term)
Send an ASCII string with the specified terminating characters to the serial port.
Definition DeviceBase.h:1052
virtual void SetParentID(const char *parentId)
Definition DeviceBase.h:825
int GetPropertyData(const char *name, const char *value, long &data)
Obtain data field associated with the allowed property value.
Definition DeviceBase.h:736
int GetCurrentPropertyData(const char *name, long &data)
Obtain data field associated with the currently applied property value.
Definition DeviceBase.h:749
int OnMagnifierChanged()
Signal that the magnifier has changed.
Definition DeviceBase.h:1200
int OnStagePositionChanged(double pos)
Report position change (for single-axis stage).
Definition DeviceBase.h:1152
virtual unsigned GetNumberOfProperties() const
Return the number of properties.
Definition DeviceBase.h:188
virtual int GetProperty(const char *name, char *value) const
Obtain the value of the property.
Definition DeviceBase.h:196
int ApplyProperty(const char *name)
Apply the current property value to the hardware.
Definition DeviceBase.h:780
virtual MM::DeviceDetectionStatus DetectDevice(void)
Definition DeviceBase.h:820
virtual int GetPropertyType(const char *name, MM::PropertyType &pt) const
Obtain property type (string, float, or integer).
Definition DeviceBase.h:529
int ReadFromComPort(const char *portLabel, unsigned char *buf, unsigned bufLength, unsigned long &read)
Read the current contents of Rx serial buffer.
Definition DeviceBase.h:1087
int OnExposureChanged(double exposure)
Signal that the exposure has changed.
Definition DeviceBase.h:1180
virtual int GetPropertyInitStatus(const char *name, bool &preInit) const
Check whether the property is pre-init.
Definition DeviceBase.h:281
int LogTimeDiff(MM::MMTime start, MM::MMTime end, const std::string &message, bool debugOnly=false) const
Output time difference between two time stamps.
Definition DeviceBase.h:932
void SetMorePropertyErrorInfo(const char *ptext) const
Definition DeviceBase.h:869
virtual void SetDescription(const char *descr)
Assign description string for a device (for use only by the calling code).
Definition DeviceBase.h:122
virtual int GetPropertyLowerLimit(const char *name, double &lowLimit) const
Provide lower limit for a property that has property limits.
Definition DeviceBase.h:314
virtual int GetPropertyUpperLimit(const char *name, double &hiLimit) const
Provide upper limit for a property that has property limits.
Definition DeviceBase.h:333
virtual int GetPropertyReadOnly(const char *name, bool &readOnly) const
Check whether the property is read-only.
Definition DeviceBase.h:261
int GetProperty(const char *name, double &val)
Obtain the value of the property.
Definition DeviceBase.h:213
MM::Device * GetDevice(const char *deviceLabel) const
Get the handle (pointer) to the specified device label.
Definition DeviceBase.h:1004
int AddAllowedValue(const char *name, const char *value)
Add a single allowed value.
Definition DeviceBase.h:720
int SetAllowedValues(const char *name, std::vector< std::string > &values)
Set an entire array of allowed values.
Definition DeviceBase.h:704
int AddAllowedValue(const char *name, const char *value, long data)
Add a single allowed value, plus additional data.
Definition DeviceBase.h:728
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.
Definition DeviceBase.h:635
virtual ~CDeviceBase()
Definition DeviceBase.h:854
virtual int IsPropertySequenceable(const char *name, bool &sequenceable) const
Check whether the property can be run in a sequence.
Definition DeviceBase.h:352
virtual void SetCallback(MM::Core *cbk)
Set the callback for accessing parent functionality (used only by the calling code).
Definition DeviceBase.h:176
static const char * ConvertToString(long lnVal)
Definition DeviceUtils.cpp:63
static bool CopyLimitedString(char *pszTarget, const char *pszSource)
Definition DeviceUtils.cpp:43
Base class for creating Galvo devices.
Definition DeviceBase.h:2321
Base class for creating generic devices.
Definition DeviceBase.h:1366
Base class for creating image processing modules.
Definition DeviceBase.h:2232
Definition DeviceBase.h:1725
MM::MMTime GetStartTime()
Definition DeviceBase.h:1783
void Start(long numImages, double intervalMs)
Definition DeviceBase.h:1748
void Suspend()
Definition DeviceBase.h:1766
void Resume()
Definition DeviceBase.h:1774
long GetNumberOfImages()
Definition DeviceBase.h:1787
void Stop()
Definition DeviceBase.h:1743
void SetLength(long images)
Definition DeviceBase.h:1779
bool IsSuspended()
Definition DeviceBase.h:1770
~BaseSequenceThread()
Definition DeviceBase.h:1741
void UpdateActualDuration()
Definition DeviceBase.h:1789
CLegacyCameraBase * GetCamera()
Definition DeviceBase.h:1786
BaseSequenceThread(CLegacyCameraBase *pCam)
Definition DeviceBase.h:1729
bool IsStopped()
Definition DeviceBase.h:1762
long GetImageCounter()
Definition DeviceBase.h:1782
MM::MMTime GetActualDuration()
Definition DeviceBase.h:1784
double GetIntervalMs()
Definition DeviceBase.h:1778
Definition DeviceBase.h:1705
CaptureRestartHelper(CLegacyCameraBase *pCam)
Definition DeviceBase.h:1710
Legacy base class for creating camera device adapters.
Definition DeviceBase.h:1584
virtual void setStopOnOverflow(bool stop)
Definition DeviceBase.h:1700
virtual bool isStopOnOverflow()
Definition DeviceBase.h:1699
virtual ~CLegacyCameraBase()
Definition DeviceBase.h:1591
virtual int ThreadRun(void)
Definition DeviceBase.h:1652
virtual double GetIntervalMs()
Definition DeviceBase.h:1679
CLegacyCameraBase()
Definition DeviceBase.h:1586
virtual bool Busy()
Definition DeviceBase.h:1601
virtual int StartSequenceAcquisition(long numImages, double interval_ms, bool stopOnOverflow)
Start sequence acquisition.
Definition DeviceBase.h:1630
virtual void OnThreadExiting()
Definition DeviceBase.h:1684
virtual int InsertImage()
Definition DeviceBase.h:1668
friend class BaseSequenceThread
Definition DeviceBase.h:1834
virtual long GetNumberOfImages()
Definition DeviceBase.h:1681
virtual bool IsCapturing()
Indicate whether sequence acquisition is currently running.
Definition DeviceBase.h:1643
virtual int StartSequenceAcquisition(double interval)
Start continuous sequence acquisition.
Definition DeviceBase.h:1608
virtual long GetImageCounter()
Definition DeviceBase.h:1680
virtual int StopSequenceAcquisition()
Stop and wait for the thread to finish.
Definition DeviceBase.h:1616
Base class for creating devices that can change magnification (NS).
Definition DeviceBase.h:2274
Base class for creating pressure pump device adapters.
Definition DeviceBase.h:2688
Base class for creating SLM devices that can project images.
Definition DeviceBase.h:2282
Base class for creating serial port device adapters.
Definition DeviceBase.h:2215
Base class for creating shutter device adapters.
Definition DeviceBase.h:2207
Base class for creating ADC/DAC modules.
Definition DeviceBase.h:2240
Base class for creating single axis stage adapters.
Definition DeviceBase.h:1843
Base class for creating state device adapters such as filter wheels, objectives, turrets,...
Definition DeviceBase.h:2390
virtual int GetPosition(char *label) const
Obtain the state (position) label of the device.
Definition DeviceBase.h:2478
virtual int GetPositionLabel(long pos, char *label) const
Obtain the label associated with the position (state).
Definition DeviceBase.h:2491
virtual int SetPositionLabel(long pos, const char *label)
Create new label for the given position, or override the existing one.
Definition DeviceBase.h:2513
virtual int GetGateOpen(bool &open)
Definition DeviceBase.h:2448
virtual int GetPosition(long &pos) const
Obtain the state (position) index of the device.
Definition DeviceBase.h:2459
int OnLabel(MM::PropertyBase *pProp, MM::ActionType eAct)
Implement the default Label property action.
Definition DeviceBase.h:2565
CStateDeviceBase< U > CStateBase
Definition DeviceBase.h:2393
virtual int SetPosition(const char *label)
Set the state (position) of the device based on the state label.
Definition DeviceBase.h:2417
int OnStateChanged(long position)
Signal to the core that the state has changed, so that both "State" and "Label" properties should be ...
Definition DeviceBase.h:2646
virtual int GetLabelPosition(const char *label, long &pos) const
Obtain the position associated with a label.
Definition DeviceBase.h:2551
virtual int SetPosition(long pos)
Set the state (position) of the device based on the state index.
Definition DeviceBase.h:2407
CStateDeviceBase()
Definition DeviceBase.h:2395
virtual int SetGateOpen(bool open)
Implement a gate, i.e., a position where the state device is closed.
Definition DeviceBase.h:2435
Base class for creating volumetric pump device adapters.
Definition DeviceBase.h:2671
Base class for creating dual axis stage adapters.
Definition DeviceBase.h:1952
virtual int SetAdapterOriginUm(double newXUm, double newYUm)
Alter the software coordinate translation between micrometers and steps, such that the current positi...
Definition DeviceBase.h:2055
virtual int StartXYStageSequence()
Definition DeviceBase.h:2139
virtual int AddToXYStageSequence(double, double)
Add one value to the sequence.
Definition DeviceBase.h:2154
virtual int GetXYStageSequenceMaxLength(long &) const
Definition DeviceBase.h:2134
CXYStageBase()
Definition DeviceBase.h:1954
virtual int SetYOrigin()
Define the current position as Y = 0 (in hardware if possible).
Definition DeviceBase.h:2129
virtual int Move(double, double)
Definition DeviceBase.h:2119
std::pair< double, double > ConvertPositionStepsToUm(long xSteps, long ySteps)
Definition DeviceBase.h:1990
double GetCachedXUm()
Return the cached X position.
Definition DeviceBase.h:2177
virtual int SetPositionUm(double x_um, double y_um)
Definition DeviceBase.h:2009
double GetCachedYUm()
Definition DeviceBase.h:2178
virtual int GetPositionUm(double &x_um, double &y_um)
Definition DeviceBase.h:2077
virtual int SendXYStageSequence()
Signal that we are done sending sequence values so that the adapter can send the whole sequence to th...
Definition DeviceBase.h:2159
virtual int StopXYStageSequence()
Definition DeviceBase.h:2144
virtual int SetRelativePositionSteps(long x, long y)
Set relative position in steps.
Definition DeviceBase.h:2100
std::pair< long, long > ConvertPositionUmToSteps(double x_um, double y_um)
Definition DeviceBase.h:1969
virtual int SetRelativePositionUm(double dx, double dy)
Set relative position.
Definition DeviceBase.h:2028
virtual int ClearXYStageSequence()
Remove all values in the sequence.
Definition DeviceBase.h:2149
virtual int SetXOrigin()
Define the current position as X = 0 (in hardware if possible).
Definition DeviceBase.h:2124
virtual int UsesOnXYStagePositionChanged(bool &result) const
Return true when your device adapter uses OnXYStagePositionChanged callbacks.
Definition DeviceBase.h:2113
Base class for creating special HUB devices for managing device libraries.
Definition DeviceBase.h:2332
void AddInstalledDevice(MM::Device *pdev)
Definition DeviceBase.h:2377
virtual unsigned GetNumberOfInstalledDevices()
Return the number of child devices after DetectInstalledDevices was called.
Definition DeviceBase.h:2353
virtual int DetectInstalledDevices()
Detect installed child devices.
Definition DeviceBase.h:2345
virtual ~HubBase()
Definition DeviceBase.h:2335
HubBase()
Definition DeviceBase.h:2334
virtual void ClearInstalledDevices()
Remove all installed devices that were created by DetectInstalledDevices().
Definition DeviceBase.h:2369
virtual MM::Device * GetInstalledDevice(int devIdx)
Return a pointer to the device with index devIdx.
Definition DeviceBase.h:2361
Extended device action implementation.
Definition Property.h:109
Abstract interface to invoke specific action in the device.
Definition Property.h:76
Device action implementation.
Definition Property.h:87
Camera API.
Definition MMDevice.h:300
Callback API to the core control module.
Definition MMDevice.h:1583
virtual int OnPropertiesChanged(const Device *caller)=0
virtual MM::MMTime GetCurrentMMTime()=0
virtual unsigned long GetClockTicksUs(const Device *caller)=0
virtual int GetSerialAnswer(const Device *caller, const char *portName, unsigned long ansLength, char *answer, const char *term)=0
virtual int OnMagnifierChanged(const Device *caller)=0
Signal changes in magnification.
virtual int AcqFinished(const Device *caller, int statusCode)=0
virtual MM::PortType GetSerialPortType(const char *portName) const =0
virtual int SetSerialCommand(const Device *caller, const char *portName, const char *command, const char *term)=0
virtual int PurgeSerial(const Device *caller, const char *portName)=0
virtual int OnStagePositionChanged(const Device *caller, double pos)=0
Inform the UI when a stage has changed its position.
virtual void GetLoadedDeviceOfType(const Device *caller, MM::DeviceType devType, char *pDeviceName, const unsigned int deviceIterator)=0
Get the names of currently loaded devices of a given type.
virtual int OnExposureChanged(const Device *caller, double newExposure)=0
Inform the UI when the exposure time has changed.
virtual int WriteToSerial(const Device *caller, const char *port, const unsigned char *buf, unsigned long length)=0
virtual MM::Hub * GetParentHub(const MM::Device *caller) const =0
virtual int LogMessage(const Device *caller, const char *msg, bool debugOnly) const =0
Log a message (msg) in the Corelog output, labeled with the device name (derived from caller).
virtual int OnXYStagePositionChanged(const Device *caller, double xPos, double yPos)=0
Inform the UI when an XY stage has changed its position.
virtual int ReadFromSerial(const Device *caller, const char *port, unsigned char *buf, unsigned long length, unsigned long &read)=0
virtual Device * GetDevice(const Device *caller, const char *label)=0
Get a pointer to another device.
virtual int OnPropertyChanged(const Device *caller, const char *propName, const char *propValue)=0
Inform the UI that a property changed.
virtual int OnSLMExposureChanged(const Device *caller, double newExposure)=0
Inform the UI when the SLM exposure time has changed.
virtual int InsertImage(const Device *caller, const unsigned char *buf, unsigned width, unsigned height, unsigned bytePerPixel, unsigned nComponents, const char *serializedMetadata=nullptr)=0
Send a frame to the Core during sequence acquisition.
virtual int PrepareForAcq(const Device *caller)=0
Generic device interface.
Definition MMDevice.h:192
HUB device.
Definition MMDevice.h:1314
Utility class used both MMCore and devices to maintain time intervals in the uniform,...
Definition MMDevice.h:58
std::string toString() const
Definition MMDevice.h:144
Base API for all device properties.
Definition Property.h:39
virtual void SetSequenceable(long sequenceSize)=0
virtual std::vector< std::string > GetSequence() const =0
virtual bool Get(double &dVal) const =0
virtual bool Set(double dVal)=0
virtual PropertyType GetType()=0
An array of properties supported by a device.
Definition Property.h:438
bool GetName(unsigned uIdx, std::string &strName) const
Definition Property.cpp:436
int ClearAllowedValues(const char *name)
Definition Property.cpp:379
int UpdateAll()
Definition Property.cpp:459
int GetCurrentPropertyData(const char *name, long &data)
Definition Property.cpp:422
int GetPropertyData(const char *name, const char *value, long &data)
Definition Property.cpp:410
int AddAllowedValue(const char *name, const char *value, long data)
Definition Property.cpp:389
int Set(const char *propName, const char *Value)
Definition Property.cpp:266
int Get(const char *propName, std::string &val) const
Definition Property.cpp:289
int CreateProperty(const char *name, const char *value, PropertyType eType, bool bReadOnly, ActionFunctor *pAct=0, bool isPreInitProperty=false)
Definition Property.cpp:329
int Update(const char *Name)
Definition Property.cpp:485
Property * Find(const char *name) const
Definition Property.cpp:305
int Apply(const char *Name)
Definition Property.cpp:494
int SetAllowedValues(const char *name, std::vector< std::string > &values)
Definition Property.cpp:366
unsigned GetSize() const
Definition Property.cpp:324
Property API with most of the Property mechanism implemented.
Definition Property.h:145
double GetUpperLimit() const
Definition Property.h:215
bool GetReadOnly() const
Definition Property.h:170
bool IsSequenceable()
Definition Property.h:236
long GetSequenceMaxSize() const
Definition Property.h:245
int ClearSequence()
Definition Property.h:250
int StopSequence()
Definition Property.h:305
bool SetLimits(double lowerLimit, double upperLimit)
Definition Property.h:220
double GetLowerLimit() const
Definition Property.h:210
bool HasLimits() const
Definition Property.h:205
int AddToSequence(const char *value)
Definition Property.h:265
bool GetInitStatus() const
Definition Property.h:173
std::vector< std::string > GetAllowedValues() const
Definition Property.cpp:32
int StartSequence()
Definition Property.h:298
int SendSequence()
Definition Property.h:280
virtual double GetStepSizeXUm()=0
virtual int GetPositionSteps(long &x, long &y)=0
virtual double GetStepSizeYUm()=0
virtual int SetPositionSteps(long x, long y)=0
Base class for threads in MM devices.
Definition DeviceThreads.h:34
void wait()
Definition DeviceThreads.h:52
virtual int activate()
Definition DeviceThreads.h:41
Definition DeviceThreads.h:151
Critical section lock.
Definition DeviceThreads.h:95
Definition CameraImageMetadata.h:25
FocusDirection
Definition MMDeviceConstants.h:282
@ FocusDirectionUnknown
Definition MMDeviceConstants.h:283
PortType
Definition MMDeviceConstants.h:275
@ InvalidPort
Definition MMDeviceConstants.h:276
const char *const g_Keyword_Metadata_CameraLabel
Definition MMDeviceConstants.h:175
PropertyType
Definition MMDeviceConstants.h:258
@ Float
Definition MMDeviceConstants.h:261
@ String
Definition MMDeviceConstants.h:260
@ Integer
Definition MMDeviceConstants.h:262
const char *const g_Keyword_Transpose_Correction
Definition MMDeviceConstants.h:154
const int MaxStrLength
Definition MMDeviceConstants.h:96
DeviceType
Definition MMDeviceConstants.h:236
const char *const g_Keyword_State
Definition MMDeviceConstants.h:119
const char *const g_Keyword_Label
Definition MMDeviceConstants.h:120
const char *const g_Keyword_HubID
Definition MMDeviceConstants.h:156
ActionType
Definition MMDeviceConstants.h:265
@ IsSequenceable
Definition MMDeviceConstants.h:269
@ AfterSet
Definition MMDeviceConstants.h:268
@ StopSequence
Definition MMDeviceConstants.h:272
@ AfterLoadSequence
Definition MMDeviceConstants.h:270
@ StartSequence
Definition MMDeviceConstants.h:271
@ BeforeGet
Definition MMDeviceConstants.h:267
const char *const g_Keyword_Transpose_MirrorY
Definition MMDeviceConstants.h:153
const char *const g_Keyword_Transpose_SwapXY
Definition MMDeviceConstants.h:151
const char *const g_Keyword_Transpose_MirrorX
Definition MMDeviceConstants.h:152
DeviceDetectionStatus
Definition MMDeviceConstants.h:296
@ Unimplemented
Definition MMDeviceConstants.h:297