Example #1
0
 public DUODevice()
 {
     handle = GCHandle.Alloc(this);
     if (DUOLib.OpenDUO(ref duoInstance))
     {
         DUOLib.SetDUOResolutionInfo(duoInstance, resolutionInfo);
         DUOLib.SetDUOCameraSwap(duoInstance, cameraSwap);
         DUOLib.SetDUOHFlip(duoInstance, hFlip);
         DUOLib.SetDUOVFlip(duoInstance, vFlip);
         DUOLib.SetDUOExposure(duoInstance, exposure);
         DUOLib.SetDUOGain(duoInstance, gain);
         DUOLib.SetDUOLedPWM(duoInstance, led);
         DUOLib.SetDUOUndistort(duoInstance, undistort);
         if (!DUOLib.GetDUODeviceName(duoInstance, ref deviceName))
         {
             deviceName = DUOLibInternal.UNKNOWN_STRING;
         }
         if (!DUOLib.GetDUOSerialNumber(duoInstance, ref serialNumber))
         {
             deviceName = DUOLibInternal.UNKNOWN_STRING;
         }
         if (!DUOLib.GetDUOFirmwareVersion(duoInstance, ref firmwareVersion))
         {
             deviceName = DUOLibInternal.UNKNOWN_STRING;
         }
         if (!DUOLib.GetDUOFirmwareBuild(duoInstance, ref firmwareBuild))
         {
             deviceName = DUOLibInternal.UNKNOWN_STRING;
         }
     }
 }
Example #2
0
 private void Destroy()
 {
     lock (duoLock)
     {
         if (duoInstance == IntPtr.Zero)
         {
             return;
         }
         DUOLib.CloseDUO(duoInstance);
         duoInstance = IntPtr.Zero;
     }
 }
Example #3
0
 public bool Stop()
 {
     lock (duoLock)
     {
         if ((duoInstance == IntPtr.Zero) || (!running))
         {
             return(false);
         }
         bool ret = DUOLib.StopDUO(duoInstance);
         if (ret)
         {
             running = false;
             if (DUODeviceStatusChanged != null)
             {
                 DUODeviceStatusChanged(this, false);
             }
         }
         return(ret);
     }
 }
Example #4
0
 public bool Start()
 {
     lock (duoLock)
     {
         if ((duoInstance == IntPtr.Zero) || (running))
         {
             return(false);
         }
         bool ret = DUOLib.StartDUO(duoInstance, duoFrameCallback, GCHandle.ToIntPtr(handle));
         if (ret)
         {
             running = true;
             if (DUODeviceStatusChanged != null)
             {
                 DUODeviceStatusChanged(this, true);
             }
         }
         return(ret);
     }
 }