示例#1
0
        public void Dispose()
        {
            uint err = 0;

            //CLOSE THE CAMERA SESSION (ASSUMING THERE IS ONE) RELEASE THE CAMERA AND TERMINATE THE SDK
            err = EDSDK.EdsCloseSession(camObj);
            err = EDSDK.EdsRelease(camObj);
            err = EDSDK.EdsTerminateSDK();
        }
示例#2
0
 public void Dispose()
 {
     _folder.Dispose();
     if (_shouldRelease)
     {
         SDKHelper.CheckError(EDSDK.EdsCloseSession(_pointer));
         SDKHelper.CheckError(EDSDK.EdsRelease(_pointer));
     }
     _disposed = true;
 }
示例#3
0
        public uint onCameraAdded(IntPtr inContext) //TODO add Exceptionhandling
        {
            IntPtr tmpPtr   = IntPtr.Zero;
            int    tmpCount = 0;

            EDSDKLib.EDSDK.EdsDeviceInfo deviceInfo;
            char[] tmpName = new char[32];
            uint   error   = 0;

            /**
             * First getting cameralist pointer
             * */
            error = EDSDKLib.EDSDK.EdsGetCameraList(out tmpPtr);
            if (error != EDSDK.EDS_ERR_OK)
            {
                //TODO Fehler behandeln
            }

            /*
             * Getting count of cameralist childs to choose the last adding on the list
             * */
            error = EDSDKLib.EDSDK.EdsGetChildCount(tmpPtr, out tmpCount);
            if (error != EDSDK.EDS_ERR_OK)
            {
                //TODO Fehler behandeln
            }

            /*
             * Get the camera pointer of the last object on the cameralist
             * */
            error = EDSDKLib.EDSDK.EdsGetChildAtIndex(tmpPtr, tmpCount - 1, out tmpPtr);
            if (error != EDSDK.EDS_ERR_OK)
            {
                //TODO Fehler behandeln
            }

            /*
             * Getting device info of given camera pointer
             * */
            error = EDSDKLib.EDSDK.EdsGetDeviceInfo(tmpPtr, out deviceInfo);
            if (error != EDSDK.EDS_ERR_OK)
            {
                //TODO Fehler behandeln
            }
            string cameraName;

            EDSDK.EdsOpenSession(tmpPtr);
            EDSDK.EdsGetPropertyData(tmpPtr, EDSDK.PropID_ProductName, 0, out cameraName);
            EDSDK.EdsCloseSession(tmpPtr);
            this.CameraList.Add(new Camera(tmpPtr, cameraName));
            error = EDSDK.EdsSetPropertyEventHandler(tmpPtr, EDSDK.PropertyEvent_All, cameraPropertyEventHandler, tmpPtr);
            error = EDSDK.EdsSetCameraStateEventHandler(tmpPtr, EDSDK.StateEvent_All, this.cameraStateEventHandler, tmpPtr);
            return(0x0);
        }
示例#4
0
 private uint onCameraStateChanged(uint inEvent, uint inParameter, IntPtr inContext)
 {
     if (inEvent == EDSDK.StateEvent_Shutdown)
     {
         EDSDK.EdsCloseSession(inContext);
         for (int i = 0; i < this.CameraList.Count; i++)
         {
             if (this.CameraList.ElementAt(i).Ptr == inContext)
             {
                 this.CameraList.RemoveAt(i);
             }
         }
         //TODO wenn Kamera von der Liste gelöscht wird müssen alle Felder der GUI über das Databinding gelöscht werden
     }
     return(0x0);
 }
示例#5
0
        public static void CloseCameras(IntPtr[] Camera, int Count)
        {
            int    i;
            uint   success;
            IntPtr _camera = new IntPtr();

            for (i = 0; i < Count; i++)
            {
                _camera = Camera[i];
                success = EDSDK.EdsCloseSession(_camera);
                if (success != EDSDK.EDS_ERR_OK)
                {
                    Console.WriteLine("CloseCamera failed\t\t" + success.ToString());
                }
                else
                {
                    Console.WriteLine("CloseCamera successs");
                }
            }
        }
示例#6
0
        /// <summary>
        /// Closes the session.
        /// </summary>
        /// <remarks></remarks>
        protected void CloseSession()
        {
            UInt32 returnValue = EDSDK.EdsCloseSession(this.Handle);

            ReturnValueManager.HandleFunctionReturnValue(returnValue);
        }