void Engine::get_all_settings() { aggregate_status_ = DeviceStatus(0); for (auto &q : devices_) { q.second->get_all_settings(); aggregate_status_ = aggregate_status_ | q.second->status(); } read_settings_bulk(); }
Engine::Engine() { aggregate_status_ = DeviceStatus(0); intrinsic_status_ = DeviceStatus(0); total_det_num_.id_ = "Total detectors"; total_det_num_.name = "Total detectors"; total_det_num_.writable = true; total_det_num_.visible = true; total_det_num_.setting_type = Qpx::SettingType::integer; total_det_num_.minimum = 1; total_det_num_.maximum = 42; total_det_num_.step = 1; single_det_.id_ = "Detector"; single_det_.name = "Detector"; single_det_.writable = true; single_det_.saveworthy = true; single_det_.visible = true; single_det_.setting_type = Qpx::SettingType::detector; }
void mtsMicroScribeDigitizer::Configure(const std::string & filename) { // Setup error handlers #define SETUP_ERROR_HANDLER(_errorCode, _handlerName)\ if (ARM_SUCCESS != ArmSetErrorHandlerFunction(_errorCode, ErrorHandler_##_handlerName)) {\ CMN_LOG_CLASS_INIT_ERROR << "Startup: Failed to set error handler: "#_errorCode << std::endl;\ cmnThrow("Startup: Failed to set error handler: "#_errorCode);\ } SETUP_ERROR_HANDLER(NO_HCI_HANDLER, NoHCI); SETUP_ERROR_HANDLER(BAD_PORT_HANDLER, BadPort); SETUP_ERROR_HANDLER(CANT_OPEN_HANDLER, CantOpen); SETUP_ERROR_HANDLER(CANT_BEGIN_HANDLER, CantBegin); // MJ: TIMED_OUT_HANDLER and BAD_PACKET_HANDLER are not overridden because the SDK explicitly // recommends not to do that as follows (see BAD_PACKET_handler and TIMED_OUT_handler): // // "Although this function is still exported for backward compatibility issue, user // shouldn't have any reason to provide any custom TIMED_OUT_handler because the default // ArmDll32's TIMED_OUT_handler should be enough. Any incorrect behavior in such custom // error handler function could affect ArmDll32's performance." #undef SETUP_ERROR_HANDLER // Connect to hardware if (ARM_SUCCESS != ArmConnect(0, 0)) { CMN_LOG_CLASS_INIT_ERROR << "Startup: Unable to connect to ArmDll32" << std::endl; ArmEnd(); cmnThrow("Startup: Unable to connect to ArmDll32"); } else { OnDeviceConnection(); } // Get device product information const size_t len = 256; char buf[len]; // Product name if (ARM_SUCCESS == ArmGetProductName(buf, len)) { DigitizerInfo.ProductName = buf; } else { DigitizerInfo.ProductName = "Failed to fetch"; } // Model name if (ARM_SUCCESS == ArmGetModelName(buf, len)) { DigitizerInfo.ModelName = buf; } else { DigitizerInfo.ModelName = "Failed to fetch"; } // Serial number if (ARM_SUCCESS == ArmGetSerialNumber(buf, len)) { DigitizerInfo.SerialNumber = buf; } else { DigitizerInfo.SerialNumber = "Failed to fetch"; } // Driver and firmware version char buf2[len]; if (ARM_SUCCESS == ArmGetVersion(buf, buf2, len)) { DigitizerInfo.DriverVersion = buf; DigitizerInfo.FirmwareVersion = buf2; } else { DigitizerInfo.DriverVersion = "Failed to fetch"; DigitizerInfo.FirmwareVersion = "Failed to fetch"; } // Num of DoF int dof; if (ARM_SUCCESS == ArmGetNumDOF(&dof)) { // -1 if DoF cannot be determined (e.g., pre-G2 versions of the MicroScribe) DigitizerInfo.NumDoF = dof; } else { DigitizerInfo.NumDoF = -1; } CMN_LOG_CLASS_INIT_VERBOSE << "Startup: " << DigitizerInfo << std::endl; // Set refresh rate if (ARM_SUCCESS != ArmSetUpdateEx(ARM_FULL, (UINT) (this->Period * 1000))) { // second argument in msec CMN_LOG_CLASS_INIT_ERROR << "Startup: Unable to set update for ArmDll32" << std::endl; ArmDisconnect(); ArmEnd(); cmnThrow("Startup: Unable to set update for ArmDll32"); } // Check device status (device can be disonncected after all getters succeeded) if (ARM_SUCCESS == ArmGetDeviceStatus(&DeviceStatusVendor)) { DeviceStatus(STATUS) = DeviceStatusVendor.status; DeviceStatus(BAUD) = DeviceStatusVendor.Baud; DeviceStatus(PORT_NUMBER) = DeviceStatusVendor.PortNumber; if (!(DeviceStatus(STATUS) & ARM_CONNECTED)) { OnDeviceDisconnection(); return; } } }