/// <summary> /// Holt die aktuelle Einstellung für den Akkuladezustand aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getBatteryLevel() { if ((Error = EDSDK.EdsGetPropertyData(this._ptr, EDSDKLib.EDSDK.PropID_BatteryLevel, 0, out this._batteryLevel)) != 0) { publicError(Error); } }
private bool getShutterSpeeds() { uint err = 0; EDSDK.EdsPropertyDesc Shutters; err = EDSDK.EdsGetPropertyDesc(camObj, EDSDK.PropID_Tv, out Shutters); if (err != EDSDK.EDS_ERR_OK) { if (errorEvent != null) { errorEvent("Failed to get camera iso speeds"); } return(false); } //ADD THE ISO VALUES TO THE PROPERTY LIST //isoValues.AddRange((IEnumerable<ISOSpeeds>)ISOS.PropDesc.Take(ISOS.NumElements)); foreach (int tmpISO in Shutters.PropDesc.Take(Shutters.NumElements)) { shutterSpeeds.Add((ShutterSpeeds)tmpISO); } return(true); }
private IntPtr getVolume() { uint err; int count = 0; IntPtr volume; //GET VOLUME COUNT ON CAMERA err = EDSDK.EdsGetChildCount(camObj, out count); if (err != EDSDK.EDS_ERR_OK || count == 0) { if (errorEvent != null) { errorEvent("Volume Not Found!"); } return(IntPtr.Zero); } //GET INITIAL VOLUME err = EDSDK.EdsGetChildAtIndex(camObj, 0, out volume); if (err != EDSDK.EDS_ERR_OK) { if (errorEvent != null) { errorEvent("Directory Not Found!"); } return(IntPtr.Zero); } return(volume); }
public void DownloadLiveViewImage(Action <MemoryStream, uint> onImageRecieved) { IntPtr stream = IntPtr.Zero; IntPtr image = IntPtr.Zero; IntPtr pointer = IntPtr.Zero; uint size = 0; try { SDKHelper.CheckError(EDSDK.EdsCreateMemoryStream(BUFFER_SIZE, out stream)); SDKHelper.CheckError(EDSDK.EdsCreateEvfImageRef(stream, out image)); SDKHelper.CheckError(EDSDK.EdsDownloadEvfImage(_pointer, image)); SDKHelper.CheckError(EDSDK.EdsGetPointer(stream, out pointer)); SDKHelper.CheckError(EDSDK.EdsGetLength(stream, out size)); onImageRecieved(CopyToMemoryStream(pointer, size), size); SDKHelper.CheckError(EDSDK.EdsRelease(image)); SDKHelper.CheckError(EDSDK.EdsRelease(stream)); } catch (SDKComeBackLaterException) { } }
public IEnumerable <Camera> GetCameras() { UInt32 returnValue; IntPtr cameraListPointer; returnValue = EDSDK.EdsGetCameraList(out cameraListPointer); ReturnValueManager.HandleFunctionReturnValue(returnValue); try { Int32 cameraListCount; returnValue = EDSDK.EdsGetChildCount(cameraListPointer, out cameraListCount); ReturnValueManager.HandleFunctionReturnValue(returnValue); for (var i = 0; i < cameraListCount; ++i) { IntPtr cameraPointer; returnValue = EDSDK.EdsGetChildAtIndex(cameraListPointer, i, out cameraPointer); ReturnValueManager.HandleFunctionReturnValue(returnValue); Camera camera = new Camera(cameraPointer); yield return(camera); } } finally { // Release Camera List Pointer if (cameraListPointer != IntPtr.Zero) { EDSDK.EdsRelease(cameraListPointer); } } }
public void stopLV() { this.LvActive = false; Thread.Sleep(500); EDSDK.EdsRelease(this.MemStreamPtr); EDSDK.EdsRelease(this.EvfImgPtr); }
private void LoadCamerasList(IntPtr aCameraListPointer) { int cameraCount; SDKHelper.CheckError(EDSDK.EdsGetChildCount(aCameraListPointer, out cameraCount)); IntPtr[] pointers = GetCameraPointers(aCameraListPointer, cameraCount); Dictionary <IntPtr, ICameraProcessor> temporary = new Dictionary <IntPtr, ICameraProcessor>(); for (int i = 0; i < pointers.Length; ++i) { IntPtr pointer = pointers[i]; if (_processors.ContainsKey(pointer)) { temporary.Add(pointer, _processors[pointer]); _processors.Remove(pointer); } else { temporary.Add(pointer, new CameraProcessor(pointer, _cameraNotifications)); } } Array.ForEach(_processors.Values.ToArray(), cameraProcessor => cameraProcessor.Dispose()); _processors = temporary; }
/// <summary> /// Holt die aktuelle Einstellung für ISO aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getIsoSpeed() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_ISOSpeed, 0, out this._isoSpeed)) != 0) { publicError(Error); } }
/// <summary> /// Holt die aktuelle Einstellung für die verfügbaren freien Fotos aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getAvailableShots() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_AvailableShots, 0, out this._availableShots)) != 0) { publicError(Error); } }
/// <summary> /// Holt die aktuelle Einstellung für Belichtungsmessung aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getMeteringMode() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_MeteringMode, 0, out this._meteringMode)) != 0) { publicError(Error); } }
/// <summary> /// Holt die aktuelle Einstellung für Belichtungszeit aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getShutterTime() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_Tv, 0, out this._shutterTime)) != 0) { publicError(Error); } }
/// <summary> /// Holt die aktuelle Einstellung für AF Modus aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getAfMode() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_AFMode, 0, out this._afMode)) != 0) { publicError(Error); } }
/// <summary> /// Holt die aktuelle Einstellung für die Blende aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getApertureFromCamera() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_Av, 0, out this._aperture)) != 0) { publicError(Error); } }
/// <summary> /// Holt die aktuelle Einstellung für EBV aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getEbvFromBody() { if ((Error = EDSDK.EdsGetPropertyData(this._ptr, EDSDKLib.EDSDK.PropID_ExposureCompensation, 0, out this._exposureCompensation)) != 0) { publicError(Error); } }
/// <summary> /// Holt die Tabelle der verfügbaren ISO-Werte von der Kamera und speichert sie in den Klassemember /// </summary> public void getPropertyDescIsoSpeed() { if ((Error = EDSDK.EdsGetPropertyDesc(this.Ptr, EDSDK.PropID_ISOSpeed, out this.availableISOSpeeds)) != 0) { publicError(Error); } }
/// <summary> /// Holt die aktuelle Einstellung für die Firmware Version aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getFirmwareVersion() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_FirmwareVersion, 0, out this._cameraFirmware)) != 0) { publicError(Error); } }
/// <summary> /// Holt die Einstellung für die Zeit von der Kamera und speichert sie in den Klassemember /// </summary> public void getTime() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_DateTime, 0, out this._time)) != 0) { publicError(Error); } }
/// <summary> /// Holt die aktuelle Einstellung für die Gehäuse ID aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getBodyID() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.PropID_BodyIDEx, 0, out this._bodyID)) != 0) { publicError(Error); } }
private void Initialize() { SDKHelper.CheckError(EDSDK.EdsInitializeSDK()); SDKHelper.CheckError(EDSDK.EdsGetCameraList(out _cameraListPointer)); LoadCamerasList(_cameraListPointer); }
/// <summary> /// Holt die aktuelle Einstellung für den Speicherort aus der Kamera und speichert ihn in den Klassenmember /// </summary> public void getCurrentStorage() { if ((Error = EDSDK.EdsGetPropertyData(this.Ptr, EDSDK.kEdsPropID_CurrentStorage, 0, out this._currentStorage)) != 0) { publicError(Error); } }
private uint DownloadImage(uint inEvent, IntPtr inRef, IntPtr inContext) { _cameraNotifications.Log(string.Format("Camera event: {0}", SDKHelper.DecodeEvent(inEvent))); lock (_synchronizationObject) { try { if (inEvent == EDSDK.ObjectEvent_DirItemRequestTransfer) { if (_imageHandler != null) { _imageHandler.Handle(GetImageFile(inRef, _folder)); } _cameraNotifications.CameraDone(); } if (inEvent == EDSDK.ObjectEvent_DirItemCreated) { _cameraNotifications.CameraDone(); } } finally { if (inRef != IntPtr.Zero) { SDKHelper.CheckError(EDSDK.EdsRelease(inRef)); } } return(0); } }
/// <summary> /// Holt die Tabelle der verfügbaren Blendenwerte von der Kamera und speichert sie in den Klassemember /// </summary> public void getpropertyDescApertureValues() { if ((Error = EDSDK.EdsGetPropertyDesc(this.Ptr, EDSDK.PropID_Av, out this.availableApertureValues)) != 0) { publicError(Error); } }
public void Dispose() { uint tmpError; tmpError = EDSDK.EdsTerminateSDK(); this.SDKState = false; }
/// <summary> /// Holt die Tabelle der verfügbaren Belichtungszeiten von der Kamera und speichert sie in den Klassemember /// </summary> public void getpropertyDescShutterTimes() { if ((Error = EDSDK.EdsGetPropertyDesc(this.Ptr, EDSDK.PropID_Tv, out this.availableShutterspeeds)) != 0) { publicError(Error); } }
private bool getBrackets() { uint err = 0; EDSDK.EdsPropertyDesc EXP; err = EDSDK.EdsGetPropertyDesc(camObj, EDSDK.PropID_ExposureCompensation, out EXP); if (err != EDSDK.EDS_ERR_OK) { if (errorEvent != null) { errorEvent("Failed to get camera exposure compensation values"); } return(false); } //ADD THE VALUES RETRIEVED TO THE PROPERTY LIST //exposureValues.AddRange((IEnumerable<ExposureCompensations>)EXP.PropDesc.Take(EXP.NumElements)); foreach (int tmpExp in EXP.PropDesc.Take(EXP.NumElements)) { exposureValues.Add((ExposureCompensations)tmpExp); } return(true); }
/// <summary> /// Holt die Tabelle der verfügbaren EBV von der Kamera und speichert sie in den Klassemember /// </summary> public void getpropertyDescExposureCompensation() { if ((Error = EDSDK.EdsGetPropertyDesc(this.Ptr, EDSDK.PropID_ExposureCompensation, out this.availableExposureCompensation)) != 0) { publicError(Error); } }
private bool getApertures() { uint err = 0; EDSDK.EdsPropertyDesc apertures; err = EDSDK.EdsGetPropertyDesc(camObj, EDSDK.PropID_Av, out apertures); if (err != EDSDK.EDS_ERR_OK) { if (errorEvent != null) { errorEvent("Failed to get camera aperture values"); } return(false); } //ADD THE ISO VALUES TO THE PROPERTY LIST //isoValues.AddRange((IEnumerable<ISOSpeeds>)ISOS.PropDesc.Take(ISOS.NumElements)); foreach (int tmpAperture in apertures.PropDesc.Take(apertures.NumElements)) { apertureValues.Add((Apertures)tmpAperture); } return(true); }
/// <summary> /// Holt die Tabelle der verfügbaren Autofokusmodi von der Kamera und speichert sie in den Klassemember /// </summary> public void getPropertyDescAFModes() { if ((Error = EDSDK.EdsGetPropertyDesc(this.Ptr, EDSDK.PropID_AFMode, out this.availableAFModes)) != 0) { publicError(Error); } }
public static IntPtr GetCameras(out int Count) { uint success; IntPtr CameraListRef = new IntPtr(); success = EDSDK.EdsGetCameraList(out CameraListRef); if (success != EDSDK.EDS_ERR_OK) { Console.WriteLine("GetCameraList failed"); } else { Console.WriteLine("GetCameraList success"); } success = EDSDK.EdsGetChildCount(CameraListRef, out Count); if (success != EDSDK.EDS_ERR_OK) { Console.WriteLine("GetChildCount failed"); } else { Console.WriteLine("GetChildCount success\t" + "child num is:" + Count.ToString()); } return(CameraListRef); }
public static void Initialize() { lock (lockObj) { if (!initialized) { if (!DllLoader.IsX86()) { //When EOS Utility by Canon is open in the background the EDSDK.EdsInitializeSDK throws an uncatchable AccessViolation Exception //Therefore the system processes are scanned for this program and if found the initialization is prevented var eosUtil = System.Diagnostics.Process.GetProcessesByName("EOS Utility"); if (eosUtil.Length > 0) { throw new Exception("Cannot initialize Canon SDK. EOS Utiltiy is preventing the DLL to load. Please close EOS Utility first to be able to connect to your Canon Camera!"); } } var err = EDSDK.EdsInitializeSDK(); if (err > 0) { throw new Exception($"Canon EdsInitializeSDK failed with code {err}"); } else { initialized = true; } } } }