int VTiSIMHub::Initialize() { if (!hAotfControl_) { DWORD err = vti_Initialise(VTI_HARDWARE_AOTF_USB, &hAotfControl_); if (err != VTI_SUCCESS) return err; } if (!hScanAndMotorControl_) { DWORD err = vti_Initialise(VTI_HARDWARE_VTINFINITY_4, &hScanAndMotorControl_); if (err != VTI_SUCCESS) return err; } LONG major, minor, rev, build; DWORD err = vti_GetDllVersionInfo(&major, &minor, &rev, &build); if (err == VTI_SUCCESS) { char s[MM::MaxStrLength + 1]; snprintf(s, MM::MaxStrLength, "%d.%d.%d.%d", (int)major, (int)minor, (int)rev, (int)build); int err = CreateStringProperty("DLLVersion", s, true); if (err != DEVICE_OK) return err; } return DEVICE_OK; }
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); }
int RAMPSXYStage::Initialize() { LogMessage("XYStage: initialize"); RAMPSHub* pHub = static_cast<RAMPSHub*>(GetParentHub()); if (pHub) { char hubLabel[MM::MaxStrLength]; pHub->GetLabel(hubLabel); SetParentID(hubLabel); // for backward comp. } else LogMessage(NoHubError); if (initialized_) return DEVICE_OK; // set property list // ----------------- // Name int ret = CreateStringProperty(MM::g_Keyword_Name, g_XYStageDeviceName, true); if (DEVICE_OK != ret) return ret; // Description ret = CreateStringProperty(MM::g_Keyword_Description, "RAMPS XY stage driver", true); if (DEVICE_OK != ret) return ret; CPropertyAction* pAct = new CPropertyAction (this, &RAMPSXYStage::OnStepSize); CreateProperty(g_StepSizeProp, CDeviceUtils::ConvertToString(stepSize_um_), MM::Float, false, pAct); // Update lower and upper limits. These values are cached, so if they change during a session, the adapter will need to be re-initialized ret = UpdateStatus(); if (ret != DEVICE_OK) return ret; initialized_ = true; return DEVICE_OK; }
int qt_f_Select1Handler(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func) { static int ddctr = 0; head->meta_info = strdup("1"); xmlNode *lblitem = CreateItemNode(node,0,itoa(row),int2str[0]); Create1WidgetNodeWithStringProp(lblitem,sAppendString("Label_",sAppendString("DDlbl_",itoa(ddctr))), "QLabel","text", head->name); xmlNode *dditem = CreateItemNode(node,0,itoa(row),int2str[2]); xmlNode *dd = Create1WidgetNode(dditem,sAppendString("DD_",itoa(ddctr)),"QComboBox",0,0,0,0); //AppendNode(CallBackData,"NULL-REFERENCE", "NULL-INITVAL","NULL-VAL",sAppendString("DD_",int2str[ddctr]),"QComboBox"); xmlNode *dd_prop = CreateNumberProperty(dd,"currentIndex",head->value); sXformsNodeAttr *attr = getAttrFromList(head,"ref"); sCbData * d = NULL; if(attr) { d = AppendNode(CallBackData,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),s_dupstr(head->value),sAppendString("DD_",itoa(ddctr)),"QComboBox",modelDocPtr,func); } else { AppendNode(CallBackData,int2str[0],int2str[0],int2str[0],sAppendString("DD_",itoa(ddctr)),"QComboBox",modelDocPtr,func); } sXformsNode *temp; sXformsNode *xfchoices = SearchSubTreeForNodes(head,(char *)"xf:choices",(sXformsNodeAttr *)0,0,0); if( xfchoices ){ xfchoices->meta_info = strdup("1"); struct sCbValue * v = NULL; for( temp=xfchoices->child; temp != 0; temp=temp->next){ temp->meta_info = strdup(int2str[1]); xmlNode *choice = CreateItemNode(dd,0,0,0); CreateStringProperty(choice,"text", temp->name); if(temp == xfchoices->child) v = d->values = (sCbValue*) calloc(sizeof(sCbValue),1); else { v->next = (sCbValue*) calloc(sizeof(sCbValue),1); v = v->next; } v->ui_string = temp->name; v->value = temp->value; } } ddctr++; row++; }
int VTiSIMLasers::Initialize() { char s[MM::MaxStrLength + 1]; for (long i = 0; i < nChannels; ++i) { snprintf(s, MM::MaxStrLength, "Laser-%ld", i); SetPositionLabel(i, s); } int err = CreateIntegerProperty(MM::g_Keyword_State, 0, false, new CPropertyAction(this, &VTiSIMLasers::OnState)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(MM::g_Keyword_State, 0, nChannels - 1); if (err != DEVICE_OK) return err; err = CreateStringProperty(MM::g_Keyword_Label, "", false, new CPropertyAction(this, &CStateBase::OnLabel)); if (err != DEVICE_OK) return err; for (long i = 0; i < nChannels; ++i) { snprintf(s, MM::MaxStrLength, "Intensity-%ld", i); err = CreateIntegerProperty(s, intensities_[i], false, new CPropertyActionEx(this, &VTiSIMLasers::OnIntensity, i)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(s, 0, 100); if (err != DEVICE_OK) return err; err = DoSetIntensity(i, intensities_[i]); if (err != DEVICE_OK) return err; } // Sync with our memory of state return DoSetChannel(curChan_); }
int qt_f_RadioButtonList(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func) { static int radioctr = 0; head->meta_info = strdup("1"); xmlNode *lblitem = CreateItemNode(node,0,itoa(row),int2str[0]); Create1WidgetNodeWithStringProp(lblitem,sAppendString("DDlbl_",itoa(radioctr)), "QLabel","text", head->name); xmlNode *radioitem = CreateItemNode(node,0,itoa(row),int2str[2]); char *proptype[] = {"string","bool","bool"}; char *propname[] = {"title","checkable","checked"}; char *propval[] = {(char *)0,"false","false"}; xmlNode *QGroupBox = Create1WidgetNode(radioitem,sAppendString("QGroupBox_",itoa(radioctr)), "QGroupBox",propname,proptype,propval,3); sXformsNode *temp; sXformsNode *xfchoices = SearchSubTreeForNodes(head,(char *)"xf:choices",(sXformsNodeAttr *)0,0,0); if( xfchoices ){ xfchoices->meta_info = (char *)"1"; int ctr = 0; for( temp=xfchoices->child; temp != 0; ctr++, temp=temp->next){ char buffer[5]; sprintf(buffer,"%d",5 + 80*ctr); temp->meta_info = strdup(int2str[1]); char *radioname = sAppendString("radio_",itoa(ctr)); xmlNode *radio = Create1WidgetNode(QGroupBox,radioname,"QRadioButton",0,0,0,0); //AppendNode(CallBackData,"NULL-REFERENCE", "NULL-INITVAL","NULL-VAL",sAppendString("radio_",int2str[ctr]),"QRadioButton"); sXformsNodeAttr *attr = getAttrFromList(temp,"ref"); if(attr) { AppendNode(CallBackData,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),(char *)0,radioname,"QRadioButton",modelDocPtr,func); } else { AppendNode(CallBackData,int2str[0],int2str[0],int2str[0],radioname,"QRadioButton",modelDocPtr,func); } Create1GeometryProp(radio,buffer,"0","108", "26"); CreateStringProperty(radio,"text",temp->name); } } radioctr++; row++; }
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; }