示例#1
0
/////////////////////////////////////////////////////////
// MMDevice API
int MT20Shutter::Initialize()
{
	if(initialized_) return DEVICE_OK;

	// set property list

	// Name
	int ret = CreateProperty(MM::g_Keyword_Name, g_MT20Shutter, MM::String, true);
	if(ret != DEVICE_OK) return ret;

	// Description

	ret = CreateProperty(MM::g_Keyword_Description, "Olympus MT20 shutter", MM::String, true);
	if(ret != DEVICE_OK) return ret;

	// State
	CPropertyAction* pAct = new CPropertyAction(this, &MT20Shutter::OnState);
	ret = CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, pAct);
	if(ret != DEVICE_OK) return ret;

	AddAllowedValue(MM::g_Keyword_State, "0");	// Closed
	AddAllowedValue(MM::g_Keyword_State, "1");	// Open

	state_ = false;

	busy_ = true;
	ret = UpdateStatus();
	busy_ = false;
	if(ret != DEVICE_OK) return ret;

	initialized_ = true;

	return DEVICE_OK;
}
示例#2
0
int VTiSIMScanner::Initialize()
{
   int err = CreateStringProperty(g_PropName_Scanning, g_PropVal_Off, false,
      new CPropertyAction(this, &VTiSIMScanner::OnStartStop));
   if (err != DEVICE_OK)
      return err;
   err = AddAllowedValue(g_PropName_Scanning, g_PropVal_Off);
   if (err != DEVICE_OK)
      return err;
   err = AddAllowedValue(g_PropName_Scanning, g_PropVal_On);
   if (err != DEVICE_OK)
      return err;

   DWORD vterr = vti_GetScanRateRange(VTiHub()->GetScanAndMotorHandle(),
      &minRate_, &maxRate_);
   if (vterr != VTI_SUCCESS)
      return vterr;
   if (scanRate_ < minRate_)
      scanRate_ = minRate_;
   if (scanRate_ > maxRate_)
      scanRate_ = maxRate_;
   err = CreateIntegerProperty(g_PropName_ScanRate, scanRate_, false,
      new CPropertyAction(this, &VTiSIMScanner::OnScanRate));
   if (err != DEVICE_OK)
      return err;
   err = SetPropertyLimits(g_PropName_ScanRate, minRate_, maxRate_);
   if (err != DEVICE_OK)
      return err;

   vterr = vti_GetScanWidthRange(VTiHub()->GetScanAndMotorHandle(),
      &minWidth_, &maxWidth_);
   if (vterr != VTI_SUCCESS)
      return vterr;
   if (scanWidth_ < minWidth_)
      scanWidth_ = minWidth_;
   if (scanWidth_ > maxWidth_)
      scanWidth_ = maxWidth_;
   err = CreateIntegerProperty(g_PropName_ScanWidth, scanWidth_, false,
      new CPropertyAction(this, &VTiSIMScanner::OnScanWidth));
   if (err != DEVICE_OK)
      return err;
   err = SetPropertyLimits(g_PropName_ScanWidth, minWidth_, maxWidth_);
   if (err != DEVICE_OK)
      return err;

   err = CreateFloatProperty(g_PropName_ActualRate, actualRate_, true,
      new CPropertyAction(this, &VTiSIMScanner::OnActualScanRate));
   if (err != DEVICE_OK)
      return err;

   err = CreateIntegerProperty(g_PropName_ScanOffset, scanOffset_, false,
      new CPropertyAction(this, &VTiSIMScanner::OnScanOffset));
   if (err != DEVICE_OK)
      return err;
   err = SetPropertyLimits(g_PropName_ScanOffset, 0, GetMaxOffset());
   if (err != DEVICE_OK)
      return err;
   
   return DoStartStopScan(false);
}
示例#3
0
void Controller::GeneratePropertyState()
{
	CPropertyAction* pAct = new CPropertyAction(this, &Controller::OnState);
	CreateProperty(g_Keyword_Global_State, "0", MM::Integer, false, pAct);
	AddAllowedValue(g_Keyword_Global_State, "0");
	AddAllowedValue(g_Keyword_Global_State, "1");
}
示例#4
0
void Sapphire::GeneratePropertyState()
{
   
	CPropertyAction* pAct = new CPropertyAction (this, &Sapphire::OnState);
   CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, pAct);
   AddAllowedValue(MM::g_Keyword_State, "0");
   AddAllowedValue(MM::g_Keyword_State, "1");
}
示例#5
0
/*---------------------------------------------------------------------------
 Default constructor.
---------------------------------------------------------------------------*/
Mightex_Sirius_SLC_USB::Mightex_Sirius_SLC_USB() :
	dev_num(0),
	cur_dev(0),
	devHandle(-1),
	channels(-1),
	devModuleType(MODULE_AA),
	mode(DISABLE_MODE),
	m_ratio(50),
	m_period(1),
	m_channel(1),
	m_name(""),
    m_LEDOn("Off"),
	m_mode("DISABLE"),
   m_status("No Fault"),
	m_serialNumber("n/a"),
   m_busy(false),
   m_initialized(false)
{
	InitializeDefaultErrorMessages();
	SetErrorText(ERR_PORT_CHANGE_FORBIDDEN, "You can't change the port after device has been initialized.");
	SetErrorText(ERR_INVALID_DEVICE, "The selected plugin does not fit for the device.");


	// Name
	CreateProperty(MM::g_Keyword_Name, g_DeviceSiriusSLCUSBName, MM::String, true);

	// Description
	CreateProperty(MM::g_Keyword_Description, "Mightex Sirius SLC LED Driver(USB)", MM::String, true);

	CPropertyAction* pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnDevices);
	CreateProperty("Devices", "", MM::String, false, pAct, true);

	AddAllowedValue( "Devices", ""); // no device yet

	HidInit();

	char ledName[64];
	char devName[32];
	char serialNum[32];
	int dev_Handle;
	std::string s_devName;
	dev_num = MTUSB_LEDDriverInitDevices();
	for(int i = 0; i < dev_num; i++)
	{
		dev_Handle = MTUSB_LEDDriverOpenDevice(i);
		if(dev_Handle >= 0)
			if(HidGetDeviceName(dev_Handle, devName, sizeof(devName)) > 0)
				if(MTUSB_LEDDriverSerialNumber(dev_Handle, serialNum, sizeof(serialNum)) > 0)
				{
					sprintf(ledName, "%s:%s", devName, serialNum);
					AddAllowedValue( "Devices", ledName);
					s_devName = ledName;
					devNameList.push_back(s_devName);
				}
		MTUSB_LEDDriverCloseDevice(dev_Handle);
	}
}
示例#6
0
int MT20Burner::Initialize()
{
	if(initialized_) return DEVICE_OK;

	// set property list

	// Name
	int ret = CreateProperty(MM::g_Keyword_Name, g_MT20Burner, MM::String, true);
	if(ret != DEVICE_OK) return ret;

	// Description
	ret = CreateProperty(MM::g_Keyword_Description, "Olympus MT20 Burner", MM::String, true);
	if(ret != DEVICE_OK) return ret;

	std::string ret2 = mt20.GetBurnerHours(&hours_);
	if(ret2.size() > 0)
	{
		ret2.append(std::string("mt20.GetBurnerHours() returns error in MT20Burner::Initialize().\n"));
		LogMessage(ret2, false);
		return ERR_EXECUTING_CMD;
	}

	// Burner Hours
	std::ostringstream temp;
	temp<<hours_;
	CPropertyAction* pAct = new CPropertyAction(this, &MT20Burner::OnHours);
	ret = CreateProperty(g_BurnerHours, temp.str().c_str(), MM::Integer, true, pAct);
	if(ret != DEVICE_OK) return ret;

	// State
	pAct = new CPropertyAction (this, &MT20Burner::OnState);
	ret = CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, pAct);
	if(ret != DEVICE_OK) return ret;

	SetPositionLabel((long)0, "Off");
	SetPositionLabel((long)1, "On");

	ret = AddAllowedValue(MM::g_Keyword_State, "0");	// Off
	if(ret != DEVICE_OK) return ret;
	ret = AddAllowedValue(MM::g_Keyword_State, "1");	// On
	if(ret != DEVICE_OK) return ret;

	state_ = 0;

	busy_ = true;
	ret = UpdateStatus();
	busy_ = false;
	if(ret != DEVICE_OK) return ret;

	initialized_ = true;

	return DEVICE_OK;
}
示例#7
0
/////////////////////////////////////////////
// Property Generators
/////////////////////////////////////////////
void Controller::GeneratePropertyLockPod()
{
	CPropertyAction* pAct = new CPropertyAction(this, &Controller::OnLockPod);
	CreateProperty(g_Keyword_PodLock, "0", MM::Integer, false, pAct);
	AddAllowedValue(g_Keyword_PodLock, "0");
	AddAllowedValue(g_Keyword_PodLock, "1");

	MMThreadGuard myLock(lock_);
	Purge();
	Send("PORT:P=ON");
	ReceiveOneLine();
}
示例#8
0
void Controller::GenerateChannelState()
{
	string selectionName;
	CPropertyActionEx* pAct;
	for (int channel = 0; channel < 3; channel++)
	{
		pAct = new CPropertyActionEx(this, &Controller::OnChannelState, long(channel));
		selectionName = g_Keyword_Selection;
		selectionName.push_back('A' + (char)channel);
		CreateProperty(selectionName.c_str(), "0", MM::Integer, false, pAct);
		AddAllowedValue(selectionName.c_str(), "0");
		AddAllowedValue(selectionName.c_str(), "1");
	}
}
int SimpleAutofocus::Initialize()
{
   if(NULL == pPoints_)
   {
      pPoints_ = new SAFData();
   }
   LogMessage("SimpleAutofocus::Initialize()");
   pCore_ = GetCoreCallback();
   CPropertyAction *pAct = new CPropertyAction (this, &SimpleAutofocus::OnExposure);
   CreateProperty(MM::g_Keyword_Exposure, "0.", MM::Float, false, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnBinning);
   CreateProperty("Binning","0",MM::Integer, false, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnCoarseStepNumber);
   CreateProperty("CoarseSteps from center","5",MM::Integer, false, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnStepsizeCoarse);
   CreateProperty("CoarseStepSize","1.0",MM::Float, false, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnFineStepNumber);
   CreateProperty("FineSteps from center","5",MM::Integer, false, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnStepSizeFine);
   CreateProperty("FineStepSize","0.3",MM::Float, false, pAct);
   // Set the sharpness threshold
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnThreshold);
   CreateProperty("Threshold","0.1",MM::Float, false, pAct);
   // Set the cropping factor to speed up computation
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnCropFactor);
   CreateProperty("CropFactor","0.2",MM::Float, false, pAct);
   SetPropertyLimits("CropFactor",0.1, 1.0);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnSharpnessScore);
   CreateProperty("SharpnessScore","0.0",MM::Float, true, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnMean);
   CreateProperty("Mean","0",MM::Float, true, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnEnableAutoShutter);
   CreateProperty("EnableAutoshutter","0",MM::Integer, false, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnRecalculate);
   CreateProperty("Re-acquire&EvaluateSharpness","0",MM::Integer, false, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnStandardDeviationOverMean);
   CreateProperty("StandardDeviation/Mean","0",MM::Float, true, pAct);
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnChannel);
   CreateProperty("Channel","",MM::String, false, pAct);
   AddAllowedValue("Channel","");
   AddAllowedValue("Channel","...");
   selectedChannelConfig_ = "";
   pAct = new CPropertyAction(this, &SimpleAutofocus::OnSearchAlgorithm);
   CreateProperty("SearchAlgorithm","Brent",MM::String, false, pAct);
   AddAllowedValue("SearchAlgorithm","Brent");
   AddAllowedValue("SearchAlgorithm","BruteForce");
   searchAlgorithm_ = "Brent";
   UpdateStatus();
   return DEVICE_OK;
}
示例#10
0
///////////////////////////////////////////////////////////////////////////////
// RappScanner
//
RappScanner::RappScanner() :
   initialized_(false), port_(""), calibrationMode_(0), polygonAccuracy_(10), polygonMinRectSize_(10),
   ttlTriggered_("Rising Edge"), rasterFrequency_(500), spotSize_(10), laser2_(false)
{
   InitializeDefaultErrorMessages();

   // create pre-initialization properties
   // ------------------------------------

   // Name
   CreateProperty(MM::g_Keyword_Name, g_RappScannerName, MM::String, true);

   // Description
   CreateProperty(MM::g_Keyword_Description, "Rapp UGA-40 galvo phototargeting adapter", MM::String, true);

   // Port
   CPropertyAction* pAct = new CPropertyAction (this, &RappScanner::OnPort);
   
   obsROE_Device* dev = new obsROE_Device();

	std::vector<std::string> s = dev->SearchDevices();
	if (s.size() <= 0)
	{
      s.push_back(std::string("Undefined"));
	}

   // The following line crashes hardware wizard if compiled in a Debug configuration:
   CreateProperty("VirtualComPort", s.at(0).c_str(), MM::String, false, pAct, true);
	for (unsigned int i = 0; i < s.size(); i++)
   {
      AddAllowedValue("VirtualComPort", s.at(i).c_str());
   }


}  
示例#11
0
LCDA::LCDA() :
      busy_(false), 
      minV_(0.0), 
      maxV_(10.0), 
      bitDepth_(14),
      volts_(0.0),
      gatedVolts_(0.0),
      encoding_(0), 
      resolution_(8), 
      channel_(1), 
      name_(""),
      gateOpen_(true)
{
   InitializeDefaultErrorMessages();

   // add custom error messages
   SetErrorText(ERR_BOARD_NOT_FOUND,GS_ERR_BOARD_NOT_FOUND);
   SetErrorText(ERR_UNKNOWN_POSITION, "Invalid position (state) specified");
   SetErrorText(ERR_INITIALIZE_FAILED, "Initialization of the device failed");
   SetErrorText(ERR_WRITE_FAILED, "Failed to write data to the device");
   SetErrorText(ERR_CLOSE_FAILED, "Failed closing the device");

   CPropertyAction* pAct = new CPropertyAction(this, &LCDA::OnChannel);
   CreateProperty("Channel", "1", MM::Integer, false, pAct, true);
   // TODO: The SDK can give us the number of channels, but only after the board is open
   for (int i=1; i< 5; i++){
      std::ostringstream os;
      os << i;
      AddAllowedValue("Channel", os.str().c_str());
   }

}
示例#12
0
int RappScanner::Initialize()
{
   UGA_ = new obsROE_Device();
   
   UGA_->Connect(port_.c_str());
   if (UGA_->IsConnected()) {
      UGA_->UseMaxCalibration(false);
      UGA_->SetCalibrationMode(false, laser2_);
      RunDummyCalibration();
      UGA_->CenterSpot();
      currentX_ = 0;
      currentY_ = 0;
      initialized_ = true;
   } else {
      initialized_ = false;
      return DEVICE_NOT_CONNECTED;
   }

   CPropertyAction* pAct = new CPropertyAction(this, &RappScanner::OnCalibrationMode);
   CreateProperty("CalibrationMode", "0", MM::Integer, false, pAct);
   AddAllowedValue("CalibrationMode", "1");
   AddAllowedValue("CalibrationMode", "0");

   pAct = new CPropertyAction(this, &RappScanner::OnSequence);
   CreateProperty("Sequence", "", MM::String, false, pAct);

   pAct = new CPropertyAction(this, &RappScanner::OnTTLTriggered);
   CreateProperty("TTLTriggered", "Rising Edge", MM::String, false, pAct);
   AddAllowedValue("TTLTriggered", "Rising Edge");
   AddAllowedValue("TTLTriggered", "Falling Edge");

   pAct = new CPropertyAction(this, &RappScanner::OnSpotSize);
   CreateProperty("SpotSize", "0", MM::Float, false, pAct);

   pAct = new CPropertyAction(this, &RappScanner::OnRasterFrequency);
   CreateProperty("RasterFrequency_Hz", "500", MM::Integer, false, pAct);

   pAct = new CPropertyAction(this, &RappScanner::OnAccuracy);
   CreateProperty("AccuracyPercent", "10", MM::Integer, false, pAct);

   pAct = new CPropertyAction(this, &RappScanner::OnMinimumRectSize);
   CreateProperty("MinimumRectSize", "250", MM::Integer, false, pAct);


   return DEVICE_OK;
}
示例#13
0
void Controller::GeneratePropertyTrigger()
{
   CPropertyAction* pAct = new CPropertyAction (this, &Controller::OnTrigger);
   CreateProperty("Trigger", "Off", MM::String, false, pAct);
   for (TriggerType i=OFF;i<=FOLLOW_PULSE;i=TriggerType(i+1))
      AddAllowedValue("Trigger", TriggerLabels[i].c_str());
   SetProperty("Trigger","Off");
}
示例#14
0
int LCSafetyShutter::Initialize()
{
   int ret = DEVICE_OK;

   if (!LaserBoardIsOpen()) {
      ret = LaserBoardOpen();
      if (ret != NO_ERR)
         return ret;
   }

   char buf[64];
   ret = LaserBoardDriverVersion(buf);
   if (ret != NO_ERR)
      return ret;

   std::string driverVersion = buf;
   float driverVersionNum = 0.0;
   std::stringstream s;
   s << driverVersion;
   s >> driverVersionNum;

   if (driverVersionNum < 0.2)
      return ERR_NOT_IN_THIS_FIRMWARE;

   // Name
   ret = CreateProperty(MM::g_Keyword_Name, name_.c_str(), MM::String, true);
   if (DEVICE_OK != ret)
      return ret;

   // Description
   ret = CreateProperty(MM::g_Keyword_Description, "LC Safety Shutter", MM::String, true);
   if (DEVICE_OK != ret)
      return ret;

   CPropertyAction* pAct = new CPropertyAction(this, &LCSafetyShutter::OnState);
   ret = CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, pAct);
   if (DEVICE_OK != ret)
      return ret;
   AddAllowedValue(MM::g_Keyword_State, "0");  
   AddAllowedValue(MM::g_Keyword_State, "1");

   return DEVICE_OK;
}
示例#15
0
int FocalPoint::Initialize()
{
   if (initialized_)
      return DEVICE_OK;

   // check status first (test for communication protocol)
   int ret = CheckForDevice();
   if (ret != DEVICE_OK)
      return ret;

   CPropertyAction* pAct = new CPropertyAction(this, &FocalPoint::OnFocus);
   CreateProperty (g_Focus, g_On, MM::String, false, pAct);
   AddAllowedValue(g_Focus, g_On);
   AddAllowedValue(g_Focus, g_Off);

   pAct = new CPropertyAction(this, &FocalPoint::OnCommand);
   CreateProperty (g_CommandMode, g_Remote, MM::String, false, pAct);
   AddAllowedValue(g_CommandMode, g_Local);
   AddAllowedValue(g_CommandMode, g_Remote);

   pAct = new CPropertyAction(this, &FocalPoint::OnWaitAfterLock);
   CreateProperty("Wait ms after Lock", "3000", MM::Integer, false, pAct);

   pAct = new CPropertyAction(this, &FocalPoint::OnLaser);
   CreateProperty (g_Laser, g_On, MM::String, false, pAct);
   AddAllowedValue(g_Laser, g_On);
   AddAllowedValue(g_Laser, g_Off);

   initialized_ = true;
   return DEVICE_OK;
}
示例#16
0
void GenericSLM::GenerateGraphicsPortProperty()
{

   // Graphics port
   CPropertyAction* pAct = new CPropertyAction (this, &GenericSLM::OnGraphicsPort);
   CreateProperty(g_Graphics_Port, "Undefined", MM::String, false, pAct, true);

   for(unsigned int i=0;i<displays_.size();++i) {
      if (! displays_[i].isPrimary) {
         stringstream displayDescription;
         displayDescription << displays_[i].cardName;
         AddAllowedValue(g_Graphics_Port,displayDescription.str().c_str(),i);
      } else {
         primaryDisplayIndex_ = i;
      }
   }
}
示例#17
0
int MT20Attenuator::Initialize()
{
	if(initialized_) return DEVICE_OK;

	// set property list

	// Name
	int ret = CreateProperty(MM::g_Keyword_Name, g_MT20Attenuator, MM::String, true);
	if(ret != DEVICE_OK) return ret;

	// Description
	ret = CreateProperty(MM::g_Keyword_Description, "Olympus MT20 attenuator", MM::String, true);
	if(ret != DEVICE_OK) return ret;

	// create default positions and labels
	const int bufSize = 1024;
	char buf[bufSize];
	for (unsigned long i=0; i < numPos_; ++i)
	{
		snprintf(buf, bufSize, "State-%ld", i);
		SetPositionLabel(i, buf);
		snprintf(buf, bufSize, "%ld", i);
		AddAllowedValue(MM::g_Keyword_Closed_Position, buf);
	}

	// State
	CPropertyAction* act = new CPropertyAction (this, &MT20Attenuator::OnState);
	ret = CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, act);
	if(ret != DEVICE_OK) return ret;

	// Label
	act = new CPropertyAction (this, &CStateBase::OnLabel);
	ret = CreateProperty(MM::g_Keyword_Label, "", MM::String, false, act);
	if(ret != DEVICE_OK) return ret;

	busy_ = true;
	ret = UpdateStatus();
	busy_ = false;

	if(ret != DEVICE_OK) return ret;

	initialized_ = true;

	return DEVICE_OK;
}
示例#18
0
int VTiSIMPinholeArray::Initialize()
{
   DWORD vterr = vti_GetMotorRange(VTiHub()->GetScanAndMotorHandle(),
      VTI_MOTOR_PINHOLE_ARRAY, &minFinePosition_, &maxFinePosition_);
   if (vterr != VTI_SUCCESS)
      return vterr;

   int err = DoGetPinholePositions(pinholePositions_);
   if (err != DEVICE_OK)
      return err;

   // Initialize our fine position to that of the 64 um pinhole, which is the
   // default pinhole where we will move to below after properties are set up.
   curFinePosition_ = pinholePositions_[VTI_PINHOLE_64_MICRON];

   err = CreateIntegerProperty(g_PropName_FinePosition, curFinePosition_, false,
      new CPropertyAction(this, &VTiSIMPinholeArray::OnFinePosition));
   if (err != DEVICE_OK)
      return err;
   err = SetPropertyLimits(g_PropName_FinePosition,
      minFinePosition_, maxFinePosition_);
   if (err != DEVICE_OK)
      return err;

   err = CreateIntegerProperty(g_PropName_PinholeSize,
      GetPinholeSizeUmForIndex(VTI_PINHOLE_64_MICRON), false,
      new CPropertyAction(this, &VTiSIMPinholeArray::OnPinholeSize));
   if (err != DEVICE_OK)
      return err;
   for (int i = 0; i < nSizes; ++i)
   {
      char s[MM::MaxStrLength + 1];
      snprintf(s, MM::MaxStrLength, "%d", GetPinholeSizeUmForIndex(i));
      err = AddAllowedValue(g_PropName_PinholeSize, s);
      if (err != DEVICE_OK)
         return err;
   }

   err = DoSetFinePosition(curFinePosition_, backlashCompensation_);
   if (err != DEVICE_OK)
      return err;

   return DEVICE_OK;
}
示例#19
0
void Controller::GenerateChannelSelector()
{
	CPropertyActionEx* pAct;
	char buf[16];

	for (int channel = 0; channel < 4; channel++)
	{
		string channelName = g_Keyword_ChannelLabel;
		channelName.push_back('A' + (char)channel);
		pAct = new CPropertyActionEx(this, &Controller::OnChannelWave, long(channel));
		snprintf(buf, 16, "%d", wavelengthLabels_[channel * 4]);
		CreateProperty(channelName.c_str(), buf, MM::Integer, false, pAct);

		vector<string> channelWavelengths;
		for (int wavelength = 0; wavelength < 4; wavelength++)
		{
			snprintf(buf, 16, "%d", wavelengthLabels_[wavelength + channel * 4]);
			channelWavelengths.push_back(buf);
			AddAllowedValue(channelName.c_str(), buf);
		}
		SetAllowedValues(channelName.c_str(), channelWavelengths);
	}
}
示例#20
0
int MicroPoint::CreateAttenuatorProperty()
{
    attenuatorPosition_ = FindAttenuatorPosition();
    if (attenuatorPosition_ < 0)
    {
        return DEVICE_UNKNOWN_POSITION;
    }

    CPropertyAction* pAct = new CPropertyAction (this, &MicroPoint::OnAttenuator);
    CreateProperty("AttenuatorTransmittance", "0.01", MM::String, false, pAct);
    for (long i=0; i<90; ++i)
    {
        char text[32];
        snprintf(text, 32, "%.2f%%", AttenuatorTransmissionFromIndex(i));
        AddAllowedValue("AttenuatorTransmittance", text, i);
        if (i==attenuatorPosition_)
        {
            attenuatorText_.assign(text);
        }
    }

    return DEVICE_OK;
}
示例#21
0
void GenericSLM::GenerateModeProperties()
{
   CPropertyAction* pAct;

   // Inversion Mode property
   pAct = new CPropertyAction (this, &GenericSLM::OnInversion);
   CreateProperty(g_Keyword_Inversion, "Off", MM::String, false, pAct, false);
   AddAllowedValue(g_Keyword_Inversion, "Off", 0);
   AddAllowedValue(g_Keyword_Inversion, "On", 1);

   // Monochrome Mode property
   pAct = new CPropertyAction (this, &GenericSLM::OnMonochromeColor);
   CreateProperty(g_Keyword_MonochromeColor, "White", MM::String, false, pAct, false);
   AddAllowedValue(g_Keyword_MonochromeColor, "White", 0);
   AddAllowedValue(g_Keyword_MonochromeColor, "Red", 1);
   AddAllowedValue(g_Keyword_MonochromeColor, "Green", 2);
   AddAllowedValue(g_Keyword_MonochromeColor, "Blue", 3);
}
示例#22
0
int LMM5Hub::Initialize()
{
   if (g_Interface == NULL)
      return DEVICE_NOT_CONNECTED;

   int ret = g_Interface->DetectLaserLines(*this, *GetCoreCallback());
   nrLines_= g_Interface->GetNrLines();
   if (ret != DEVICE_OK)
      return ret;

   // Name
   ret = CreateProperty(MM::g_Keyword_Name, g_DeviceNameLMM5Hub, MM::String, true);
   if (DEVICE_OK != ret)
      return ret;

   // Firmware version
   std::string version;
   ret = g_Interface->GetFirmwareVersion(*this, *GetCoreCallback(), version);
   if (ret != DEVICE_OK)
      return ret;
   ret = CreateStringProperty("Firmware Version", version.c_str(), true);
   if (ret != DEVICE_OK)
      return ret;

   // Does this controller support FLICR (i.e PWM)?
   ret = g_Interface->GetFLICRAvailable(*this, *GetCoreCallback(), flicrAvailable_);
   if (ret != DEVICE_OK)
      return ret;
   std::string msg = "This controller does not support FLICR";
   if (flicrAvailable_) 
   {
      msg = "This controller supports FLICR";
   }
   LogMessage(msg.c_str());

   // For each laser line, create transmission properties 
   availableLines* lines = g_Interface->getAvailableLaserLines();
   for (int i=0; i < nrLines_; i++) 
   {
      if (lines[i].present) 
      {
			if (lines[i].waveLength >= 100) 
			{
			   CPropertyActionEx *pEx = new CPropertyActionEx(this, &LMM5Hub::OnTransmission, (long) i);
			   std::ostringstream propName;
			   propName << "Transmission (%) " << lines[i].name; 
			   ret = CreateProperty(propName.str().c_str(), "100.0", MM::Float, false, pEx);
			   if (ret != DEVICE_OK)
				   return ret;
			   SetPropertyLimits(propName.str().c_str(), 0.0, 100.0);
			}
         if (flicrAvailable_) 
         {
            // check if this line has flicr available
            ret = g_Interface->GetFLICRAvailableByLine(*this, *GetCoreCallback(), i, lines[i].flicrAvailable);
            if (ret != DEVICE_OK)
               return ret;
            if (lines[i].flicrAvailable) 
            {
               // check for maximum FLICR value
               ret = g_Interface->GetMaxFLICRValue(*this, *GetCoreCallback(), i, lines[i].maxFLICR);
               if (ret != DEVICE_OK)
                  return ret;
               std::ostringstream os;
               os << "Max FLICR for line " << i << " is: " << lines[i].maxFLICR;
               LogMessage(os.str().c_str());
               // ad FLICR/PWM property
               CPropertyActionEx *pEx = new CPropertyActionEx(this, &LMM5Hub::OnFlicr, (long) i);
               std::ostringstream fPropName;
               fPropName << "PWM (%) " << lines[i].name;
               ret = CreateProperty(fPropName.str().c_str(), "1.0", MM::String, false, pEx);
               if (ret != DEVICE_OK)
                  return ret;
               // populate with presets
               uint16_t val = 1;
               while (val <= lines[i].maxFLICR) 
               {
                  std::string valStr;
                  IntToPerc(val, valStr);
                  AddAllowedValue(fPropName.str().c_str(), valStr.c_str());
                  val = val * 10;
               }
            }
         }
      }
   }
   
   
   // Exposure Configuration
   /*
   pAct = new CPropertyAction(this, &LMM5Hub::OnExposureConfig);
   CreateProperty("ExposureConfig", "", MM::String, false, pAct);
   */

   // Some versions of the firmware, when trigger-out is unavailable, fail to
   // respond correctly when querying the trigger-out config. Only provide the
   // trigger-out properties when it appears to be working.
   unsigned char dummy[5];
   ret = g_Interface->GetTriggerOutConfig(*this, *GetCoreCallback(), dummy);
   if (ret == DEVICE_OK) {
      // Trigger configuration
      CPropertyAction *pAct = new CPropertyAction(this, &LMM5Hub::OnTriggerOutConfig);
      CreateProperty("TriggerOutConfig", "", MM::String, false, pAct);
      std::vector<std::string> triggerConfigs;
      triggerConfigs.push_back("Enable-State");
      triggerConfigMap_["Enable-State"] = 256;
      triggerConfigs.push_back("Enable-Clock");
      triggerConfigMap_["Enable-Clock"] = 257;
      triggerConfigs.push_back("Disable-State");
      triggerConfigMap_["Disable-State"] = 0;
      triggerConfigs.push_back("Disable-Clock");
      triggerConfigMap_["Disable-Clock"] = 1;
      SetAllowedValues("TriggerOutConfig", triggerConfigs);

      // Trigger Exposure Time
      pAct = new CPropertyAction(this, &LMM5Hub::OnTriggerOutExposureTime);
      CreateProperty("TriggerExpTime(0.1ms)", "", MM::Integer, false, pAct);
   }

   ret = UpdateStatus();
   if (DEVICE_OK != ret)
      return ret;

   initialized_ = true;
   return DEVICE_OK;
}
示例#23
0
int LMM5Shutter::Initialize()
{
   if (g_Interface == NULL)
      return DEVICE_NOT_CONNECTED;

   // Name                                                                   
   CreateProperty(MM::g_Keyword_Name, name_.c_str(), MM::String, true);      
                                                                             
   // Description                                                            
   CreateProperty(MM::g_Keyword_Description, "Spectral LMM5 Shutter", MM::String, true);

   int ret = g_Interface->DetectLaserLines(*this, *GetCoreCallback()); 
   nrLines_= g_Interface->GetNrLines();
   if (ret != DEVICE_OK)
      return ret;

   availableLines* lines = g_Interface->getAvailableLaserLines();
   unsigned long lineMask = 0;
   for (int i=0; i < nrLines_; i++) 
      if (lines[i].present) 
         lineMask = lineMask | (1 << i);
   
   
   // outputs are available only since firmware 1.30.  Our interface will always return 1 for firmware that is older
   ret = g_Interface->GetNumberOfOutputs(*this, *GetCoreCallback(), nrOutputs_);
   if (nrOutputs_ > 1) 
   {
      CPropertyAction *pAct = new CPropertyAction(this, &LMM5Shutter::OnOutputSelect);
      CreateProperty("FiberOutput", "0", MM::Integer, false, pAct);
      for (int i = 0; i < nrOutputs_; i++) {
         std::ostringstream os;
         os << i;
         AddAllowedValue("FiberOutput", os.str().c_str());
      }
   }

   // We roll our own implementation of State and Label here (since we are a Shutter device, not a State Device
   // State
   CPropertyAction* pAct = new CPropertyAction(this, &LMM5Shutter::OnState);
   ret = CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, pAct);
   if (ret != DEVICE_OK)
      return ret;
   for (unsigned long i=0; i<=lineMask; i++)
   {
      if ((i & lineMask) == i)
      {
         std::stringstream tmp;
         tmp << i;
         AddAllowedValue(MM::g_Keyword_State, tmp.str().c_str());
      }
   }

   // Label
   pAct = new CPropertyAction(this, &LMM5Shutter::OnLabel);
   ret = CreateProperty(MM::g_Keyword_Label, "", MM::String, false, pAct);
   if (ret != DEVICE_OK)
      return ret;

   for (unsigned long i=0; i<=lineMask; i++)
   {
      if ((i & lineMask) == i)
      {
         std::string label = StateToLabel(i);;
         AddAllowedValue(MM::g_Keyword_Label, label.c_str());
      }
   }

   for (long i=0; i < nrLines_; i++) 
   {
      if (lines[i].present) 
      {
         if (lines[i].waveLength >= 100 || nrOutputs_ == 1)
         {
            CPropertyActionEx *pActEx = new CPropertyActionEx(this, &LMM5Shutter::OnStateEx, i);
            CreateProperty(lines[i].name.c_str(), "0", MM::Integer, false, pActEx);
            SetPropertyLimits(lines[i].name.c_str(), 0, 1);
         }
      }
   }

   changedTime_ = GetCurrentMMTime();
 
   ret = UpdateStatus();
   if (ret != DEVICE_OK)
      return ret;

   return DEVICE_OK;
}
示例#24
0
/*---------------------------------------------------------------------------
 This function initialize a Mightex_Sirius_SLC_USB device and creates the actions.
---------------------------------------------------------------------------*/
int Mightex_Sirius_SLC_USB::Initialize()
{

	int nRet;

	if(dev_num > 0)
	{
		devHandle = MTUSB_LEDDriverOpenDevice(cur_dev);
		if(devHandle >= 0)
		{
			channels = MTUSB_LEDDriverDeviceChannels(devHandle);
			devModuleType = MTUSB_LEDDriverDeviceModuleType(devHandle);
		}
	}

	// Initialize the Mode action
	CPropertyAction* pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnMode);
	nRet = CreateProperty("mode", "DISABLE", MM::String, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;
	AddAllowedValue( "mode", "DISABLE");
	AddAllowedValue( "mode", "NORMAL");
	AddAllowedValue( "mode", "STROBE");
	if((devModuleType != MODULE_MA) && (devModuleType != MODULE_CA))
		AddAllowedValue( "mode", "TRIGGER");

	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnChannel);
	nRet = CreateProperty("channel", "1", MM::Integer, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;
	if(channels > -1)
		SetPropertyLimits("channel", 1, channels);

	ledChannelData.Normal_CurrentMax = 20;
	ledChannelData.Normal_CurrentSet = 10;
	ledChannelData.Strobe_CurrentMax = 20;
	ledChannelData.Trigger_CurrentMax = 20;
	ledChannelData.Strobe_RepeatCnt = 1;
	ledChannelData.Trigger_Polarity = 1;
	ledChannelData.Strobe_Profile[0][0] = 0;
	ledChannelData.Strobe_Profile[0][1] = 500000;
	ledChannelData.Strobe_Profile[1][0] = 10;
	ledChannelData.Strobe_Profile[1][1] = 500000;
	ledChannelData.Strobe_Profile[2][0] = 0;
	ledChannelData.Strobe_Profile[2][1] = 0;
	ledChannelData.Trigger_Profile[0][0] = 0;
	ledChannelData.Trigger_Profile[0][1] = 500000;
	ledChannelData.Trigger_Profile[1][0] = 10;
	ledChannelData.Trigger_Profile[1][1] = 500000;
	ledChannelData.Trigger_Profile[2][0] = 0;
	ledChannelData.Trigger_Profile[2][1] = 0;

	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetImax);
	nRet = CreateProperty("iMax", "20", MM::Integer, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;

	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetNormalCurrent);
	nRet = CreateProperty("normal_CurrentSet", "10", MM::Integer, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;
	SetPropertyLimits("normal_CurrentSet", 0, 20);

	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetRatio);
	nRet = CreateProperty("ratio", "50", MM::Integer, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;
	SetPropertyLimits("ratio", 0, 100);

	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetPeriod);
	nRet = CreateProperty("frequency", "1", MM::Integer, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;

	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetI1);
	nRet = CreateProperty("i1", "0", MM::Integer, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;
	SetPropertyLimits("i1", 0, 20);

	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetI2);
	nRet = CreateProperty("i2", "10", MM::Integer, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;
	SetPropertyLimits("i2", 0, 20);

	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetRepeatCnt);
	nRet = CreateProperty("repeatCnt", "1", MM::Integer, false, pAct);
	if (DEVICE_OK != nRet)	return nRet;

	// Initialize the status query action
	pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnStatus);
	nRet = CreateProperty("Status", "No Fault", MM::String, true, pAct);
	if (DEVICE_OK != nRet)	return nRet;

	CreateStaticReadOnlyProperties();

	m_initialized = true;

	// init message
	std::ostringstream log;
	log << "Mightex Sirius SLC(USB) - initializied " << "S/N: " << m_serialNumber;
	LogMessage(log.str().c_str());

	return DEVICE_OK;
}
示例#25
0
SerialPort::SerialPort(const char* portName) :
   refCount_(0),
   pService_(0),
   pPort_(0),
   pThread_(0),
   busy_(false),
   initialized_(false),
   portTimeoutMs_(2000.0),
   answerTimeoutMs_(500),
   transmitCharWaitMs_(0.0),
   stopBits_(g_StopBits_1),
   parity_(g_Parity_None),
   verbose_(true)
{

   portName_ = portName;

   InitializeDefaultErrorMessages();

   // configure pre-initialization properties
   // Name
   int ret = CreateProperty(MM::g_Keyword_Name, portName_.c_str(), MM::String, true);
   assert(ret == DEVICE_OK);

   // Description
   ret = CreateProperty(MM::g_Keyword_Description, "Serial port driver (boost:asio)", MM::String, true);
   assert(ret == DEVICE_OK);

   // baud
   CPropertyAction* pActBaud = new CPropertyAction (this, &SerialPort::OnBaud);
   ret = CreateProperty(MM::g_Keyword_BaudRate, g_Baud_9600, MM::String, false, pActBaud, true);
   assert(DEVICE_OK == ret);

   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_110, (long)110);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_300, (long)300);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_600, (long)600);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_1200, (long)1200);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_2400, (long)2400);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_4800, (long)4800);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_9600, (long)9600);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_14400, (long)14400);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_19200, (long)19200);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_57600, (long)57600);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_115200, (long)115200);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_128000, (long)128000);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_230400, (long)230400);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_460800, (long)460800);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_500000, (long)500000);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_500000, (long)500000);
   AddAllowedValue(MM::g_Keyword_BaudRate, g_Baud_921600, (long)921600);

   // data bits
   ret = CreateProperty(MM::g_Keyword_DataBits, "8", MM::String, true);
   assert(ret == DEVICE_OK);

   // stop bits
   CPropertyAction* pActStopBits = new CPropertyAction (this, &SerialPort::OnStopBits);
   ret = CreateProperty(MM::g_Keyword_StopBits, g_StopBits_1, MM::String, false, pActStopBits, true);
   assert(ret == DEVICE_OK);

   AddAllowedValue(MM::g_Keyword_StopBits, g_StopBits_1, (long)boost::asio::serial_port_base::stop_bits::one);
   AddAllowedValue(MM::g_Keyword_StopBits, g_StopBits_1_5, (long)boost::asio::serial_port_base::stop_bits::onepointfive);
   AddAllowedValue(MM::g_Keyword_StopBits, g_StopBits_2, (long)boost::asio::serial_port_base::stop_bits::two);

   // parity
   CPropertyAction* pActParity = new CPropertyAction (this, &SerialPort::OnParity);
   ret = CreateProperty(MM::g_Keyword_Parity, g_Parity_None, MM::String, false, pActParity, true);
   assert(ret == DEVICE_OK);

   AddAllowedValue(MM::g_Keyword_Parity, g_Parity_None, (long)boost::asio::serial_port_base::parity::none);
   AddAllowedValue(MM::g_Keyword_Parity, g_Parity_Odd, (long)boost::asio::serial_port_base::parity::odd);
   AddAllowedValue(MM::g_Keyword_Parity, g_Parity_Even, (long)boost::asio::serial_port_base::parity::even);

   // handshaking
   CPropertyAction* pActHandshaking = new CPropertyAction (this, &SerialPort::OnHandshaking);
   ret = CreateProperty(MM::g_Keyword_Handshaking, "Off", MM::String, false, pActHandshaking, true);
   assert(ret == DEVICE_OK);
   AddAllowedValue(MM::g_Keyword_Handshaking, g_Handshaking_Off, (long)boost::asio::serial_port_base::flow_control::none);
   AddAllowedValue(MM::g_Keyword_Handshaking, g_Handshaking_Hardware, (long)boost::asio::serial_port_base::flow_control::hardware);
   AddAllowedValue(MM::g_Keyword_Handshaking, g_Handshaking_Software, (long)boost::asio::serial_port_base::flow_control::software);

   // answer timeout
   CPropertyAction* pActTimeout = new CPropertyAction (this, &SerialPort::OnTimeout);
   ret = CreateProperty("AnswerTimeout", "500", MM::Float, false, pActTimeout, true);
   assert(ret == DEVICE_OK);

   // transmission Delay                                                     
   CPropertyAction* pActTD = new CPropertyAction (this, &SerialPort::OnDelayBetweenCharsMs);
   ret = CreateProperty("DelayBetweenCharsMs", "0", MM::Float, false, pActTD, true);
   assert(ret == DEVICE_OK);   

   // verbose debug messages
   pActTD = new CPropertyAction (this, &SerialPort::OnVerbose);
   (void)CreateProperty("Verbose", (verbose_?"1":"0"), MM::Integer, false, pActTD, true);
   AddAllowedValue("Verbose", "0");
   AddAllowedValue("Verbose", "1");

}
示例#26
0
int LCShutter::Initialize()
{
   if (!LaserBoardIsOpen()) {
      int ret = LaserBoardOpen();
      if (ret != NO_ERR)
         return ret;
   }

   int ret = LaserBoardGetState(&state_);
   if (ret != DEVICE_OK)
      return ret;

   int result;
   ret = LaserBoardGetBlank(&result);
   blank_ = result != 0;
   if (ret != DEVICE_OK)
      return ret;

   char buf[64];
   ret = LaserBoardDriverVersion(buf);
   if (ret != NO_ERR)
      return ret;

   driverVersion_ = buf;

   std::stringstream s;
   s << driverVersion_;
   s >> driverVersionNum_;

   ret = LaserBoardFirmwareVersion(buf);
   if (ret != NO_ERR)
      return ret;
   firmwareVersion_ = buf;


   // set property list
   // -----------------
   
   // Name
   ret = CreateProperty(MM::g_Keyword_Name, name_.c_str(), MM::String, true);
   if (DEVICE_OK != ret)
      return ret;

   // Description
   ret = CreateProperty(MM::g_Keyword_Description, "LC shutter driver", MM::String, true);
   if (DEVICE_OK != ret)
      return ret;

   // Serial 
   char serial[64];
   ret = LaserBoardGetSerial(serial);
   if (DEVICE_OK != ret)
      return ret;
   ret = CreateProperty("Serial", serial, MM::String, true);

   // Firmware Version
   ret = CreateProperty("Firmware Version", firmwareVersion_.c_str(), MM::String, true);
   if (DEVICE_OK != ret)
      return ret;

   // Driver Version
   ret = CreateProperty("Driver Version", driverVersion_.c_str(), MM::String, true);
   if (DEVICE_OK != ret)
      return ret;

   ret = LaserBoardGetNrLines(&nrLines_);
   if (ret != NO_ERR)
      return ret;

   std::vector<unsigned int> nm;
   std::vector<float> mw;
   for (unsigned int i=0; i < nrLines_; i++) {
      unsigned int nmi, bd;
      float maxV, maxMW;
      LaserBoardGetLineInfo(i, &nmi, &maxV, &maxMW, &bd);
      nm.push_back(nmi);
      mw.push_back(maxMW);
   }
 
   for (unsigned int i=0; i<nrLines_; i++) {
      std::string propName;
      std::ostringstream os;
      os << nm.at(i) << "nm mW";
      // cheap way of guaranteeing that the propname is unique
      for (unsigned int j=0; j<i; j++)
         os << " ";
      propName = os.str();
      CPropertyActionEx* pActEx = new CPropertyActionEx(this, &LCShutter::OnPower, (long) i);
      ret = CreateProperty(propName.c_str(), "0", MM::Float, false, pActEx, false);
      if (ret != DEVICE_OK)
         return ret;
      SetPropertyLimits(propName.c_str(), 0.0, mw.at(i));
   }

   CPropertyAction* pAct = new CPropertyAction(this, &LCShutter::OnState);
   ret = CreateProperty("LaserLine", "none", MM::String, false, pAct);
   if (ret != DEVICE_OK)
      return ret;

   laserStateByName_["none"] = 0;
   laserNameByState_[0] = "none";
   AddAllowedValue("LaserLine", "none");
   for (unsigned char i = 0; i < nrLines_; i++) {
      std::ostringstream os;
      os << nm.at(i) << "nm";
      unsigned char state = 1 << i;
      laserStateByName_[os.str()] = state;
      laserNameByState_[state] = os.str();
      AddAllowedValue("LaserLine", os.str().c_str());
      for (unsigned char j = i + 1; j<nrLines_; j++) {
         //unsigned char lstate = state;
         os << " + " << nm.at(j) << "nm";
         state |= (1 << j);
         laserStateByName_[os.str()] = state;
         laserNameByState_[state] = os.str();
         AddAllowedValue("LaserLine", os.str().c_str());
      }
   }

   // Blank
   pAct = new CPropertyAction(this, &LCShutter::OnBlank);
   ret = CreateProperty("Blank", "Off", MM::String, false, pAct);
   if (ret != DEVICE_OK)
      return ret;
   AddAllowedValue("Blank", "Off");
   AddAllowedValue("Blank", "On");

   // External control
   pAct = new CPropertyAction(this, &LCShutter::OnExternalControl);
   ret = CreateProperty("ExternalControl", "Off", MM::String, false, pAct);
   if (ret != DEVICE_OK)
      return ret;
   AddAllowedValue("ExternalControl", "Off");
   AddAllowedValue("ExternalControl", "On");

   // Sync
   pAct = new CPropertyAction(this, &LCShutter::OnSync);
   ret = CreateProperty("External Trigger", "Off", MM::String, false, pAct);
   if (ret != DEVICE_OK)
      return ret;
   AddAllowedValue("External Trigger", "Off");
   AddAllowedValue("External Trigger", "On");

   // Functions that are only in newer Driver versions
   if (driverVersionNum_ >= 0.2) 
   {
      // Output (Galvo)
      int position;
      ret = LaserBoardGetGalvo(&position);
      if (ret == NO_ERR)
      {
         pAct = new CPropertyAction(this, &LCShutter::OnOutput);
         ret = CreateProperty("Output", g_fiber_1, MM::String, false, pAct);
         if (ret != DEVICE_OK)
            return ret;
         AddAllowedValue("Output", g_fiber_1);
         AddAllowedValue("Output", g_fiber_2);
      }

      // ND filters
      int on;
      ret = LaserBoardGetNDOnOff(0, &on);
      if (ret == NO_ERR)
      {
         for (unsigned char i = 0; i < nrLines_; i++) 
         {
            CPropertyActionEx* pActEx = new CPropertyActionEx(this, &LCShutter::OnND, i);
            unsigned char state = 1 << i;
            std::stringstream propName;
            propName << "ND" << laserNameByState_[state];
            ret = CreateProperty(propName.str().c_str(), "Off", MM::String, false, pActEx);
            if (ret != DEVICE_OK)
               return ret;
            AddAllowedValue(propName.str().c_str(), "On");
            AddAllowedValue(propName.str().c_str(), "Off");
         }
      }
   }

   // set shutter into the off state
   LaserBoardSetState(0);

   initialized_ = true;

   return DEVICE_OK;
}