本文整理汇总了C++中CreateProperty函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateProperty函数的具体用法?C++ CreateProperty怎么用?C++ CreateProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateProperty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDevice
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;
}
示例2: CreateProperty
/////////////////////////////////////////////////////////
// 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;
}
示例3: initialized_
///////////////////////////////////////////////////////////////////////////////
// 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());
}
}
示例4: CheckForDevice
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;
}
示例5: ExecuteCommand
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;
}
示例6: initialized_
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();
}
示例7: CPropertyAction
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);
}
示例8: CPropertyAction
//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;
}
示例9: port_
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);
}
示例10: CPropertyAction
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);
}
示例11: ExecuteCommand
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;
}
示例12: CreateProperty
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;
}
示例13: XYStage
///////////////////////////////////////////////////////////////////////////////
// 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
}
示例14: initialized_
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);
}
示例15: dev_num
/*---------------------------------------------------------------------------
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);
}
}