Exemplo n.º 1
0
 /// <summary>
 /// 设置相机属性
 /// </summary>
 void SetProperty(CameraProperty cameraP)
 {
     try
     {
         g_ManagedCameraBase.SetProperty(cameraP);
     }
     catch (Exception ex)
     {
         Log.L_I.WriteError(NameClass, ex);
     }
 }
Exemplo n.º 2
0
 private void ConfigPropertyValue(PropertyType type, float value)
 {
     if (m_camera.IsConnected())
     {
         CameraProperty property = new CameraProperty(type);
         property.absControl     = false;
         property.onOff          = true;
         property.autoManualMode = false;
         property.valueA         = (uint)value;
         m_camera.SetProperty(property);
     }
 }
Exemplo n.º 3
0
        /** This is called from the click handlers. */
        private void SetPropertyValue()
        {
            CameraProperty camProp;

            try
            {
                camProp = m_camera.GetProperty(m_propType);
            }
            catch (FC2Exception ex)
            {
                Debug.WriteLine("Failed to read " + m_propType + " from camera. Error: " + ex.Message);
                ex.Dispose();
                return;
            }

            //check to see if this property is Manual Mode or not
            //if it is auto mode, then skip this
            if (!camProp.autoManualMode && m_propInfo.manualSupported)
            {
                if (m_isAbsMode)
                {
                    float value = (float)m_propertySpinButton.Value;
                    camProp.absControl = true;
                    float difference = camProp.absValue - value;
                    if (difference != 0)
                    {
                        // The brightness abs register sometimes starts drifting
                        // due to a rounding error between the camera and the
                        // actual value being held by the adjustment. To prevent
                        // this, only apply the change to the camera if the
                        // difference is greater than a specified amount.

                        // Check if the difference is greater than 0.005f.
                        if (m_propType == PropertyType.Brightness &&
                            Math.Abs(difference) <= 0.005f)
                        {
                            return;
                        }

                        camProp.absValue = value;
                    }
                }
                else
                {
                    uint value;
                    value = Convert.ToUInt32(m_propertySpinButton.Value);

                    camProp.absControl = false;
                    if (m_useValueB)
                    {
                        if (value != camProp.valueB)
                        {
                            camProp.valueB = value;
                        }
                    }
                    else
                    {
                        if (value != camProp.valueA)
                        {
                            // Bug 19306
                            if (camProp.type == PropertyType.Shutter)
                            {
                                camProp.valueB = value >> 12;
                            }
                            camProp.valueA = value;
                        }
                    }
                }

                try
                {
                    m_camera.SetProperty(camProp);
                }
                catch (FC2Exception ex)
                {
                    Debug.WriteLine("Failed to write " + m_propType + " to camera. Error:" + ex.Message);
                    ex.Dispose();
                }
            }
        }