//Acquisition of value list that can set taking a picture parameter public EDSDKLib.EDSDK.EdsPropertyDesc GetPropertyDesc(uint propertyID) { EDSDKLib.EDSDK.EdsPropertyDesc desc = new EDSDKLib.EDSDK.EdsPropertyDesc { }; switch (propertyID) { case EDSDKLib.EDSDK.PropID_DriveMode: desc = this.DriveModeDesc; break; case EDSDKLib.EDSDK.PropID_WhiteBalance: desc = this.WhiteBalanceDesc; break; case EDSDKLib.EDSDK.PropID_Tv: desc = this.TvDesc; break; case EDSDKLib.EDSDK.PropID_Av: desc = this.AvDesc; break; case EDSDKLib.EDSDK.PropID_ISOSpeed: desc = this.IsoDesc; break; case EDSDKLib.EDSDK.PropID_MeteringMode: desc = this.MeteringModeDesc; break; case EDSDKLib.EDSDK.PropID_ExposureCompensation: desc = this.ExposureCompensationDesc; break; case EDSDKLib.EDSDK.PropID_ImageQuality: desc = this.ImageQualityDesc; break; case EDSDKLib.EDSDK.PropID_Evf_AFMode: desc = this.EvfAFModeDesc; break; case EDSDKLib.EDSDK.PropID_DC_Zoom: desc = this.ZoomDesc; break; case EDSDKLib.EDSDK.PropID_DC_Strobe: desc = this.FlashModeDesc; break; } return(desc); }
protected void UpdatePropertyDesc(ref EDSDKLib.EDSDK.EdsPropertyDesc desc) { if (this.InvokeRequired) { //The update processing can be executed from another thread. this.Invoke(new _UpdatePropertyDesc(UpdatePropertyDesc), new object[] { desc }); return; } this.Enabled = (desc.NumElements != 0); this.Items.Clear(); { for (int i = 0; i < desc.NumElements; i++) { string outString; // The character string corresponding to data is acquired. bool isGet = map.TryGetValue((uint)desc.PropDesc[i], out outString); if (isGet && !outString.Equals("unknown")) { // Create list of combo box this.Items.Add(outString); } } } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_MeteringMode) { uint property = model.MeteringMode; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: this.UpdateProperty(property); break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: _desc = model.MeteringModeDesc; this.UpdatePropertyDesc(ref _desc); this.UpdateProperty(property); break; } } } }
//Setting of value list that can set taking a picture parameter public void SetPropertyDesc(uint propertyID, ref EDSDKLib.EDSDK.EdsPropertyDesc desc) { switch (propertyID) { case EDSDKLib.EDSDK.PropID_DriveMode: this.DriveModeDesc = desc; break; case EDSDKLib.EDSDK.PropID_WhiteBalance: this.WhiteBalanceDesc = desc; break; case EDSDKLib.EDSDK.PropID_Tv: this.TvDesc = desc; break; case EDSDKLib.EDSDK.PropID_Av: this.AvDesc = desc; break; case EDSDKLib.EDSDK.PropID_ISOSpeed: this.IsoDesc = desc; break; case EDSDKLib.EDSDK.PropID_MeteringMode: this.MeteringModeDesc = desc; break; case EDSDKLib.EDSDK.PropID_ExposureCompensation: this.ExposureCompensationDesc = desc; break; case EDSDKLib.EDSDK.PropID_ImageQuality: this.ImageQualityDesc = desc; break; case EDSDKLib.EDSDK.PropID_Evf_AFMode: this.EvfAFModeDesc = desc; break; case EDSDKLib.EDSDK.PropID_DC_Zoom: this.ZoomDesc = desc; break; case EDSDKLib.EDSDK.PropID_DC_Strobe: this.FlashModeDesc = desc; break; } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); // DS does not need zoom step value if (propertyID == EDSDKLib.EDSDK.PropID_DC_Zoom && !model.isTypeDS) { uint property = model.Zoom; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: this.UpdateProperty(property); break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: _desc = model.ZoomDesc; this.UpdatePropertyDesc(ref _desc); this.UpdateProperty(property); break; } } } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_MovieParam) { uint property = model.MovieQuality; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: this.UpdateProperty(property); break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: _desc = model.MovieQualityDesc; // Ignore PropertyDesc when shooting still images. if (model.FixedMovie == 0) { _desc.NumElements = 0; } this.UpdatePropertyDesc(ref _desc); this.UpdateProperty(property); break; } } } }
protected void UpdatePropertyDesc(ref EDSDKLib.EDSDK.EdsPropertyDesc desc) { if (this.InvokeRequired) { //The update processing can be executed from another thread. this.Invoke(new _UpdatePropertyDesc(UpdatePropertyDesc), new object[] { desc }); return; } this.Enabled = (desc.NumElements != 0); if (desc.NumElements != 0) { this.Maximum = desc.PropDesc[0] - 1; } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_Evf_AFMode) { uint property = model.EvfAFMode; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: // At the time of application start, if the camera setting is 'Catch AF', make 'Evf_AFMode_LiveFace' forcibly. if (0x09 == property) { EDSDKLib.EDSDK.EdsSetPropertyData(model.Camera, EDSDKLib.EDSDK.PropID_Evf_AFMode, 0, sizeof(uint), 0x02); } else { this.UpdateProperty(property); } break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: // If property is 'Catch AF', do not call UpdateProperty(). _desc = model.EvfAFModeDesc; this.UpdatePropertyDesc(ref _desc); if (0x09 != property) { this.UpdateProperty(property); } break; } } } }
private uint GetPropertyDesc(uint propertyID) { uint err = EDSDKLib.EDSDK.EDS_ERR_OK; EDSDKLib.EDSDK.EdsPropertyDesc propertyDesc = new EDSDKLib.EDSDK.EdsPropertyDesc(); if (propertyID == EDSDKLib.EDSDK.PropID_Unknown) { //If unknown is returned for the property ID , the required property must be retrieved again if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_AEModeSelect); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_DriveMode); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_WhiteBalance); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_Tv); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_Av); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_ISOSpeed); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_MeteringMode); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_ExposureCompensation); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_ImageQuality); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_Evf_AFMode); } if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = this.GetPropertyDesc(EDSDKLib.EDSDK.PropID_MovieParam); } return(err); } //Acquisition of value list that can be set if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { err = EDSDKLib.EDSDK.EdsGetPropertyDesc(_model.Camera, propertyID, out propertyDesc); } //The value list that can be the acquired setting it is set if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { _model.SetPropertyDesc(propertyID, ref propertyDesc); } //Update notification if (err == EDSDKLib.EDSDK.EDS_ERR_OK) { CameraEvent e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)propertyID); _model.NotifyObservers(e); } return(err); }
public DateTimeZoneSetting(ref CameraController controller) { map.Add(0x00000000, "None"); map.Add(0x00000001, "Chatham Islands"); map.Add(0x00000002, "Wellington"); map.Add(0x00000003, "Solomon Islands"); map.Add(0x00000004, "Sydney"); map.Add(0x00000005, "Adelaide"); map.Add(0x00000006, "Tokyo"); map.Add(0x00000007, "Hong Kong"); map.Add(0x00000008, "Bangkok"); map.Add(0x00000009, "Yangon"); map.Add(0x0000000A, "Dhaka"); map.Add(0x0000000B, "Kathmandu"); map.Add(0x0000000C, "Delhi"); map.Add(0x0000000D, "Karachi"); map.Add(0x0000000E, "Kabul"); map.Add(0x0000000F, "Dubai"); map.Add(0x00000010, "Tehran"); map.Add(0x00000011, "Moscow"); map.Add(0x00000012, "Cairo"); map.Add(0x00000013, "Paris"); map.Add(0x00000014, "London"); map.Add(0x00000015, "Azores"); map.Add(0x00000016, "Fernando"); map.Add(0x00000017, "Sao Paulo"); map.Add(0x00000018, "Newfoundland"); map.Add(0x00000019, "Santiago"); map.Add(0x0000001A, "Caracas"); map.Add(0x0000001B, "New York"); map.Add(0x0000001C, "Chicago"); map.Add(0x0000001D, "Denver"); map.Add(0x0000001E, "Los Angeles"); map.Add(0x0000001F, "Anchorage"); map.Add(0x00000020, "Honolulu"); map.Add(0x00000021, "Samoa"); map.Add(0x00000022, "Riyadh"); map.Add(0x00000023, "Manaus"); map.Add(0x00000100, "UTC"); map.Add(0xffffffff, "unknown"); _controller = controller; _camera = _controller.GetModel().Camera; InitializeComponent(); // Date / Time EDSDKLib.EDSDK.EdsTime utcTime; uint err = EDSDKLib.EDSDK.EdsGetPropertyData(_camera, EDSDKLib.EDSDK.PropID_UTCTime, 0, out utcTime); // Zone Setting err = EDSDKLib.EDSDK.EdsGetPropertyData(_camera, EDSDKLib.EDSDK.PropID_TimeZone, 0, out _timeZone); _desc = new EDSDKLib.EDSDK.EdsPropertyDesc(); err = EDSDKLib.EDSDK.EdsGetPropertyDesc(_camera, EDSDKLib.EDSDK.PropID_TimeZone, out _desc); this.comboBox1.Items.Clear(); for (int i = 0; i < _desc.NumElements; i++) { string outString; bool isGet = map.TryGetValue((uint)_desc.PropDesc[i] >> 16, out outString); if (isGet && !outString.Equals("unknown")) { // Create list of combo box comboBox1.Items.Add(outString); if (_timeZone == _desc.PropDesc[i]) { // Select item of combo box comboBox1.SelectedIndex = i; _timeZone = (uint)_desc.PropDesc[i]; _timeZonePrev = _timeZone; } } } // Daylight Saving Time uint summerTimeSetting; err = EDSDKLib.EDSDK.EdsGetPropertyData(_camera, EDSDKLib.EDSDK.PropID_SummerTimeSetting, 0, out summerTimeSetting); if (summerTimeSetting == 0x01) { this.checkBox1.Checked = true; } _summerTimeSetting = this.checkBox1.Checked; _summerTimeSettingPrev = _summerTimeSetting; // Time difference consideration DateTime dateTime = EdsTime2DateTime(utcTime); short timeDiff = (short)(_timeZone & 0x0000ffff); TimeSpan timeSpan = new TimeSpan(0, Convert.ToInt32(this.checkBox1.Checked), timeDiff, 0); dateTime = dateTime.Add(timeSpan); utcTime = DateTime2EdsTime(dateTime); _localTime = EdsTime2StrTime(utcTime); _localTimePrev = _localTime; this.textBox1.Text = _localTime; }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_WhiteBalance) { uint property = (uint)model.WhiteBalance; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: this.UpdateProperty(property); break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: _desc = model.WhiteBalanceDesc; this.UpdatePropertyDesc(ref _desc); this.UpdateProperty(property); break; } } else if (propertyID == EDSDKLib.EDSDK.PropID_Evf_ClickWBCoeffs) { //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: int size; EDSDKLib.EDSDK.EdsDataType datatype; uint err = EDSDKLib.EDSDK.EdsGetPropertySize(model.Camera, EDSDKLib.EDSDK.PropID_Evf_ClickWBCoeffs, 0, out datatype, out size); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { return; } //Get the WB coefficient EDSDKLib.EDSDK.EdsManualWBData wbCoefs = new EDSDKLib.EDSDK.EdsManualWBData(); IntPtr ptr = Marshal.AllocHGlobal(size); err = EDSDKLib.EDSDK.EdsGetPropertyData(model.Camera, EDSDKLib.EDSDK.PropID_Evf_ClickWBCoeffs, 0, size, ptr); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { Marshal.FreeHGlobal(ptr); return; } //Set the WB coefficient converted to the manual white balance data structure to manual white balance. wbCoefs = EDSDKLib.EDSDK.MarshalPtrToManualWBData(ptr); byte[] mwb = EDSDKLib.EDSDK.ConvertMWB(wbCoefs); err = EDSDKLib.EDSDK.EdsSetPropertyData(model.Camera, EDSDKLib.EDSDK.PropID_ManualWhiteBalanceData, 0, mwb.Length, mwb); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { Marshal.FreeHGlobal(ptr); return; } //Change the camera's white balance setting to manual white balance. err = EDSDKLib.EDSDK.EdsSetPropertyData(model.Camera, EDSDKLib.EDSDK.PropID_WhiteBalance, 0, sizeof(uint), 6); Marshal.FreeHGlobal(ptr); break; } } } }