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;
793 return properties_.
Update(name);
802 return properties_.
Apply(name);
810 std::map<int, std::string>::const_iterator it;
811 it = messages_.find(errorCode);
812 if (it == messages_.end())
815 std::ostringstream osTxt;
816 osTxt <<
"Error code " << errorCode <<
" (" << std::setbase(16) << errorCode <<
" hex)";
822 std::ostringstream stringStreamMessage;
823 stringStreamMessage << it->second.c_str();
825 if( 2<=errorCode && errorCode<=5 )
847 parentID_ = parentId;
881 messages_[errorCode] = text;
886 return morePropertyErrorInfo_.c_str();
891 morePropertyErrorInfo_ = ptext;
901 int LogMessage(
const char* msg,
bool debugOnly =
false)
const
904 return callback_->
LogMessage(
this, msg, debugOnly);
915 int LogMessage(
const std::string& msg,
bool debugOnly =
false)
const
918 return callback_->
LogMessage(
this, msg.c_str(), debugOnly);
935 return callback_->
LogMessage(
this, text, debugOnly);
954 std::ostringstream os;
956 os << message << t.
toString() <<
" seconds";
958 return callback_->
LogMessage(
this, os.str().c_str(), debugOnly);
974 return LogTimeDiff(start, end,
"Process took: " , debugOnly);
1027 return callback_->
GetDevice(
this, deviceLabel);
1056 int WriteToComPort(
const char* portLabel,
const unsigned char* buf,
unsigned bufLength)
1059 return callback_->
WriteToSerial(
this, portLabel, buf, bufLength);
1090 const unsigned long MAX_BUFLEN = 2000;
1091 char buf[MAX_BUFLEN];
1094 int ret = callback_->
GetSerialAnswer(
this, portName, MAX_BUFLEN, buf, term);
1107 int ReadFromComPort(
const char* portLabel,
unsigned char* buf,
unsigned bufLength,
unsigned long& read)
1110 return callback_->
ReadFromSerial(
this, portLabel, buf, bufLength, read);
1256 return callback_ == 0 ? false :
true;
1313 template<
class T_HUB>
1320 hub->GetLabel(hubLabel);
1327 bool PropertyDefined(
const char* propName)
const
1329 return properties_.
Find(propName) != 0;
1342 int GetSequenceableProperty(
MM::Property** pProp,
const char* name)
const
1344 *pProp = properties_.
Find(name);
1351 bool sequenceable = (*pProp)->IsSequenceable();
1352 if (!sequenceable) {
1362 std::string moduleName_;
1363 std::string description_;
1364 std::map<int, std::string> messages_;
1369 mutable std::string morePropertyErrorInfo_;
1370 std::string parentID_;
1412 std::vector<std::string> allowedValues;
1413 allowedValues.push_back(
"0");
1414 allowedValues.push_back(
"1");
1498 for (
const auto& p : addedTags_)
1500 md.
AddTag(p.first.c_str(), p.second.c_str());
1511 bool stopOnOverflow) = 0;
1545 virtual void AddTag(
const char* key,
const char* deviceLabel,
const char* value)
1548 if (deviceLabel != std::string(
"_"))
1554 addedTags_[k] = value;
1559 addedTags_.erase(key);
1578 const unsigned* ,
const unsigned* ,
1585 unsigned* ,
unsigned* ,
unsigned* )
1591 std::map<std::string, std::string> addedTags_;
1623 virtual bool Busy() {
return busy_;}
1660 thd_->
Start(numImages);
1661 stopWhenCBOverflows_ = stopOnOverflow;
1749 enum { default_numImages=1 };
1752 :numImages_(default_numImages)
1773 numImages_=numImages;
1820 camera_->
LogMessage(
"SeqAcquisition interrupted by the user\n");
1848 bool stopWhenCBOverflows_;
1861 virtual int GetPositionUm(
double& pos) = 0;
1862 virtual int SetPositionUm(
double pos) = 0;
1869 virtual int SetRelativePositionUm(
double d)
1872 int ret = GetPositionUm(pos);
1875 return SetPositionUm(pos + d);
1878 virtual int SetAdapterOriginUm(
double )
1883 virtual int Move(
double )
1913 virtual int UsesOnStagePositionChanged(
bool& result)
const
1919 virtual int IsStageLinearSequenceable(
bool& isSequenceable)
const
1921 isSequenceable =
false;
1925 virtual int GetStageSequenceMaxLength(
long& )
const
1930 virtual int StartStageSequence()
1935 virtual int StopStageSequence()
1940 virtual int ClearStageSequence()
1945 virtual int AddToStageSequence(
double )
1950 virtual int SendStageSequence()
1955 virtual int SetStageLinearSequence(
double,
long)
1988 bool mirrorX, mirrorY;
1989 GetOrientation(mirrorX, mirrorY);
1991 long xSteps{}, ySteps{};
2001 return {xSteps, ySteps};
2009 bool mirrorX, mirrorY;
2010 GetOrientation(mirrorX, mirrorY);
2012 double x_um{}, y_um{};
2023 return {x_um, y_um};
2029 long xSteps = posSteps.first;
2030 long ySteps = posSteps.second;
2047 bool mirrorX, mirrorY;
2048 GetOrientation(mirrorX, mirrorY);
2049 double xPos = xPos_ + dx;
2050 double yPos = yPos_ + dy;
2074 bool mirrorX, mirrorY;
2075 GetOrientation(mirrorX, mirrorY);
2096 long xSteps, ySteps;
2102 x_um = pos_um.first;
2103 y_um = pos_um.second;
2119 long xSteps, ySteps;
2199 void GetOrientation(
bool& mirrorX,
bool& mirrorY)
2204 mirrorX = strcmp(val,
"1") == 0 ? true :
false;
2208 mirrorY = strcmp(val,
"1") == 0 ? true :
false;
2258 virtual int GetDASequenceMaxLength(
long& )
const
2263 virtual int StartDASequence()
2268 virtual int StopDASequence() {
2272 virtual int ClearDASequence() {
2276 virtual int AddToDASequence(
double )
2281 virtual int SendDASequence() {
2300 virtual int GetSLMSequenceMaxLength(
long& )
const
2305 virtual int StartSLMSequence()
2310 virtual int StopSLMSequence() {
2314 virtual int ClearSLMSequence() {
2318 virtual int AddToSLMSequence(
const unsigned char *
const )
2323 virtual int AddToSLMSequence(
const unsigned int *
const )
2328 virtual int SendSLMSequence() {
2339 double GetXMinimum() {
return 0.0;};
2340 double GetYMinimum() {
return 0.0;};
2388 for (
unsigned i=0; i<installedDevices.size(); i++)
2389 delete installedDevices[i];
2390 installedDevices.clear();
2397 std::vector<MM::Device*> installedDevices;
2436 std::map<std::string, long>::const_iterator it;
2437 it = labels_.find(label);
2438 if (it == labels_.end())
2454 if (gateOpen_ != open) {
2510 std::map<std::string, long>::const_iterator it;
2511 for (it=labels_.begin(); it!=labels_.end(); it++)
2515 if (it->second == pos)
2533 std::map<std::string, long>::iterator it;
2534 it = labels_.find(label);
2535 if (it != labels_.end() && it->second != pos)
2542 for (it=labels_.begin(); it!=labels_.end(); it++)
2544 if (it->second == pos)
2552 labels_[label] = pos;
2556 std::string strLabel(label);
2557 std::vector<std::string> values;
2558 for (it=labels_.begin(); it!=labels_.end(); it++)
2559 values.push_back(it->first);
2570 std::map<std::string, long>::const_iterator it;
2571 it = labels_.find(label);
2572 if (it == labels_.end())
2618 std::vector<std::string> sequence = pProp->
GetSequence();
2619 for (std::vector<std::string>::iterator it = sequence.begin(); it != sequence.end(); ++it) {
2624 std::stringstream s;
2633 std::vector<std::string>::iterator it;
2634 for ( it=sequence.begin() ; it < sequence.end(); it++ )
2680 std::map<std::string, long> labels_;
2694 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:2240
Base class for creating camera device adapters.
Definition DeviceBase.h:1398
virtual int StartSequenceAcquisition(double unused)=0
Start continuous sequence acquisition.
virtual int GetMultiROI(unsigned *, unsigned *, unsigned *, unsigned *, unsigned *)
Definition DeviceBase.h:1584
virtual int StopExposureSequence()
Definition DeviceBase.h:1523
virtual int StartSequenceAcquisition(long numImages, double unused, bool stopOnOverflow)=0
Start sequence acquisition.
virtual int SetMultiROI(const unsigned *, const unsigned *, const unsigned *, const unsigned *, unsigned)
Definition DeviceBase.h:1577
virtual bool SupportsMultiROI()
Definition DeviceBase.h:1562
virtual unsigned GetImageBytesPerPixel() const =0
Return image buffer pixel depth in bytes.
virtual int GetExposureSequenceMaxLength(long &) const
Definition DeviceBase.h:1513
virtual int StartExposureSequence()
Definition DeviceBase.h:1518
virtual int GetMultiROICount(unsigned &)
Definition DeviceBase.h:1572
CCameraBase()
Definition DeviceBase.h:1409
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:1557
virtual int AddToExposureSequence(double)
Definition DeviceBase.h:1533
virtual int ClearExposureSequence()
Definition DeviceBase.h:1528
virtual unsigned GetNumberOfChannels() const
Return the number of channels.
Definition DeviceBase.h:1456
virtual int SendExposureSequence() const
Definition DeviceBase.h:1538
virtual const unsigned char * GetImageBuffer()=0
Return pixel data.
virtual bool IsMultiROISet()
Definition DeviceBase.h:1567
virtual unsigned GetNumberOfComponents() const
Return the number of components in this image.
Definition DeviceBase.h:1445
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:1545
virtual const unsigned char * GetImageBuffer(unsigned)
Return the image buffer for a specific channel.
Definition DeviceBase.h:1480
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:1487
virtual void GetTags(char *serializedMetadata)
Fill serializedMetadata with the device's metadata tags.
Definition DeviceBase.h:1495
virtual int GetChannelName(unsigned, char *name)
Return the channel name.
Definition DeviceBase.h:1468
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:808
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:884
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:980
int LogMessageCode(const int errorCode, bool debugOnly=false) const
Output the text message of specified code to the log stream.
Definition DeviceBase.h:929
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:879
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:1232
CDeviceBase()
Definition DeviceBase.h:870
int UpdateStatus()
Refresh the entire state of the device and synchronize property values with the actual state of the h...
Definition DeviceBase.h:783
int OnPropertiesChanged()
Signal that something changed in the property structure.
Definition DeviceBase.h:1144
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:1300
virtual void GetParentID(char *parentID) const
Definition DeviceBase.h:859
bool IsCallbackRegistered() const
Check if we have callback mechanism set up.
Definition DeviceBase.h:1254
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:1190
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:1210
int PurgeComPort(const char *portLabel)
Clear the serial port buffers.
Definition DeviceBase.h:1117
void EnableDelay(bool state=true)
Enable response to delay settings.
Definition DeviceBase.h:1273
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:972
void CreateHubIDProperty()
Create read-only property displaying parentID (hub label).
Definition DeviceBase.h:1286
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:1043
int ClearAllowedValues(const char *name)
Clear allowed values, and make any value valid.
Definition DeviceBase.h:732
int LogMessage(const char *msg, bool debugOnly=false) const
Output the specified text message to the log stream.
Definition DeviceBase.h:901
int OnPropertyChanged(const char *propName, const char *propValue)
Signal to the core that a property value has changed.
Definition DeviceBase.h:1154
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:837
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:1088
MM::Core * GetCoreCallback() const
Get the callback object.
Definition DeviceBase.h:1262
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:791
T_HUB * AssignToHub()
Return the parent Hub device pointer, or null if there isn't any.
Definition DeviceBase.h:1314
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:1129
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:1243
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:915
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:1056
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:1072
virtual void SetParentID(const char *parentId)
Definition DeviceBase.h:845
int GetPropertyData(const char *name, const char *value, long &data)
Obtain data field associated with the allowed property value.
Definition DeviceBase.h:756
int GetCurrentPropertyData(const char *name, long &data)
Obtain data field associated with the currently applied property value.
Definition DeviceBase.h:769
int OnMagnifierChanged()
Signal that the magnifier has changed.
Definition DeviceBase.h:1220
int OnStagePositionChanged(double pos)
Report position change (for single-axis stage).
Definition DeviceBase.h:1172
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:800
virtual MM::DeviceDetectionStatus DetectDevice(void)
Definition DeviceBase.h:840
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:1107
int OnExposureChanged(double exposure)
Signal that the exposure has changed.
Definition DeviceBase.h:1200
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:952
void SetMorePropertyErrorInfo(const char *ptext) const
Definition DeviceBase.h:889
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
int ClearPropertyLimits(const char *name)
Remove the limits of a property, so that any value is allowed again.
Definition DeviceBase.h:709
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:1024
int AddAllowedValue(const char *name, const char *value)
Add a single allowed value.
Definition DeviceBase.h:740
int SetAllowedValues(const char *name, std::vector< std::string > &values)
Set an entire array of allowed values.
Definition DeviceBase.h:724
int AddAllowedValue(const char *name, const char *value, long data)
Add a single allowed value, plus additional data.
Definition DeviceBase.h:748
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:874
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:65
static bool CopyLimitedString(char *pszTarget, const char *pszSource)
Definition DeviceUtils.cpp:45
Base class for creating Galvo devices.
Definition DeviceBase.h:2338
Base class for creating generic devices.
Definition DeviceBase.h:1386
Base class for creating image processing modules.
Definition DeviceBase.h:2249
Definition DeviceBase.h:1747
MM::MMTime GetStartTime()
Definition DeviceBase.h:1801
void Suspend()
Definition DeviceBase.h:1786
void Resume()
Definition DeviceBase.h:1794
long GetNumberOfImages()
Definition DeviceBase.h:1805
void Stop()
Definition DeviceBase.h:1764
void SetLength(long images)
Definition DeviceBase.h:1798
bool IsSuspended()
Definition DeviceBase.h:1790
~BaseSequenceThread()
Definition DeviceBase.h:1762
void UpdateActualDuration()
Definition DeviceBase.h:1807
CLegacyCameraBase * GetCamera()
Definition DeviceBase.h:1804
BaseSequenceThread(CLegacyCameraBase *pCam)
Definition DeviceBase.h:1751
bool IsStopped()
Definition DeviceBase.h:1782
long GetImageCounter()
Definition DeviceBase.h:1800
void Start(long numImages)
Definition DeviceBase.h:1769
MM::MMTime GetActualDuration()
Definition DeviceBase.h:1802
Definition DeviceBase.h:1727
CaptureRestartHelper(CLegacyCameraBase *pCam)
Definition DeviceBase.h:1732
Legacy base class for creating camera device adapters.
Definition DeviceBase.h:1606
virtual void setStopOnOverflow(bool stop)
Definition DeviceBase.h:1722
virtual bool isStopOnOverflow()
Definition DeviceBase.h:1721
virtual ~CLegacyCameraBase()
Definition DeviceBase.h:1613
virtual int ThreadRun(void)
Definition DeviceBase.h:1674
virtual double GetIntervalMs()
Definition DeviceBase.h:1701
CLegacyCameraBase()
Definition DeviceBase.h:1608
virtual bool Busy()
Definition DeviceBase.h:1623
virtual void OnThreadExiting()
Definition DeviceBase.h:1706
virtual int InsertImage()
Definition DeviceBase.h:1690
virtual int StartSequenceAcquisition(double)
Start continuous sequence acquisition.
Definition DeviceBase.h:1630
friend class BaseSequenceThread
Definition DeviceBase.h:1851
virtual long GetNumberOfImages()
Definition DeviceBase.h:1703
virtual bool IsCapturing()
Indicate whether sequence acquisition is currently running.
Definition DeviceBase.h:1665
virtual long GetImageCounter()
Definition DeviceBase.h:1702
virtual int StartSequenceAcquisition(long numImages, double, bool stopOnOverflow)
Start sequence acquisition.
Definition DeviceBase.h:1652
virtual int StopSequenceAcquisition()
Stop and wait for the thread to finish.
Definition DeviceBase.h:1638
Base class for creating devices that can change magnification (NS).
Definition DeviceBase.h:2291
Base class for creating pressure pump device adapters.
Definition DeviceBase.h:2705
Base class for creating SLM devices that can project images.
Definition DeviceBase.h:2299
Base class for creating serial port device adapters.
Definition DeviceBase.h:2232
Base class for creating shutter device adapters.
Definition DeviceBase.h:2224
Base class for creating ADC/DAC modules.
Definition DeviceBase.h:2257
Base class for creating single axis stage adapters.
Definition DeviceBase.h:1860
Base class for creating state device adapters such as filter wheels, objectives, turrets,...
Definition DeviceBase.h:2407
virtual int GetPosition(char *label) const
Obtain the state (position) label of the device.
Definition DeviceBase.h:2495
virtual int GetPositionLabel(long pos, char *label) const
Obtain the label associated with the position (state).
Definition DeviceBase.h:2508
virtual int SetPositionLabel(long pos, const char *label)
Create new label for the given position, or override the existing one.
Definition DeviceBase.h:2530
virtual int GetGateOpen(bool &open)
Definition DeviceBase.h:2465
virtual int GetPosition(long &pos) const
Obtain the state (position) index of the device.
Definition DeviceBase.h:2476
int OnLabel(MM::PropertyBase *pProp, MM::ActionType eAct)
Implement the default Label property action.
Definition DeviceBase.h:2582
CStateDeviceBase< U > CStateBase
Definition DeviceBase.h:2410
virtual int SetPosition(const char *label)
Set the state (position) of the device based on the state label.
Definition DeviceBase.h:2434
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:2663
virtual int GetLabelPosition(const char *label, long &pos) const
Obtain the position associated with a label.
Definition DeviceBase.h:2568
virtual int SetPosition(long pos)
Set the state (position) of the device based on the state index.
Definition DeviceBase.h:2424
CStateDeviceBase()
Definition DeviceBase.h:2412
virtual int SetGateOpen(bool open)
Implement a gate, i.e., a position where the state device is closed.
Definition DeviceBase.h:2452
Base class for creating volumetric pump device adapters.
Definition DeviceBase.h:2688
Base class for creating dual axis stage adapters.
Definition DeviceBase.h:1969
virtual int SetAdapterOriginUm(double newXUm, double newYUm)
Alter the software coordinate translation between micrometers and steps, such that the current positi...
Definition DeviceBase.h:2072
virtual int StartXYStageSequence()
Definition DeviceBase.h:2156
virtual int AddToXYStageSequence(double, double)
Add one value to the sequence.
Definition DeviceBase.h:2171
virtual int GetXYStageSequenceMaxLength(long &) const
Definition DeviceBase.h:2151
CXYStageBase()
Definition DeviceBase.h:1971
virtual int SetYOrigin()
Define the current position as Y = 0 (in hardware if possible).
Definition DeviceBase.h:2146
virtual int Move(double, double)
Definition DeviceBase.h:2136
std::pair< double, double > ConvertPositionStepsToUm(long xSteps, long ySteps)
Definition DeviceBase.h:2007
double GetCachedXUm()
Return the cached X position.
Definition DeviceBase.h:2194
virtual int SetPositionUm(double x_um, double y_um)
Definition DeviceBase.h:2026
double GetCachedYUm()
Definition DeviceBase.h:2195
virtual int GetPositionUm(double &x_um, double &y_um)
Definition DeviceBase.h:2094
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:2176
virtual int StopXYStageSequence()
Definition DeviceBase.h:2161
virtual int SetRelativePositionSteps(long x, long y)
Set relative position in steps.
Definition DeviceBase.h:2117
std::pair< long, long > ConvertPositionUmToSteps(double x_um, double y_um)
Definition DeviceBase.h:1986
virtual int SetRelativePositionUm(double dx, double dy)
Set relative position.
Definition DeviceBase.h:2045
virtual int ClearXYStageSequence()
Remove all values in the sequence.
Definition DeviceBase.h:2166
virtual int SetXOrigin()
Define the current position as X = 0 (in hardware if possible).
Definition DeviceBase.h:2141
virtual int UsesOnXYStagePositionChanged(bool &result) const
Return true when your device adapter uses OnXYStagePositionChanged callbacks.
Definition DeviceBase.h:2130
Base class for creating special HUB devices for managing device libraries.
Definition DeviceBase.h:2349
void AddInstalledDevice(MM::Device *pdev)
Definition DeviceBase.h:2394
virtual unsigned GetNumberOfInstalledDevices()
Return the number of child devices after DetectInstalledDevices was called.
Definition DeviceBase.h:2370
virtual int DetectInstalledDevices()
Detect installed child devices.
Definition DeviceBase.h:2362
virtual ~HubBase()
Definition DeviceBase.h:2352
HubBase()
Definition DeviceBase.h:2351
virtual void ClearInstalledDevices()
Remove all installed devices that were created by DetectInstalledDevices().
Definition DeviceBase.h:2386
virtual MM::Device * GetInstalledDevice(int devIdx)
Return a pointer to the device with index devIdx.
Definition DeviceBase.h:2378
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:1596
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:1327
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:451
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:249
long GetSequenceMaxSize() const
Definition Property.h:258
int ClearSequence()
Definition Property.h:263
int StopSequence()
Definition Property.h:318
void ClearLimits()
Definition Property.h:226
bool SetLimits(double lowerLimit, double upperLimit)
Definition Property.h:233
double GetLowerLimit() const
Definition Property.h:210
bool HasLimits() const
Definition Property.h:205
int AddToSequence(const char *value)
Definition Property.h:278
bool GetInitStatus() const
Definition Property.h:173
std::vector< std::string > GetAllowedValues() const
Definition Property.cpp:32
int StartSequence()
Definition Property.h:311
int SendSequence()
Definition Property.h:293
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:32
void activate()
Definition DeviceThreads.h:60
void wait()
Definition DeviceThreads.h:72
RAII object to acquire and auto-release MMThreadLock.
Definition DeviceThreads.h:124
Critical section lock.
Definition DeviceThreads.h:92
Definition CameraImageMetadata.h:27
FocusDirection
Definition MMDeviceConstants.h:291
@ FocusDirectionUnknown
Definition MMDeviceConstants.h:292
PortType
Definition MMDeviceConstants.h:284
@ InvalidPort
Definition MMDeviceConstants.h:285
const char *const g_Keyword_Metadata_CameraLabel
Definition MMDeviceConstants.h:184
PropertyType
Definition MMDeviceConstants.h:267
@ Float
Definition MMDeviceConstants.h:270
@ String
Definition MMDeviceConstants.h:269
@ Integer
Definition MMDeviceConstants.h:271
const char *const g_Keyword_Transpose_Correction
Definition MMDeviceConstants.h:154
const int MaxStrLength
Definition MMDeviceConstants.h:96
DeviceType
Definition MMDeviceConstants.h:245
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:274
@ IsSequenceable
Definition MMDeviceConstants.h:278
@ AfterSet
Definition MMDeviceConstants.h:277
@ StopSequence
Definition MMDeviceConstants.h:281
@ AfterLoadSequence
Definition MMDeviceConstants.h:279
@ StartSequence
Definition MMDeviceConstants.h:280
@ BeforeGet
Definition MMDeviceConstants.h:276
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:305
@ Unimplemented
Definition MMDeviceConstants.h:306