Пример #1
0
 protected override PropertyValue<long> InitExposureDelay()
 {
     PropertyValue<long> res = new PropertyValue<long>() { Name = "Exposure delay mode", IsEnabled = true, Code = 0xD06A };
     res.AddValues("3 sec", 0);
     res.AddValues("2 sec", 1);
     res.AddValues("One sec", 1);
     res.AddValues("OFF", 1);
     res.ValueChanged += (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, new[] { (byte)val }, res.Code, -1);
     return res;
 }
Пример #2
0
 protected override PropertyValue<long> CaptureAreaCrop()
 {
     PropertyValue<long> res = new PropertyValue<long>()
     {
         Name = "Capture area crop",
         IsEnabled = true,
         Code = 0xD030,
         SubType = typeof(sbyte)
     };
     res.AddValues("DX", 0);
     res.AddValues("1.3x", 1);
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val), res.Code);
     return res;
 }
 public FakeCameraDevice()
 {
     HaveLiveView = false;
     IsBusy = false;
     DeviceName = "Fake camera";
     SerialNumber = "00000000";
     IsConnected = true;
     HaveLiveView = false;
     ExposureStatus = 1;
     ExposureCompensation = new PropertyValue<int>() {IsEnabled = false};
     Mode = new PropertyValue<uint> {IsEnabled = false};
     FNumber = new PropertyValue<int> {IsEnabled = false};
     ShutterSpeed = new PropertyValue<long> {IsEnabled = false};
     WhiteBalance = new PropertyValue<long> {IsEnabled = false};
     FocusMode = new PropertyValue<long> {IsEnabled = false};
     CompressionSetting = new PropertyValue<int> {IsEnabled = false};
     IsoNumber = new PropertyValue<int> {IsEnabled = false};
     ExposureMeteringMode = new PropertyValue<int> {IsEnabled = false};
     Battery = 100;
     Capabilities.Add(CapabilityEnum.CaptureNoAf);
     Capabilities.Add(CapabilityEnum.LiveView);
     LiveViewImageZoomRatio=new PropertyValue<int>();
     LiveViewImageZoomRatio.AddValues("All",0);
     LiveViewImageZoomRatio.Value = "All";
 }
Пример #4
0
        public bool Init(DeviceDescriptor deviceDescriptor,DeviceDescription description)
        {
            base.Init(deviceDescriptor);
            StillImageDevice imageDevice = StillImageDevice as StillImageDevice;
            if (imageDevice != null)
                imageDevice.DeviceEvent += StillImageDevice_DeviceEvent;
            foreach (var property in description.Properties)
            {
                if (!string.IsNullOrEmpty(property.Name))
                {
                    try
                    {
                        MTPDataResponse result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc, property.Code);

                        ErrorCodes.GetException(result.ErrorCode);
                        uint dataType = BitConverter.ToUInt16(result.Data, 2);
                        int dataLength = StaticHelper.GetDataLength(dataType);

                        var value = new PropertyValue<long> { Code = property.Code, Name = property.Name };
                        foreach (var propertyValue in property.Values)
                        {
                            value.AddValues(propertyValue.Name, propertyValue.Value);
                        }
                        value.ValueChanged += value_ValueChanged;
                        
                        AdvancedProperties.Add(value);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Error ger property ", ex);
                    }
                }
            }
            return true;
        }
Пример #5
0
        public FakeCameraDevice()
        {
            HaveLiveView = false;
            IsBusy = false;
            DeviceName = "Fake camera";
            SerialNumber = "00000000";
            IsConnected = true;
            HaveLiveView = false;
            ExposureStatus = 1;
            ExposureCompensation = new PropertyValue<int>() {IsEnabled = false};
            Mode = new PropertyValue<uint> {IsEnabled = false};
            FNumber = new PropertyValue<int> {IsEnabled = false};
            ShutterSpeed = new PropertyValue<long> {IsEnabled = false};
            WhiteBalance = new PropertyValue<long> {IsEnabled = false};
            FocusMode = new PropertyValue<long> {IsEnabled = false};
            CompressionSetting = new PropertyValue<int> {IsEnabled = false};
            IsoNumber = new PropertyValue<int> {IsEnabled = true};
            ExposureMeteringMode = new PropertyValue<int> {IsEnabled = false};
            Battery = 100;
            Capabilities.Add(CapabilityEnum.CaptureNoAf);
            Capabilities.Add(CapabilityEnum.LiveView);
            Capabilities.Add(CapabilityEnum.LiveViewStream);
            LiveViewImageZoomRatio = new PropertyValue<int>();
            LiveViewImageZoomRatio.AddValues("All", 0);
            LiveViewImageZoomRatio.Value = "All";

            IsoNumber.AddValues("100", 100);
            IsoNumber.AddValues("200", 200);
            IsoNumber.AddValues("300", 300);
            IsoNumber.Value = "100";
            IsoNumber.ReloadValues();

            var val = new PropertyValue<long>() {Name = "Test Test"};
            val.AddValues("Val 1", 1);
            val.AddValues("Val 2", 2);
            val.AddValues("Val 3", 3);
            val.Value = "Val 1";
            val.ReloadValues();
            AdvancedProperties.Add(val);
        }
Пример #6
0
        public override bool Init(DeviceDescriptor deviceDescriptor)
        {
            CurrentValues = new Dictionary<string, string>();
            Capabilities.Add(CapabilityEnum.LiveView);
            Capabilities.Add(CapabilityEnum.LiveViewStream);
            Protocol = deviceDescriptor.StillImageDevice as YiCameraProtocol;
            Protocol.DataReceiverd += Protocol_DataReceiverd;

            DeviceName = Protocol.Model;
            Manufacturer = Protocol.Manufacturer;
            IsConnected = true;
            CompressionSetting = new PropertyValue<int> { Tag = "photo_quality" };
            
            Mode = new PropertyValue<uint> { Tag = "capture_mode" };
            Mode.AddValues("Single", 0);
            Mode.AddValues("Burst", 1);
            Mode.AddValues("Delayed", 2);
            //Mode.AddValues("TimeLapse", 3);
            Mode.ReloadValues();

            ExposureMeteringMode = new PropertyValue<int>() { Tag = "meter_mode" };
            
            LiveViewImageZoomRatio = new PropertyValue<int>();
            LiveViewImageZoomRatio.AddValues("All", 0);
            LiveViewImageZoomRatio.Value = "All";
            SendCommand(3);
            Thread.Sleep(500);

            SerialNumber = GetValue("serial_number");
            SetProperty(Mode.Tag, GetValue(Mode.Tag));


            var thread = new Thread(LoadProperties) { Priority = ThreadPriority.Lowest };
            thread.Start();
            return true;
        }
Пример #7
0
        protected override void InitCompressionSetting()
        {
            try
              {
            byte datasize = 1;
            CompressionSetting = new PropertyValue<int>();
            CompressionSetting.ValueChanged += CompressionSetting_ValueChanged;
            byte[] result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc, CONST_PROP_CompressionSetting);
            byte defval = result[datasize + 5];
            for (int i = 0; i < result.Length - ((2 * datasize) + 6 + 2); i += datasize)
            {
              byte val = result[((2 * datasize) + 6 + 2) + i];
              CompressionSetting.AddValues(_csTable.ContainsKey(val) ? _csTable[val] : val.ToString(), val);
            }
            CompressionSetting.SetValue(defval);
              }
              catch (Exception)
              {

              }
        }
Пример #8
0
 protected override void InitCompressionSetting()
 {
     try
     {
         byte datasize = 1;
         CompressionSetting = new PropertyValue <int>();
         CompressionSetting.ValueChanged += CompressionSetting_ValueChanged;
         var result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc,
                                                       CONST_PROP_CompressionSetting);
         byte defval = result.Data[datasize + 5];
         for (int i = 0; i < result.Data.Length - ((2 * datasize) + 6 + 2); i += datasize)
         {
             byte val = result.Data[((2 * datasize) + 6 + 2) + i];
             CompressionSetting.AddValues(_csTable.ContainsKey(val) ? _csTable[val] : val.ToString(), val);
         }
         CompressionSetting.ReloadValues();
         CompressionSetting.SetValue(defval);
     }
     catch (Exception)
     {
     }
 }
Пример #9
0
 public bool Init(string endpoint)
 {
     Capabilities.Add(CapabilityEnum.LiveView);
     _timer.Elapsed  += _timer_Elapsed;
     _timer.AutoReset = true;
     IsBusy           = true;
     EndPoint         = endpoint;
     AvailableMethods = GetMethodTypes();
     ExecuteMethod("startRecMode");
     IsConnected                    = true;
     ExposureMeteringMode           = new PropertyValue <int>();
     ExposureMeteringMode.Available = false;
     LiveViewImageZoomRatio         = new PropertyValue <int>();
     for (int i = 0; i < 101; i++)
     {
         LiveViewImageZoomRatio.AddValues(i.ToString(), i);
     }
     LiveViewImageZoomRatio.ReloadValues();
     LiveViewImageZoomRatio.ValueChanged += LiveViewImageZoomRatio_ValueChanged;
     Task.Factory.StartNew(InitProps);
     return(true);
 }
Пример #10
0
 protected override PropertyValue<long> InitStillCaptureMode()
 {
     PropertyValue<long> res = new PropertyValue<long>()
                                   {
                                       Name = "Still Capture Mode",
                                       IsEnabled = true,
                                       Code = 0x5013,
                                       SubType = typeof (UInt16)
                                   };
     res.AddValues("Single shot (single-frame shooting)", 0x0001);
     res.AddValues("Continuous high-speed shooting (CH)", 0x0002);
     res.AddValues("Continuous low-speed shooting (CL)", 0x8010);
     res.AddValues("Self-timer", 0x8011);
     res.AddValues("Mirror-up", 0x8012);
     res.AddValues("Quiet shooting", 0x8016);
     res.AddValues("Remote control", 0x8017);
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val),
                                           res.Code, -1);
     return res;
 }
Пример #11
0
 protected override PropertyValue<long> InitStillCaptureMode()
 {
     PropertyValue<long> res = new PropertyValue<long>()
                                   {
                                       Name = "Still Capture Mode",
                                       IsEnabled = true,
                                       Code = 0x5013,
                                       SubType = typeof (UInt16)
                                   };
     res.AddValues("Single shot (single-frame shooting)", 0x0001);
     res.AddValues("Continuous high-speed shooting (CH)", 0x0002);
     res.AddValues("Continuous low-speed shooting (CL)", 0x8010);
     res.AddValues("Self-timer", 0x8011);
     res.AddValues("Mirror-up", 0x8012);
     res.AddValues("Quiet shooting", 0x8016);
     res.AddValues("Remote control", 0x8017);
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val),
                                           res.Code, -1);
     return res;
 }
Пример #12
0
 protected virtual PropertyValue<long> InitFocalLength()
 {
     PropertyValue<long> res = new PropertyValue<long>()
     {
         Name = "Focal Length",
         IsEnabled = true,
         Code = 0x5008,
         SubType = typeof(UInt32)
     };
     res.AddValues("3500", 0x0DAC);
     res.AddValues("4600", 0x11F8);
     res.AddValues("5300", 0x14B4);
     res.AddValues("6100", 0x17D4);
     res.AddValues("7300", 0x1C84);
     res.AddValues("8600", 0x2198);
     res.AddValues("10500", 0x2904);
     res.SetValue(StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropValue,
                                     res.Code), false);
     res.ReloadValues();
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val), res.Code);
     return res;
 }
Пример #13
0
        protected override PropertyValue <long> InitStillCaptureMode()
        {
            PropertyValue <long> res = new PropertyValue <long>()
            {
                Name      = "Still Capture Mode",
                IsEnabled = true,
                Code      = 0x5013,
                SubType   = typeof(UInt16)
            };

            res.AddValues("Single frame (S)", 0x0001);
            res.AddValues("Continuous low speed (CL)", 0x8010);
            res.AddValues("Continuous high speed (CH)", 0x0002);
            res.AddValues("Quiet shutter-release (Q)", 0x8016);
            res.AddValues("Quiet continuous shutter-release (QC)", 0x8018);
            res.AddValues("Self-timer", 0x8011);
            res.AddValues("Mirror up", 0x8012);
            res.ReloadValues();
            res.ValueChanged +=
                (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val),
                                                  res.Code);
            return(res);
        }
Пример #14
0
        protected virtual PropertyValue <long> InitFocalLength()
        {
            PropertyValue <long> res = new PropertyValue <long>()
            {
                Name      = "Focal Length",
                IsEnabled = true,
                Code      = 0x5008,
                SubType   = typeof(UInt32)
            };

            res.AddValues("3500", 0x0DAC);
            res.AddValues("4600", 0x11F8);
            res.AddValues("5300", 0x14B4);
            res.AddValues("6100", 0x17D4);
            res.AddValues("7300", 0x1C84);
            res.AddValues("8600", 0x2198);
            res.AddValues("10500", 0x2904);
            res.SetValue(StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropValue,
                                                          res.Code), false);
            res.ReloadValues();
            res.ValueChanged +=
                (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val), res.Code);
            return(res);
        }
Пример #15
0
 private PropertyValue<long> InitFlash()
 {
     PropertyValue<long> res = new PropertyValue<long>()
     {
         Name = "Flash",
         IsEnabled = true,
         Code = Edsdk.PropID_FlashOn,
         SubType = typeof(UInt32),
         DisableIfWrongValue = true
     };
     res.AddValues("No flash", 0);
     res.AddValues("Flash", 1);
     res.ValueChanged +=
         (sender, key, val) => Camera.SetProperty(res.Code, val);
     return res;
 }
Пример #16
0
 private PropertyValue<long> InitDriveMode()
 {
     PropertyValue<long> res = new PropertyValue<long>()
     {
         Name = "Drive Mode",
         IsEnabled = true,
         Code = Edsdk.PropID_DriveMode,
         SubType = typeof (UInt32),
         DisableIfWrongValue = true
     };
     res.AddValues("Single-Frame Shooting", 0);
     res.AddValues("Continuous Shooting", 1);
     res.AddValues("Video", 2);
     //res.AddValues("Not used", 3);
     res.AddValues("High-Speed Continuous Shooting", 4);
     res.AddValues("Low-Speed Continuous Shooting", 5);
     res.AddValues("Silent single shooting", 6);
     res.AddValues("10-Sec Self-Timer plus continuous shots", 7);
     res.AddValues("10-Sec Self-Timer", 10);
     res.AddValues("2-Sec Self-Timer", 11);
     res.ValueChanged +=
         (sender, key, val) => Camera.SetProperty(res.Code, val);
     return res;
 }
Пример #17
0
 private void InitCompression()
 {
     var data = GetSettingsList(Edsdk.PropID_ImageQuality);
     CompressionSetting = new PropertyValue<int>();
     CompressionSetting.AddValues("Large Fine JPEG", (int) new EosImageQuality(){PrimaryCompressLevel = EosCompressLevel.Fine,PrimaryImageFormat = EosImageFormat.Jpeg,PrimaryImageSize = EosImageSize.Large,SecondaryCompressLevel = EosCompressLevel.Unknown,SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown}.ToBitMask());
     CompressionSetting.AddValues("Large Normal JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Normal, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Large, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
     CompressionSetting.AddValues("Medium Fine JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Fine, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Middle, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
     CompressionSetting.AddValues("Medium Normal JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Normal, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Middle, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
     CompressionSetting.AddValues("Small Fine JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Fine, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Small2, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
     CompressionSetting.AddValues("Small Normal JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Normal, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Small2, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
     CompressionSetting.AddValues("Smaller JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Fine, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Small3, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
     CompressionSetting.AddValues("Tiny JPEG", (int)new EosImageQuality() { PrimaryCompressLevel = EosCompressLevel.Fine, PrimaryImageFormat = EosImageFormat.Jpeg, PrimaryImageSize = EosImageSize.Small4, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown }.ToBitMask());
     CompressionSetting.AddValues("RAW + Large Fine JPEG", (int)new EosImageQuality() {PrimaryImageFormat =EosImageFormat.Cr2,PrimaryCompressLevel = EosCompressLevel.Lossless, PrimaryImageSize = EosImageSize.Large, SecondaryImageSize =EosImageSize.Large,SecondaryCompressLevel = EosCompressLevel.Fine, SecondaryImageFormat = EosImageFormat.Jpeg }.ToBitMask());
     CompressionSetting.AddValues("RAW", (int)new EosImageQuality() { PrimaryImageFormat = EosImageFormat.Cr2, PrimaryCompressLevel = EosCompressLevel.Lossless, PrimaryImageSize = EosImageSize.Large, SecondaryCompressLevel = EosCompressLevel.Unknown, SecondaryImageFormat = EosImageFormat.Unknown, SecondaryImageSize = EosImageSize.Unknown}.ToBitMask());
     CompressionSetting.Filter(data);
     CompressionSetting.SetValue((int) Camera.ImageQuality.ToBitMask());
     CompressionSetting.ValueChanged += CompressionSetting_ValueChanged;
 }
Пример #18
0
        public FakeCameraDevice()
        {
            HaveLiveView         = false;
            IsBusy               = false;
            DeviceName           = "Fake camera";
            SerialNumber         = "00000000";
            IsConnected          = true;
            HaveLiveView         = false;
            ExposureStatus       = 1;
            ExposureCompensation = new PropertyValue <long>()
            {
                IsEnabled = false
            };
            Mode = new PropertyValue <long> {
                IsEnabled = false
            };
            FNumber = new PropertyValue <long> {
                IsEnabled = false
            };
            ShutterSpeed = new PropertyValue <long> {
                IsEnabled = false
            };
            WhiteBalance = new PropertyValue <long> {
                IsEnabled = false
            };
            FocusMode = new PropertyValue <long> {
                IsEnabled = false
            };

            CompressionSetting = new PropertyValue <long> {
                IsEnabled = true
            };
            CompressionSetting.AddValues("jpg", 0);
            CompressionSetting.AddValues("cr2", 1);
            CompressionSetting.AddValues("new", 2);
            CompressionSetting.Value = "jpg";
            CompressionSetting.ReloadValues();

            IsoNumber = new PropertyValue <long> {
                IsEnabled = true
            };
            ExposureMeteringMode = new PropertyValue <long> {
                IsEnabled = false
            };
            Battery = 100;
            Capabilities.Add(CapabilityEnum.CaptureNoAf);
            Capabilities.Add(CapabilityEnum.LiveView);
            Capabilities.Add(CapabilityEnum.LiveViewStream);
            LiveViewImageZoomRatio = new PropertyValue <long>();
            LiveViewImageZoomRatio.AddValues("All", 0);
            LiveViewImageZoomRatio.Value = "All";

            IsoNumber.AddValues("100", 100);
            IsoNumber.AddValues("200", 200);
            IsoNumber.AddValues("300", 300);
            IsoNumber.Value = "100";
            IsoNumber.ReloadValues();

            var val = new PropertyValue <long>()
            {
                Name = "Test Test"
            };

            val.AddValues("Val 1", 1);
            val.AddValues("Val 2", 2);
            val.AddValues("Val 3", 3);
            val.Value = "Val 1";
            val.ReloadValues();
            AdvancedProperties.Add(val);
        }
Пример #19
0
 public void InitExposureMeteringMode()
 {
     try
     {
         DeviceReady();
         byte datasize = 2;
         ExposureMeteringMode = new PropertyValue<int>();
         ExposureMeteringMode.Name = "ExposureMeteringMode";
         ExposureMeteringMode.ValueChanged += ExposureMeteringMode_ValueChanged;
         MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_ExposureMeteringMode);
         UInt16 defval = BitConverter.ToUInt16(result.Data, datasize + 5);
         for (int i = 0; i < result.Data.Length - ((2*datasize) + 6 + 2); i += datasize)
         {
             UInt16 val = BitConverter.ToUInt16(result.Data, ((2*datasize) + 6 + 2) + i);
             ExposureMeteringMode.AddValues(_emmTable.ContainsKey(val) ? _emmTable[val] : val.ToString(), val);
         }
         ExposureMeteringMode.ReloadValues();
         ExposureMeteringMode.SetValue(defval, false);
     }
     catch (Exception)
     {
     }
 }
Пример #20
0
 protected virtual PropertyValue<long> InitWbColorTemp()
 {
     PropertyValue<long> res = new PropertyValue<long>()
     {
         Name = "Temperature",
         IsEnabled = WhiteBalance.NumericValue == 32786,
         Code = CONST_PROP_WbColorTemp,
         SubType = typeof (byte),
         DisableIfWrongValue = false
     };
     res.AddValues("2500 K", 0);
     res.AddValues("2560 K", 1);
     res.AddValues("2630 K", 2);
     res.AddValues("2700 K", 3);
     res.AddValues("2780 K", 4);
     res.AddValues("2860 K", 5);
     res.AddValues("2940 K", 6);
     res.AddValues("3030 K", 7);
     res.AddValues("3130 K", 8);
     res.AddValues("3230 K", 9);
     res.AddValues("3330 K", 10);
     res.AddValues("3450 K", 11);
     res.AddValues("3570 K", 12);
     res.AddValues("3700 K", 13);
     res.AddValues("3850 K", 14);
     res.AddValues("4000 K", 15);
     res.AddValues("4170 K", 16);
     res.AddValues("4350 K", 17);
     res.AddValues("4550 K", 18);
     res.AddValues("4760 K", 19);
     res.AddValues("5000 K", 20);
     res.AddValues("5260 K", 21);
     res.AddValues("5560 K", 22);
     res.AddValues("5880 K", 23);
     res.AddValues("6250 K", 24);
     res.AddValues("6670 K", 25);
     res.AddValues("7140 K", 26);
     res.AddValues("7690 K", 27);
     res.AddValues("8330 K", 28);
     res.AddValues("9090 K", 29);
     res.AddValues("10000 K", 30);
     res.ReloadValues();
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val),
             res.Code);
     return res;
 }
Пример #21
0
 private void InitWb()
 {
     WhiteBalance = new PropertyValue<long>();
     WhiteBalance.ValueChanged += WhiteBalance_ValueChanged;
     try
     {
         foreach (KeyValuePair<uint, string> keyValuePair in _wbTable)
         {
             WhiteBalance.AddValues(keyValuePair.Value, (int) keyValuePair.Key);
         }
         WhiteBalance.IsEnabled = true;
         WhiteBalance.SetValue((long) Camera.GetProperty(Edsdk.PropID_WhiteBalance), false);
     }
     catch (Exception exception)
     {
         Log.Debug("Error get EC", exception);
     }
 }
Пример #22
0
        private void InitMode()
        {
            Mode = new PropertyValue<uint>();
            try
            {
                foreach (KeyValuePair<uint, string> keyValuePair in _exposureModeTable)
                {
                    Mode.AddValues(keyValuePair.Value, keyValuePair.Key);
                }

                Mode.SetValue((uint) Camera.GetProperty(Edsdk.PropID_AEMode), false);
                Mode.IsEnabled = false;
            }
            catch (Exception ex)
            {
                Log.Debug("Error set aperture ", ex);
            }
        }
Пример #23
0
 private void InitFocus()
 {
     FocusMode = new PropertyValue<long>();
     FocusMode.ValueChanged += FocusMode_ValueChanged;
     try
     {
         foreach (KeyValuePair<uint, string> keyValuePair in _focusModeTable)
         {
             FocusMode.AddValues(keyValuePair.Value, (int) keyValuePair.Key);
         }
         FocusMode.IsEnabled = true;
         FocusMode.SetValue((int) Camera.GetProperty(Edsdk.PropID_AFMode), false);
     }
     catch (Exception exception)
     {
         Log.Debug("Error get focus mode", exception);
     }
 }
Пример #24
0
 private void InitMode()
 {
     try
     {
         DeviceReady();
         byte datasize = 2;
         Mode = new PropertyValue<uint>();
         Mode.Name = "Mode";
         Mode.IsEnabled = false;
         Mode.ValueChanged += Mode_ValueChanged;
         var result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc,
                                                          CONST_PROP_ExposureProgramMode);
         int type = BitConverter.ToInt16(result.Data, 2);
         byte formFlag = result.Data[(2 * datasize) + 5];
         UInt16 defval = BitConverter.ToUInt16(result.Data, datasize + 5);
         for (int i = 0; i < result.Data.Length - ((2 * datasize) + 6 + 2); i += datasize)
         {
             UInt16 val = BitConverter.ToUInt16(result.Data, ((2 * datasize) + 6 + 2) + i);
             Mode.AddValues(_exposureModeTable.ContainsKey(val) ? _exposureModeTable[val] : val.ToString(), val);
         }
         Mode.ReloadValues();
         Mode.SetValue(defval);
     }
     catch (Exception)
     {
     }
 }
Пример #25
0
        private void InitIso()
        {
            lock (Locker)
            {
                NormalIsoNumber = new PropertyValue<int>();
                NormalIsoNumber.Name = "IsoNumber";
                NormalIsoNumber.ValueChanged += IsoNumber_ValueChanged;
                NormalIsoNumber.Clear();
                try
                {
                    DeviceReady();
                    MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_ExposureIndex);
                    //IsoNumber.IsEnabled = result.Data[4] == 1;
                    UInt16 defval = BitConverter.ToUInt16(result.Data, 7);
                    for (int i = 0; i < result.Data.Length - 12; i += 2)
                    {
                        UInt16 val = BitConverter.ToUInt16(result.Data, 12 + i);
                        NormalIsoNumber.AddValues(_isoTable.ContainsKey(val) ? _isoTable[val] : val.ToString(), val);
                    }
                    NormalIsoNumber.ReloadValues();
                    NormalIsoNumber.SetValue(defval, false);
                    IsoNumber = NormalIsoNumber;
                }
                catch (Exception)
                {
                    NormalIsoNumber.IsEnabled = false;
                }

                MovieIsoNumber = new PropertyValue<int>();
                MovieIsoNumber.Name = "IsoNumber";
                MovieIsoNumber.ValueChanged += MovieIsoNumber_ValueChanged;
                MovieIsoNumber.Clear();
                try
                {
                    MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_MovieExposureIndex);
                    //IsoNumber.IsEnabled = result.Data[4] == 1;
                    UInt16 defval = BitConverter.ToUInt16(result.Data, 7);
                    for (int i = 0; i < result.Data.Length - 12; i += 2)
                    {
                        UInt16 val = BitConverter.ToUInt16(result.Data, 12 + i);
                        MovieIsoNumber.AddValues(_isoTable.ContainsKey(val) ? _isoTable[val] : val.ToString(CultureInfo.InvariantCulture), val);
                    }
                    MovieIsoNumber.ReloadValues();
                    MovieIsoNumber.SetValue(defval, false);
                }
                catch (Exception)
                {
                    MovieIsoNumber.IsEnabled = false;
                }
            }
        }
Пример #26
0
 protected virtual PropertyValue<long> LensSort()
 {
     PropertyValue<long> res = new PropertyValue<long>()
     {
         Name = "Lens Sort",
         IsEnabled = false,
         Code = 0xD0E1,
         SubType = typeof(sbyte)
     };
     res.AddValues("Not mounted", 0);
     res.AddValues("CPU lens mounted", 1);
     res.ReloadValues();
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val), res.Code);
     return res;
 }
Пример #27
0
 protected virtual PropertyValue<long> InitWbTuneFluorescentType()
 {
     PropertyValue<long> res = new PropertyValue<long>()
                                   {
                                       Name = "Fluorescent light type",
                                       IsEnabled = WhiteBalance.NumericValue == 5,
                                       Code = CONST_PROP_WbTuneFluorescentType,
                                       SubType = typeof (byte),
                                       DisableIfWrongValue = false
                                   };
     res.AddValues("Sodium lamp mixed light", 0);
     res.AddValues("Cool white fluorescent lamp", 1);
     res.AddValues("Warm white fluorescent lamp", 2);
     res.AddValues("White fluorescent lamp", 3);
     res.AddValues("Day white fluorescent lamp", 4);
     res.AddValues("Daylight fluorescent lamp", 5);
     res.AddValues("High color-temperature mercury lamp", 6);
     res.ReloadValues();
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val),
                                           res.Code);
     return res;
 }
Пример #28
0
 private void InitCompression()
 {
     CompressionSetting = new PropertyValue<int>();
     CompressionSetting.AddValues("Jpeg", (int) EosImageFormat.Jpeg);
     CompressionSetting.AddValues("Crw", (int) EosImageFormat.Crw);
     CompressionSetting.AddValues("Cr2", (int) EosImageFormat.Cr2);
     CompressionSetting.SetValue((int) Camera.ImageQuality.PrimaryImageFormat);
     CompressionSetting.ValueChanged +=
         new PropertyValue<int>.ValueChangedEventHandler(CompressionSetting_ValueChanged);
 }
Пример #29
0
 private void InitEc()
 {
     ExposureCompensation = new PropertyValue<int>();
     ExposureCompensation.ValueChanged += ExposureCompensation_ValueChanged;
     try
     {
         foreach (KeyValuePair<uint, string> keyValuePair in _ec)
         {
             ExposureCompensation.AddValues(keyValuePair.Value, (int) keyValuePair.Key);
         }
         ExposureCompensation.IsEnabled = true;
         ExposureCompensation.SetValue((int) Camera.GetProperty(Edsdk.PropID_ExposureCompensation), false);
     }
     catch (Exception exception)
     {
         Log.Debug("Error get EC", exception);
     }
 }
Пример #30
0
 protected virtual PropertyValue<long> InitStillCaptureMode()
 {
     PropertyValue<long> res = new PropertyValue<long>()
                                   {
                                       Name = "Still Capture Mode",
                                       IsEnabled = true,
                                       Code = 0x5013,
                                       SubType = typeof (UInt16)
                                   };
     res.AddValues("Single shot (single-frame shooting)", 0x0001);
     res.AddValues("Continuous shot (continuous shooting)", 0x0002);
     res.AddValues("Self-timer", 0x8011);
     res.AddValues("Quick-response remote", 0x8014);
     res.AddValues("2s delayed remote", 0x8015);
     res.AddValues("Quiet shooting", 0x8016);
     res.ReloadValues();
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val),
                                           res.Code);
     return res;
 }
Пример #31
0
 private void InitMetering()
 {
     ExposureMeteringMode = new PropertyValue<int>();
     ExposureMeteringMode.ValueChanged += ExposureMeteringMode_ValueChanged;
     try
     {
         foreach (KeyValuePair<uint, string> keyValuePair in _meteringTable)
         {
             ExposureMeteringMode.AddValues(keyValuePair.Value, (int) keyValuePair.Key);
         }
         ExposureMeteringMode.IsEnabled = true;
         ExposureMeteringMode.SetValue((int) Camera.GetProperty(Edsdk.PropID_MeteringMode), false);
     }
     catch (Exception exception)
     {
         Log.Debug("Error get metering", exception);
     }
 }
Пример #32
0
 private void InitWhiteBalance()
 {
     try
     {
         DeviceReady();
         byte datasize = 2;
         WhiteBalance = new PropertyValue<long>();
         WhiteBalance.Name = "WhiteBalance";
         WhiteBalance.ValueChanged += WhiteBalance_ValueChanged;
         var result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc, CONST_PROP_WhiteBalance);
         if (result.Data != null && result.Data.Length > 0)
         {
             int type = BitConverter.ToInt16(result.Data, 2);
             byte formFlag = result.Data[(2*datasize) + 5];
             UInt16 defval = BitConverter.ToUInt16(result.Data, datasize + 5);
             for (int i = 0; i < result.Data.Length - ((2*datasize) + 6 + 2); i += datasize)
             {
                 UInt16 val = BitConverter.ToUInt16(result.Data, ((2*datasize) + 6 + 2) + i);
                 WhiteBalance.AddValues(_wbTable.ContainsKey(val) ? _wbTable[val] : val.ToString(), val);
             }
             WhiteBalance.ReloadValues();
             WhiteBalance.SetValue(defval, false);
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
         Log.Error("Error init white balance", ex);
     }
 }
Пример #33
0
 private void InitOther()
 {
     LiveViewImageZoomRatio = new PropertyValue<int> {Name = "LiveViewImageZoomRatio"};
     LiveViewImageZoomRatio.AddValues("All", 1);
     LiveViewImageZoomRatio.AddValues("5x", 5);
     LiveViewImageZoomRatio.AddValues("10x", 10);
     LiveViewImageZoomRatio.SetValue("All");
     LiveViewImageZoomRatio.ValueChanged += LiveViewImageZoomRatio_ValueChanged;
 }
Пример #34
0
        public virtual PropertyValue<long> InitAutoIsoHight()
        {
            var res = new PropertyValue<long>();
            try
            {
                DeviceReady();
                byte datasize = 1;
                res.Name = "ISO Auto High Limit";
                res.SubType = typeof (byte);
                res.Code = CONST_PROP_ISOAutoHighLimit;
                res.ValueChanged +=
                    (sender, key, val) =>
                        SetProperty(CONST_CMD_SetDevicePropValue, new[] { (byte)val }, res.Code);

                var result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc,
                    CONST_PROP_ISOAutoHighLimit);
                int type = BitConverter.ToInt16(result.Data, 2);
                byte formFlag = result.Data[(2*datasize) + 5];
                byte defval = result.Data[datasize + 5];

                foreach (KeyValuePair<byte, string> pair in _autoIsoTable)
                {
                    res.AddValues(pair.Value, pair.Key);
                }
                res.ReloadValues();
                res.SetValue(defval, false);
            }
            catch (Exception)
            {
            }
            return res;
        }
Пример #35
0
 private void InitOther()
 {
     LiveViewImageZoomRatio = new PropertyValue<int> {Name = "LiveViewImageZoomRatio"};
     LiveViewImageZoomRatio.AddValues("All", 0);
     LiveViewImageZoomRatio.AddValues("25%", 1);
     LiveViewImageZoomRatio.AddValues("33%", 2);
     LiveViewImageZoomRatio.AddValues("50%", 3);
     LiveViewImageZoomRatio.AddValues("66%", 4);
     LiveViewImageZoomRatio.AddValues("100%", 5);
     LiveViewImageZoomRatio.AddValues("200%", 6);
     LiveViewImageZoomRatio.SetValue("All");
     LiveViewImageZoomRatio.ReloadValues();
     LiveViewImageZoomRatio.ValueChanged += LiveViewImageZoomRatio_ValueChanged;
 }
Пример #36
0
 public void InitExposureCompensation()
 {
     try
     {
         DeviceReady();
         byte datasize = 2;
         NormalExposureCompensation = new PropertyValue<int>();
         NormalExposureCompensation.Name = "ExposureCompensation";
         NormalExposureCompensation.ValueChanged += ExposureCompensation_ValueChanged;
         MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc,
                                                    CONST_PROP_ExposureBiasCompensation);
         Int16 defval = BitConverter.ToInt16(result.Data, datasize + 5);
         for (int i = 0; i < result.Data.Length - ((2*datasize) + 6 + 2); i += datasize)
         {
             Int16 val = BitConverter.ToInt16(result.Data, ((2*datasize) + 6 + 2) + i);
             decimal d = val;
             string s = Decimal.Round(d/1000, 1).ToString("0.0", CultureInfo.CreateSpecificCulture("en-US"));
             if (d > 0)
                 s = "+" + s;
             NormalExposureCompensation.AddValues(s, val);
         }
         NormalExposureCompensation.ReloadValues();
         NormalExposureCompensation.SetValue(defval, false);
         ExposureCompensation = NormalExposureCompensation;
     }
     catch (Exception)
     {
     }
     try
     {
         DeviceReady();
         byte datasize = 2;
         MovieExposureCompensation = new PropertyValue<int>();
         MovieExposureCompensation.Name = "ExposureCompensation";
         MovieExposureCompensation.ValueChanged += MovieExposureCompensation_ValueChanged;
         MTPDataResponse result = ExecuteReadDataEx(CONST_CMD_GetDevicePropDesc,
                                                    CONST_PROP_MovieExposureBiasCompensation);
         Int16 defval = BitConverter.ToInt16(result.Data, datasize + 5);
         for (int i = 0; i < result.Data.Length - ((2 * datasize) + 6 + 2); i += datasize)
         {
             Int16 val = BitConverter.ToInt16(result.Data, ((2 * datasize) + 6 + 2) + i);
             decimal d = val;
             string s = Decimal.Round(d / 1000, 1).ToString("0.0", CultureInfo.CreateSpecificCulture("en-US"));
             if (d > 0)
                 s = "+" + s;
             MovieExposureCompensation.AddValues(s, val);
         }
         MovieExposureCompensation.ReloadValues();
         MovieExposureCompensation.SetValue(defval, false);
     }
     catch (Exception)
     {
     }
 }