public void UpdateCameraInformation(CameraInfo cameraInfo) { m_model.Text = cameraInfo.modelName; m_vendor.Text = cameraInfo.vendorName; m_sensor.Text = cameraInfo.sensorInfo; m_resolution.Text = cameraInfo.sensorResolution; m_interface.Text = InterfaceTranslator.GetInterfaceString(cameraInfo.interfaceType); m_busSpeed.Text = BusSpeedTranslator.GetBusSpeedString(cameraInfo.maximumBusSpeed); m_pciEBusSpeed.Text = BusSpeedTranslator.GetPCIeBusSpeedString(cameraInfo.pcieBusSpeed); m_iidcVersion.Text = string.Format("{0:0.##}", (float)cameraInfo.iidcVersion / 100.0f); m_firmwareVersion.Text = cameraInfo.firmwareVersion; m_firmwareBuildTime.Text = cameraInfo.firmwareBuildTime; m_driver.Text = cameraInfo.driverName; if (m_camera == null || m_camera.IsConnected() == false) { Debug.WriteLine("Camera not found or disconnected"); ClearInformation(); return; } if (cameraInfo.interfaceType == InterfaceType.Usb3 && cameraInfo.pcieBusSpeed == PCIeBusSpeed.Speed_2_5) { // Insufficient speed, set the text to red m_pciEBusSpeed.ForeColor = Color.Red; toolTipPCIeBusSpeed.SetToolTip(m_pciEBusSpeed, "PCIe bus speed is too low - USB 3.0 performance may be degraded"); toolTipPCIeBusSpeed.Active = true; } else { m_pciEBusSpeed.ForeColor = m_pciEBusSpeedLabel.ForeColor; toolTipPCIeBusSpeed.Active = false; } if (IsLadybug2) { const uint Ladybug2HeadRegAddress = 0x1F80; uint uiHeadNumber = 0; try { uiHeadNumber = m_camera.ReadRegister(Ladybug2HeadRegAddress); } catch (FC2Exception ex) { BasePage.ShowErrorMessageDialog("Unable to read head number in the register. Initialize camera information page failed.", ex); ClearInformation(); return; } m_serialNumber.Text = string.Format("{0} (Head S/N.{1}", cameraInfo.serialNumber, uiHeadNumber); } else { m_serialNumber.Text = cameraInfo.serialNumber.ToString(); } }
private void UpdateNodeVoltageInformation(ManagedCameraBase cam) { try { const uint VoltageReg = 0x1A50; uint voltageRegVal = cam.ReadRegister(VoltageReg); if (voltageRegVal >> 31 == 0) { m_nodeVoltagesValue.Text = "N/A"; return; } int numAvailableVoltages = (int)((voltageRegVal & 0x00FFF000) >> 12); if (numAvailableVoltages == 0) { m_nodeVoltagesValue.Text = "N/A"; return; } const uint VoltageOffsetReg = 0x1A54; uint voltageOffsetRegVal = 0; voltageOffsetRegVal = cam.ReadRegister(VoltageOffsetReg); List <double> voltageList = new List <double>(); uint properVoltageOffset = (voltageOffsetRegVal * 4) & 0xFFFF; for (uint i = 0; i < numAvailableVoltages; i++) { uint currVoltageOffset = properVoltageOffset + (i * 4); uint currVoltageRegVal = cam.ReadRegister(currVoltageOffset); double voltage = MathUtilities.Convert32bitIEEEToFloat(currVoltageRegVal); voltageList.Add(voltage); } string voltageStr = string.Empty; foreach (double voltage in voltageList) { voltageStr += string.Format(" | {0:0.000}V", voltage); } m_nodeVoltagesValue.Text = voltageStr.Substring(3); } catch (FC2Exception ex) { m_nodeVoltagesValue.Text = "N/A"; ex.Dispose(); return; } }
protected bool IsCameraStreaming() { uint isoRegVal = 0; try { const uint isoReg = 0x614; isoRegVal = m_camera.ReadRegister(isoReg); } catch (FC2Exception ex) { Debug.WriteLine(string.Format("Error reading ISO_EN register. {0}", ex.Message)); return(false); } return((isoRegVal & 0x80000000) != 0); }
private void InitializeControl() { switch (m_propertyType) { case PropertyType.AutoExposure: m_controlTitleLabel.Text = "Auto Exposure"; break; case PropertyType.Shutter: m_controlTitleLabel.Text = "Shutter"; break; case PropertyType.Gain: m_controlTitleLabel.Text = "Gain"; break; default: m_controlTitleLabel.Text = "Unknown Property Type"; break; } for (int i = 0; i < NumberOfCameras; i++) { //Initialize Camera Name Labels Label cameraName = new Label(); cameraName.Text = string.Format("Camera {0}", i); cameraName.AutoSize = false; cameraName.Width = 55; cameraName.Height = 20; cameraName.TextAlign = ContentAlignment.MiddleCenter; m_propertyControlFlowTabel.Controls.Add(cameraName, 0, i); //Initialize property value slider m_properties[i].PropertyValueTrackBar.TickStyle = TickStyle.None; m_properties[i].PropertyValueTrackBar.Anchor = AnchorStyles.Left | AnchorStyles.Right; m_properties[i].PropertyValueTrackBar.Tag = i; //Camera index m_properties[i].PropertyValueTrackBar.Maximum = 1000; m_properties[i].PropertyValueTrackBar.Scroll += new EventHandler(OnTrackbarScroll); m_propertyControlFlowTabel.Controls.Add(m_properties[i].PropertyValueTrackBar, 1, i); //Initialize spin button m_properties[i].PropertyValueSpinButton.AutoSize = false; m_properties[i].PropertyValueSpinButton.Width = 55; m_properties[i].PropertyValueSpinButton.Tag = i; //Camera index m_properties[i].PropertyValueSpinButton.Maximum = 1000; m_properties[i].PropertyValueSpinButton.ValueChanged += new EventHandler(OnSpinButtonValueChanged); m_propertyControlFlowTabel.Controls.Add(m_properties[i].PropertyValueSpinButton, 2, i); //Initialize auto check box m_properties[i].AutoCheckBox.Tag = i; //Camera index m_properties[i].AutoCheckBox.CheckedChanged += new EventHandler(OnPropertyAutoCheckedChanged); m_propertyControlFlowTabel.Controls.Add(m_properties[i].AutoCheckBox, 3, i); //Initialize on/off check box m_properties[i].OnOffCheckBox.Tag = i; //Camera index m_properties[i].OnOffCheckBox.CheckedChanged += new EventHandler(OnPropertyOnOffCheckedChanged); m_propertyControlFlowTabel.Controls.Add(m_properties[i].OnOffCheckBox, 4, i); } if (NeedsCCDsCheckBoxes()) { //Initialize CCDs of Interest Labels for (int currProp = 0; currProp < m_properties.Count; currProp++) { Label ccdName = new Label(); ccdName.Text = string.Format("{0}", currProp); ccdName.AutoSize = false; ccdName.Dock = DockStyle.Fill; ccdName.TextAlign = ContentAlignment.BottomLeft; m_ccdsOfInterestTableLayout.Controls.Add(ccdName, currProp, 0); } // Initialize CCDs of Interest Check Boxes for (int currProp = 0; currProp < m_properties.Count; currProp++) { for (int currCcdIdx = 0; currCcdIdx < m_properties[currProp].CcdCheckBoxes.Count; currCcdIdx++) { m_properties[currProp].CcdCheckBoxes[currCcdIdx].AutoCheck = true; m_properties[currProp].CcdCheckBoxes[currCcdIdx].Tag = new Point(currCcdIdx, currProp); //Camera index: X = column, Y = row m_properties[currProp].CcdCheckBoxes[currCcdIdx].CheckedChanged += new EventHandler(OnCCDCheckedChanged); m_ccdsOfInterestTableLayout.Controls.Add( m_properties[currProp].CcdCheckBoxes[currCcdIdx], currCcdIdx, currProp + 1); } } } else { //Hide CCD of interest controls m_ccdsOfInterestTableLayout.Visible = false; m_ccdsOfInterestLabel.Visible = false; m_basicControlPanel.Width += 171; } if (m_camera == null) { Debug.WriteLine("Camera object is null!"); m_propertyControlFlowTabel.Enabled = false; return; } // Check if Independent Exposure is supported m_independentExposureSupported = false; if (m_ladybugType == LadybugType.Ladybug3 || m_ladybugType == LadybugType.Ladybug5) { uint uiRegVal = 0; try { // Independent Exposure Inquiry. Ladybug3 only. // The quadlet offset of the base address of the per sensor // independent exposure controls const uint IndependentExposureInq = 0x1e94; uiRegVal = m_camera.ReadRegister(IndependentExposureInq); // Get the offset m_independentExposureRegBase = (uiRegVal * 4) & 0xFFFF; } catch (FC2Exception ex) { m_independentExposureSupported = false; BasePage.ShowErrorMessageDialog("Error reading independent exposure inquiry register", ex); } // Supported if offset is not 0 m_independentExposureSupported = m_independentExposureRegBase != 0; } else if (m_ladybugType == LadybugType.Ladybug2) { m_independentExposureSupported = true; // Base address of Ladybug2 Independent exposure control registers const uint LD2IndependentExposureRegBase = 0x1800; m_independentExposureRegBase = LD2IndependentExposureRegBase; } else { m_independentExposureSupported = false; m_independentExposureRegBase = 0; } }
private void UpdateNodeCurrentInformation(ManagedCameraBase cam, CameraInfo camInfo) { if (camInfo.iidcVersion < iidcVersion) { m_nodeCurrentsValue.Text = "N/A"; return; } const uint CurrentReg = 0x1A58; uint currentRegVal = 0; try { currentRegVal = cam.ReadRegister(CurrentReg); } catch (FC2Exception ex) { m_nodeCurrentsValue.Text = "N/A"; ex.Dispose(); return; } if (currentRegVal >> 31 == 0) { m_nodeCurrentsValue.Text = "N/A"; return; } int numAvailableCurrents = (int)((currentRegVal & 0x00FFF000) >> 12); if (numAvailableCurrents == 0) { m_nodeCurrentsValue.Text = "N/A"; return; } const uint CurrentOffsetReg = 0x1A5C; uint currentOffsetRegVal = 0; try { currentOffsetRegVal = cam.ReadRegister(CurrentOffsetReg); } catch (FC2Exception ex) { m_nodeCurrentsValue.Text = "N/A"; ex.Dispose(); return; } List <double> currentsList = new List <double>(); uint properCurrentOffset = (currentOffsetRegVal * 4) & 0xFFFF; for (uint i = 0; i < numAvailableCurrents; i++) { uint currCurrentOffset = properCurrentOffset + (i * 4); uint currCurrentRegVal = 0; try { currCurrentRegVal = cam.ReadRegister(currCurrentOffset); } catch (FC2Exception ex) { m_nodeCurrentsValue.Text = "N/A"; ex.Dispose(); return; } double current = MathUtilities.Convert32bitIEEEToFloat(currCurrentRegVal); currentsList.Add(current); } string currentStr = string.Empty; foreach (double current in currentsList) { currentStr += string.Format(" | {0:0.000}A", current); } m_nodeCurrentsValue.Text = currentStr.Substring(3); }