Beispiel #1
0
int PIZStage::Initialize()
{
   MM::Device* device = GetDevice(controllerName_.c_str());
   if (device == NULL)
	   return ERR_GCS_PI_NO_CONTROLLER_FOUND;

   int ret = device->Initialize();
   if (ret != DEVICE_OK)
	   return ret;

   ctrl_ = PIController::GetByLabel(controllerName_);
   if (ctrl_ == NULL)
	   return ERR_GCS_PI_NO_CONTROLLER_FOUND;

   std::string  sBuffer;
   ctrl_->qIDN(sBuffer);
   LogMessage(std::string("Connected to: ") + sBuffer);

   ret = ctrl_->InitStage(axisName_, stageType_);
   if (ret != DEVICE_OK)
   {
	   LogMessage("Cannot init axis");
	   return ret;
   }

     // axis limits (assumed symmetrical)
   CPropertyAction* pAct = new CPropertyAction (this, &PIZStage::OnHoming);
   CreateProperty("HOMING", "", MM::String, false, pAct);

   pAct = new CPropertyAction (this, &PIZStage::OnVelocity);
   CreateProperty("Velocity", "", MM::Float, false, pAct);

   initialized_ = true;
   return DEVICE_OK;
}
Beispiel #2
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;
}
Beispiel #3
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());
   }


}  
Beispiel #4
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;
}
Beispiel #5
0
int SC10::Initialize()
{
   // Get info about device. 
   std::string deviceInfo;
   int ret = ExecuteCommand("*idn?", deviceInfo);
   if (ret != DEVICE_OK)
      // With some ports, the first command fails.  In that case, repeat once
      ret = ExecuteCommand("*idn?", deviceInfo);
      if (ret != DEVICE_OK)
         return ret;
   CreateProperty("Device Info", deviceInfo.c_str(), MM::String, true);
   LogMessage(deviceInfo.c_str());

   // Set device to manual mode (1) needed for normal operation
   std::string answer;
   ret = ExecuteCommand("mode=1", answer);
   if (ret != DEVICE_OK)
      return ret;
   
   CPropertyAction* pAct = new CPropertyAction(this, &SC10::OnCommand);
   ret = CreateProperty("SC10 Command:", "", MM::String, false, pAct);
         
   ret = UpdateStatus();
   if (ret != DEVICE_OK)
      return ret;

   initialized_ = true;
   return DEVICE_OK;
}
Beispiel #6
0
Controller::Controller(const char* name) :
   initialized_(false), 
   intensity_(0),
   state_(0),
   name_(name), 
   busy_(false),
   error_(0),
   changedTime_(0.0)
{
   assert(strlen(name) < (unsigned int) MM::MaxStrLength);

   InitializeDefaultErrorMessages();

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

   // Name
   CreateProperty(MM::g_Keyword_Name, name_.c_str(), MM::String, true);

   // Description
   CreateProperty(MM::g_Keyword_Description, "PrecisExcite LED Illuminator", MM::String, true);

   // Port
   CPropertyAction* pAct = new CPropertyAction (this, &Controller::OnPort);
   CreateProperty(MM::g_Keyword_Port, "Undefined", MM::String, false, pAct, true);

   EnableDelay(); // signals that the delay setting will be used
   UpdateStatus();
}
Beispiel #7
0
void MUCamSource::InitPixelType()
{
    bitCnt_ = bitDepth_ * bytesPerPixel_;
    // pixel type
    CPropertyAction*pAct = new CPropertyAction (this, &MUCamSource::OnPixelType);
    int ret;
    vector<string> pixelTypeValues;
    if(colorChannel_ == 1)
    {
        ret = CreateProperty(MM::g_Keyword_PixelType, g_PixelType_8bit, MM::String, false, pAct);
        pixelTypeValues.push_back(g_PixelType_8bit);
        // if(MIDP_Has16Bits() == 0)
        {
            pixelTypeValues.push_back(g_PixelType_16bit);
        }
    }
    else if(colorChannel_ == 3)
    {
        ret = CreateProperty(MM::g_Keyword_PixelType, g_PixelType_32bitRGB, MM::String, false, pAct);
        pixelTypeValues.push_back(g_PixelType_8bit);
        pixelTypeValues.push_back(g_PixelType_32bitRGB);
        // if(MIDP_Has16Bits() == 0)
        {
            pixelTypeValues.push_back(g_PixelType_16bit);
            pixelTypeValues.push_back(g_PixelType_64bitRGB);
        }
        bytesPerPixel_ = 4;
    }
    ret = SetAllowedValues(MM::g_Keyword_PixelType, pixelTypeValues);
}
Beispiel #8
0
//Tells micromanager the step size, top speed and acceleration. 
//Speed and acceleration ranges does not refer to a meaningful unit but
//the range that the hardware uses.
int XYStage::Initialize()
{
   // Step size
   CPropertyAction* pAct = new CPropertyAction (this, &XYStage::OnStepSizeX);
   CreateProperty("StepSizeX_um", "0.1", MM::Float, true, pAct);
   pAct = new CPropertyAction (this, &XYStage::OnStepSizeY);
   CreateProperty("StepSizeY_um", "0.1", MM::Float, true, pAct);

   // Max Speed
   pAct = new CPropertyAction (this, &XYStage::OnMaxSpeed);
   CreateProperty("MaxSpeed", "30000", MM::Integer, false, pAct);
   SetPropertyLimits("MaxSpeed", 1000, 50000);

   // Acceleration
   pAct = new CPropertyAction (this, &XYStage::OnAcceleration);
   CreateProperty("Acceleration", "500", MM::Integer, false, pAct);
   SetPropertyLimits("Acceleration", 1, 1000);
   
   int ret = UpdateStatus();
   if (ret != DEVICE_OK)
      return ret;

   initialized_ = true;
   return DEVICE_OK;
}
Cobolt::Cobolt() :
port_("Undefined"),
initialized_(false),
busy_(false),
answerTimeoutMs_(1000),
power_(0.00),
maxPower_(0.00),
laserOn_("On"),
laserStatus_("Undefined"),
interlock_ ("Interlock Open"),
fault_("No Fault"),
serialNumber_("0"),
version_("0")
{
    InitializeDefaultErrorMessages();
    SetErrorText(ERR_PORT_CHANGE_FORBIDDEN, "You can't change the port after device has been initialized.");
    
    // Name
    CreateProperty(MM::g_Keyword_Name, g_DeviceCoboltName, MM::String, true);
    
    // Description
    CreateProperty(MM::g_Keyword_Description, "Cobolt Laser Power Controller", MM::String, true);
    
    // Port
    CPropertyAction* pAct = new CPropertyAction (this, &Cobolt::OnPort);
    CreateProperty(MM::g_Keyword_Port, "Undefined", MM::String, false, pAct, true);
    // Max Power
    pAct = new CPropertyAction (this, &Cobolt::OnPowerMax);
    CreateProperty("Max Power", "Undefined", MM::Float, false, pAct, true);
  
}
Beispiel #10
0
CPI_E761_ZStage::CPI_E761_ZStage() :
		stepSizeUm_(0.001), axisLimitUm_(100.0), busy_(false), initialized_(
				false), currentAxis_(3) {
	memset(axisName_, 0, 64);
	InitializeDefaultErrorMessages();
	//SetErrorText(PI_CNTR_PARAM_SYNTAX, "Parameter syntax error");
	//SetErrorText(PI_CNTR_UNKNOWN_COMMAND, "Unknown command");
	//SetErrorText(PI_CNTR_MOVE_WITHOUT_REF_OR_NO_SERVO, "Unallowable move attempted on unreferenced axis, or move attempted with servo off");
	//SetErrorText(PI_CNTR_POS_OUT_OF_LIMITS, "Position out of limits");
	//SetErrorText(PI_CNTR_VEL_OUT_OF_LIMITS, "Velocity out of limits");
	//SetErrorText(PI_CNTR_INVALID_AXIS_IDENTIFIER, "Invalid axis identifier");
	//SetErrorText(PI_CNTR_INVALID_STAGE_NAME, "Unknown stage name");
	//SetErrorText(PI_CNTR_PARAM_OUT_OF_RANGE, "Parameter out of range");
	//SetErrorText(PI_CNTR_OPENLOOP_VALUE_SET_WHEN_SERVO_ON, "Open-loop commands (SVA, SVR) are not allowed when servo is on");
	//SetErrorText(PI_CNTR_SEND_BUFFER_OVERFLOW, "Send buffer overflow");
	//SetErrorText(PI_CNTR_VOLTAGE_OUT_OF_LIMITS, "Voltage out of limits");
	//SetErrorText(PI_CNTR_OPEN_LOOP_MOTION_SET_WHEN_SERVO_ON, "Open-loop motion attempted when servo ON");

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

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

	// Description
	CreateProperty(MM::g_Keyword_Description,
			"Physik Instrumente (PI) E761 Adapter / Z-Stage", MM::String, true);

	//// axis limit in um
	//pAct = new CPropertyAction (this, &CPI_E761_ZStage::OnAxisLimit);
	//CreateProperty(g_PI_ZStageAxisLimitUm, "500.0", MM::Float, false, pAct, true);
}
void PIGCSControllerDLLDevice::CreateInterfaceProperties(void)
{
   CPropertyAction* pAct;
   std::string interfaceParameterLabel = "";

   // Interface type
   if (bShowInterfaceProperties_)
   {
      pAct = new CPropertyAction (this, &PIGCSControllerDLLDevice::OnInterfaceType);
      CreateProperty(PIGCSControllerDLLDevice::PropInterfaceType_, interfaceType_.c_str(), MM::String, false, pAct, true);

      interfaceParameterLabel = PIGCSControllerDLLDevice::PropInterfaceParameter_;
   }
   else
   {
      if (strcmp(interfaceType_.c_str(), "PCI") == 0)
      {
         interfaceParameterLabel = "PCI Board";
      }
      else if (strcmp(interfaceType_.c_str(), "RS-232") == 0)
      {
         interfaceParameterLabel = "ComPort ; Baudrate";
      }
   }
   
   // Interface parameter
   if (interfaceParameterLabel.empty()) return;

   pAct = new CPropertyAction (this, &PIGCSControllerDLLDevice::OnInterfaceParameter);
   CreateProperty(interfaceParameterLabel.c_str(), interfaceParameter_.c_str(), MM::String, false, pAct, true);
}
Beispiel #12
0
int LStepOld::Initialize()
{
   std::string answer;
   int s = ExecuteCommand( g_cmd_get_motor_speed, NULL, 0, &answer );
   if (s!=DEVICE_OK)
      return s;
   motor_speed_ = atof( answer.c_str() ) * .1;
   char speed[5];
   sprintf( speed, "%2.1f",  motor_speed_ );
   CPropertyAction* pAct = new CPropertyAction(this, &LStepOld::OnSpeed );
   CreateProperty( "Motor-speed [Hz]", speed, MM::Float, false, pAct);
   SetPropertyLimits( "Motor-speed [Hz]", 0.01, 25 );

   s = ExecuteCommand( g_cmd_get_version, NULL, 0, &answer );
   if (s!=DEVICE_OK)
      return s;
   CreateProperty("Firmware Version", answer.c_str(), MM::String, true);

   pAct = new CPropertyAction( this, &LStepOld::OnJoystick );
   CreateProperty( "Joystick command", "False", MM::String, false, pAct);
   std::vector<std::string> allowed_boolean;
   allowed_boolean.push_back("True");
   allowed_boolean.push_back("False");
   SetAllowedValues("Joystick command", allowed_boolean);

   return DEVICE_OK;
}
int ZStage::Initialize()
{
    if(!g_device_connected)
        return DEVICE_NOT_CONNECTED;

    if(_init)
        return DEVICE_OK;

    // Name and description
    CreateProperty(MM::g_Keyword_Name, g_devlist[MoticZ][0],
                   MM::String, true);
    CreateProperty(MM::g_Keyword_Description, g_devlist[MoticZ][1],
                   MM::String, true);

    double l(0), r(0);
    z_SpeedRange(&l, &r);
    CreateProperty(PROP_ZSPEED, CDeviceUtils::ConvertToString(r / 2), MM::Float, false, 0);
    SetPropertyLimits(PROP_ZSPEED, l, r);

    Hub* hub = static_cast<Hub*>(GetParentHub());
    if(hub)
    {
        hub->AddEventReceiver(this);
    }

    UpdateStatus();

    _init = true;
    return DEVICE_OK;
}
///////////////////////////////////////////////////////////////////////////////
// XYStageH128
//
XYStage::XYStage() : // LIN 01/01/2012 DIDN'T RENAME FUNCTION. ASSUMING MMCORE WILL EXPECT TO CALL ON XYStage()
   CXYStageBase<XYStage>(),
   initialized_(false), 
   port_("Undefined"), 
   stepSizeXUm_(0.1), // LIN 01/02/2012 changed initial value from 0.0 to 0.1
   stepSizeYUm_(0.1), // LIN 01/02/2012 changed initial value from 0.0 to 0.1
   answerTimeoutMs_(1000),
   originX_(0),
   originY_(0),
   mirrorX_(false),
   mirrorY_(false),
   busy_(false) // LIN 01/01/2012 ADDED
{
   InitializeDefaultErrorMessages();

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

   // Name
   // CreateProperty(MM::g_Keyword_Name, g_LegacyXYStageDeviceName, MM::String, true); // LIN 01/01/2012 RENAMED

   // Description 
   CreateProperty(MM::g_Keyword_Description, "Prior H128 XY stage driver adapter", MM::String, true); // LIN 01/01/2012 RENAMED
   // Port
   CPropertyAction* pAct = new CPropertyAction (this, &XYStage::OnPort);
   CreateProperty(MM::g_Keyword_Port, "Undefined", MM::String, false, pAct, true);

   EnableDelay(); // LIN 01-01-2012 ADDED SO WE CAN SET DELAY INSTEAD OF QUERYING H128 BUSY STATUS

}
Beispiel #15
0
H101CryoControl::H101CryoControl() :
   initialized_(false)  
{
 InitializeDefaultErrorMessages();

 CreateProperty(MM::g_Keyword_Name, g_H101CryoControl , MM::String, true);
 CreateProperty(MM::g_Keyword_Description, "Okolab H101 Cryo Control adapter", MM::String, true);
}
Beispiel #16
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);
	}
}
Beispiel #17
0
int CPI_E761_XYStage::Initialize() {
	if (initialized_)
		return DEVICE_OK;

	g_pXYStage = this;

	MMThreadGuard guard(g_PI_ThreadLock);

	if (g_DeviceId < 0) {
		// Connect the device
		int id = E7XX_ConnectPciBoard(1);
		if (id == -1)
			return id;
		g_DeviceId = id;
	}

	// Get axis names
	int ret = E7XX_qSAI(g_DeviceId, g_AxisNames, 63);
	if (!ret)
		return processErr();
	for (int i = 0; i < 2; i++) {
		axisName_[i] = g_AxisNames[currentAxis_[i] - 1];
	}
	xaxisName_[0] = axisName_[0];
	yaxisName_[0] = axisName_[1];

	// Switch to servo mode
	BOOL svoVals[] = { true, true };
	ret = E7XX_SVO(g_DeviceId, axisName_, svoVals);
	if (!ret)
		return processErr();

	// StepSize
	CPropertyAction* pAct = new CPropertyAction(this,
			&CPI_E761_XYStage::OnStepSizeUm);
	CreateProperty("StepSizeUm", "0.001", MM::Float, false, pAct);

	// Axis name
	pAct = new CPropertyAction(this, &CPI_E761_XYStage::OnAxisName);
	CreateProperty("Axis name", "12", MM::String, false, pAct);

	// Positions
	pAct = new CPropertyAction(this, &CPI_E761_XYStage::OnXPosition);
	CreateProperty(CPI_E761_XYStage::PropXPos, "0.0", MM::Float, false, pAct);
	pAct = new CPropertyAction(this, &CPI_E761_XYStage::OnYPosition);
	CreateProperty(CPI_E761_XYStage::PropYPos, "0.0", MM::Float, false, pAct);

	// Travel range
	pAct = new CPropertyAction(this, &CPI_E761_XYStage::OnTravelRange);
	CreateProperty("Travel range", "", MM::String, true, pAct);

	return DEVICE_OK;
}
Beispiel #18
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;
}
int Objectives::Initialize()
{
    if(!g_device_connected)
        return DEVICE_NOT_CONNECTED;

    if(_init)
        return DEVICE_OK;

    // Name and description
    CreateProperty(MM::g_Keyword_Name, g_devlist[MoticObjectives][0],
                   MM::String, true);
    CreateProperty(MM::g_Keyword_Description, g_devlist[MoticObjectives][1],
                   MM::String, true);

    _mag.clear();
    if(obj_Available())
    {
        for(int i = 0; i < obj_GetCount(); i++)
        {
            double m = obj_GetObjectiveMagnification(i);
            if(m > 0)
            {
                _mag[i] = m;
            }
        }
        char buf[64];
        for(map<int, double>::iterator i = _mag.begin(); i != _mag.end(); ++i)
        {
            sprintf(buf, "%dX", (int)i->second);
            SetPositionLabel(i->first, buf);
        }
        _curpos = obj_GetCurrentObjective();

        CPropertyAction* act = new CPropertyAction(this, &Objectives::OnState);
        CreateProperty(MM::g_Keyword_State, CDeviceUtils::ConvertToString(_curpos), MM::Integer, false, act);

        act = new CPropertyAction(this, &CStateBase::OnLabel);
        CreateProperty(MM::g_Keyword_Label, "", MM::String, false, act);
    }

    Hub* hub = static_cast<Hub*>(GetParentHub());
    if(hub)
    {
        hub->AddEventReceiver(this);
    }

    UpdateStatus();

    _init = true;
    return DEVICE_OK;;
}
int PIGCSControllerDLLDevice::Initialize()
{
	if (initialized_)
		return DEVICE_OK;

	char szLabel[MM::MaxStrLength];
	GetLabel(szLabel);
	ctrl_ = new PIGCSControllerDLL(szLabel, this, GetCoreCallback()); 

   int ret = ctrl_->LoadDLL(dllName_);
   if (ret != DEVICE_OK)
   {
      LogMessage(std::string("Cannot load dll ") + dllName_);
      Shutdown();
	  return ret;
   }

   ret = ctrl_->ConnectInterface(interfaceType_, interfaceParameter_);
   if (ret != DEVICE_OK)
   {
	   LogMessage("Cannot connect");
	   Shutdown();
	   return ret;
   }
   initialized_ = true;

   int nrJoysticks = ctrl_->FindNrJoysticks();
	if (nrJoysticks > 0)
	{
		CPropertyAction* pAct = new CPropertyAction (this, &PIGCSControllerDLLDevice::OnJoystick1);
		CreateProperty("Joystick 1", "0" , MM::Integer, false, pAct);
	}
	if (nrJoysticks > 1)
	{
		CPropertyAction* pAct = new CPropertyAction (this, &PIGCSControllerDLLDevice::OnJoystick2);
		CreateProperty("Joystick 2", "0" , MM::Integer, false, pAct);
	}
	if (nrJoysticks > 2)
	{
		CPropertyAction* pAct = new CPropertyAction (this, &PIGCSControllerDLLDevice::OnJoystick3);
		CreateProperty("Joystick 3", "0" , MM::Integer, false, pAct);
	}
	if (nrJoysticks > 3)
	{
		CPropertyAction* pAct = new CPropertyAction (this, &PIGCSControllerDLLDevice::OnJoystick4);
		CreateProperty("Joystick 4", "0" , MM::Integer, false, pAct);
	}


   return ret;
}
Beispiel #21
0
int RappScanner::Initialize()
{
   UGA_ = new obsROE_Device();
   
   UGA_->Connect(port_.c_str());

   // Other devices may have send signals to the UGA 40.  If connection failed, try one more time to clear this up
   if (!UGA_->IsConnected()) 
   {
      UGA_->Connect(port_.c_str());
   }

   if (UGA_->IsConnected()) 
   {
      UGA_->UseMaxCalibration(false);
      UGA_->SetCalibrationMode(false, false);
	  UGA_->SetCalibrationMode(false, true);
      RunDummyCalibration(false);
	  RunDummyCalibration(true);
      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);

   pAct = new CPropertyAction(this, &RappScanner::OnLaser);
   CreateProperty("Laser", "1", MM::Integer, false, pAct);
   AddAllowedValue("Laser", "1");
   AddAllowedValue("Laser", "2");

   return DEVICE_OK;
}
Beispiel #22
0
Xcite120PC::Xcite120PC() :
   initialized_(false),
   port_("Undefined"),
   is_open_(false),
   is_locked_("False"),
   lamp_intensity_("100"),
   lamp_state_("On"),
   exposure_time_s_(0.2)
{
  InitializeDefaultErrorMessages();
  CreateProperty(MM::g_Keyword_Name, g_Xcite120PCName, MM::String, true);

  CPropertyAction* pAct = new CPropertyAction (this, &Xcite120PC::OnPort);
  CreateProperty(MM::g_Keyword_Port, "Unefined", MM::String, false, pAct, true);
}
Beispiel #23
0
void Sapphire::GenerateReadOnlyIDProperties()
{
	CPropertyAction* pAct; 
 

   pAct = new CPropertyAction(this, &Sapphire::OnMinimumLaserPower);
   CreateProperty("Minimum Laser Power", "", MM::Float, false, pAct);
   
	pAct = new CPropertyAction(this, &Sapphire::OnMaximumLaserPower);
   CreateProperty("Maximum Laser Power", "", MM::Float, false, pAct);

	pAct = new CPropertyAction(this, &Sapphire::OnWaveLength);
   CreateProperty("Wavelength", "", MM::Float, false, pAct);


}
XnStatus XnDeviceModuleHolder::UnsafeSetProperties(const XnActualPropertiesHash& props)
{
	XnStatus nRetVal = XN_STATUS_OK;
	
	for (XnActualPropertiesHash::ConstIterator it = props.Begin(); it != props.End(); ++it)
	{
		XnProperty* pRequestProp = it->Value();
		XnProperty* pProp = NULL;

		// check if property already exist
		nRetVal = m_pModule->GetProperty(pRequestProp->GetName(), &pProp);
		if (nRetVal == XN_STATUS_DEVICE_PROPERTY_DONT_EXIST)
		{
			// property doesn't exist. create it now
			nRetVal = CreateProperty(pRequestProp);
			XN_IS_STATUS_OK(nRetVal);
		}
		else if (nRetVal == XN_STATUS_OK)
		{
			// property exists. Change its value
			nRetVal = UnsafeSetProperty(pRequestProp, pProp);
			XN_IS_STATUS_OK(nRetVal);
		}
		else
		{
			// error
			return (nRetVal);
		}

	} // props loop
	
	return (XN_STATUS_OK);
}
Beispiel #25
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");
}
Beispiel #26
0
void MUCamSource::InitBinning()
{
    BinningsVec_.clear();
    int cnt = MUCam_getBinningCount(hCameras_[currentCam_]);
    int x[6], y[6];
    MUCam_getBinningList(hCameras_[currentCam_], x, y);
    for(int i = 0; i < cnt; i++)
    {
        BinningsVec_.push_back(x[i]);
        BinningsVec_.push_back(y[i]);
    }
    binning_ = 1;
    
    // binning
    CPropertyAction *pAct = new CPropertyAction (this, &MUCamSource::OnBinning);
    int ret = CreateProperty(MM::g_Keyword_Binning,
                             CDeviceUtils::ConvertToString(1<<binning_), MM::Integer, false, pAct);
    SetBinning(1<<binning_);
    //assert(ret == DEVICE_OK);
    
    vector<string> binningValues;
    for(int i = 0; i < cnt; i++)
    {
        binningValues.push_back(CDeviceUtils::ConvertToString(1<<i));
    }
    
    ret = SetAllowedValues(MM::g_Keyword_Binning, binningValues);

    assert(ret == DEVICE_OK);
}
Beispiel #27
0
void Controller::GeneratePropertyTriggerSequence()
{
   int ret;
   CPropertyAction* pAct = new CPropertyAction (this, &Controller::OnTriggerSequence);
   ret = CreateProperty(g_Keyword_Trigger_Sequence, "ABCD0", MM::String, false, pAct);
   SetProperty(g_Keyword_Trigger_Sequence, "ABCD0");
}
Beispiel #28
0
/*---------------------------------------------------------------------------
 This function creates the static read only properties.
---------------------------------------------------------------------------*/
int Mightex_Sirius_SLC_USB::CreateStaticReadOnlyProperties(void)
{
	int nRet = DEVICE_OK;
	char serialNum[32] = "";

	nRet = CreateProperty("Device Name", m_name.c_str(), MM::String, true);
	if (DEVICE_OK != nRet)	return nRet;

	if(devHandle >= 0)
		MTUSB_LEDDriverSerialNumber(devHandle, serialNum, sizeof(serialNum));
	m_serialNumber = serialNum;
	nRet = CreateProperty("Serial Number", m_serialNumber.c_str(), MM::String, true);
	if (DEVICE_OK != nRet)	return nRet;

	return nRet;
}
Beispiel #29
0
/**
 * Intializes the hardware.
 * Typically we access and initialize hardware at this point.
 * Device properties are typically created here as well.
 * Required by the MM::Device API.
 */
int MUCamSource::Initialize()
{
    if (!LoadFunctions())
        return DEVICE_ERR;
    if (initialized_)
        return DEVICE_OK;

    // set property list
    // -----------------
    FindMoticCameras();
    if(cameraCnt_ == 0)
    {
        return ERR_NO_CAMERAS_FOUND;
    }

    currentCam_ = 0;//MIDP_GetCurCameraIndex();
    int ret;
    CPropertyAction* pAct;
    if (!OpenCamera(hCameras_[currentCam_])) return DEVICE_ERR;
    char sName[Camera_Name_Len];
    GetMotiCamNAME(hCameras_[currentCam_], sName);
    //memcpy(sName, GetMotiCamNAME(hCameras_[currentCam_]), Camera_Name_Len);
    pAct = new CPropertyAction(this, &MUCamSource::OnDevice);
    ret = CreateProperty(g_Keyword_Cameras, sName, MM::String, true, pAct);
    ret = SetAllowedValues(g_Keyword_Cameras, DevicesVec_);
    assert(ret == DEVICE_OK);
    
    ret = InitDevice();
    if(ret == DEVICE_OK)
    {
        initialized_ = true;
    }

    return ret;
}
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());
   }

}