void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { // usage if (nrhs != 1) { mexPrintf("\nUsage: nmssPSDisconnect(<controller_handle>), where <controller_handle> is the integer number returned by nmssPSConnect."); return; } int iControllerHandle = mxGetScalar(prhs[0]); if (E7XX_IsConnected (iControllerHandle)) { // close connection E7XX_CloseConnection(iControllerHandle); double* pdRet; plhs[0] = mxCreateString(sOK); plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL); pdRet = mxGetPr(plhs[1]); *pdRet = (double) iControllerHandle; } else { // no controller connected with this handle plhs[0] = mxCreateString(sERROR); int iErrorID = E7XX_GetError(iControllerHandle); char sError[1024]; E7XX_TranslateError (iErrorID, sError, 1024); plhs[1] = mxCreateString(sError); } return; }
int CPI_E761_ZStage::Initialize() { LogMessage("Is initialized? (Zephyre)"); if (initialized_) return DEVICE_OK; LogMessage("Start init (Zephyre)"); g_pZStage = this; MMThreadGuard guard(g_PI_ThreadLock); if (g_DeviceId < 0 || !E7XX_IsConnected(g_DeviceId)) { // 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(); axisName_[0] = g_AxisNames[currentAxis_ - 1]; // Switch to servo mode BOOL svoVal = true; ret = E7XX_SVO(g_DeviceId, axisName_, &svoVal); if (!ret) return processErr(); // StepSize CPropertyAction* pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnStepSizeUm); CreateProperty("StepSizeUm", "0.001", MM::Float, false, pAct); // Axis name pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnAxisName); CreateProperty("Axis name", "3", MM::String, false, pAct); // Positions pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnPosition); CreateProperty(MM::g_Keyword_Position, "0.0", MM::Float, false, pAct); //SetPropertyLimits(MM::g_Keyword_Position, 0, axisLimitUm_); // Axis index pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnCurrentAxis); CreateProperty("Axis index", "3", MM::Integer, false, pAct); SetPropertyLimits("Axis index", 1, 3); // Axis Information pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnAxisInfo); CreateProperty("Axis info", "", MM::String, true, pAct); // Lower limits pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnSoftLowerLimit); CreateProperty("Soft lower limit", "0", MM::Float, false, pAct); // Higher limits pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnSoftHigherLimit); CreateProperty("Soft higher limit", "0", MM::Float, false, pAct); // Travel range pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnTravelHighEnd); CreateProperty("Travel range (high end)", "100", MM::Float, true, pAct); pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnTravelLowEnd); CreateProperty("Travel range (low end)", "0", MM::Float, true, pAct); // Velocity control pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnVelControl); CreateProperty("Velocity control", "", MM::Float, false, pAct); // Firmware version pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnVersion); CreateProperty("Firmware version", "", MM::String, true, pAct); ret = UpdateStatus(); if (ret != DEVICE_OK) return ret; initialized_ = true; return DEVICE_OK; }