예제 #1
0
        public IEnumerable <CameraDeviceInformation> GetDeviceInformation()
        {
            var deviceList = new Native.CameraDeviceListStruct();

            Native.GetDeviceList(Handle, ref deviceList).
            ThrowIfFailed("Failed to get camera device list");

            return(GetDeviceInformation(deviceList));
        }
예제 #2
0
        private void UnregisterDeviceConnectionChangedCallback()
        {
            Log.Debug(CameraLog.Tag, $"Enter. callbackId[{_connectionCallbackId}]");

            if (_connectionCallbackId >= 0)
            {
                Native.UnsetDeviceConnectionChangedCallback(Handle, _connectionCallbackId).
                ThrowIfFailed("Failed to unset device connection changed callback");
            }
        }
예제 #3
0
        private void RegisterDeviceConnectionChangedCallback()
        {
            Native.DeviceConnectionChangedCallback callback = (ref Native.CameraDeviceStruct device, bool status, IntPtr userData) =>
            {
                DeviceConnectionChanged?.Invoke(this, new CameraDeviceConnectionChangedEventArgs(ref device, status));
            };

            Native.SetDeviceConnectionChangedCallback(Handle, callback, IntPtr.Zero, out connectionCallbackId).
            ThrowIfFailed("Failed to set device connection changed callback");
        }
예제 #4
0
        private void RegisterDeviceConnectionChangedCallback()
        {
            _deviceConnectionChangedCallback = (ref Native.CameraDeviceStruct device, bool status, IntPtr userData) =>
            {
                Log.Debug(CameraLog.Tag, "Invoke DeviceConnectionChanged event");
                _deviceConnectionChanged?.Invoke(this, new CameraDeviceConnectionChangedEventArgs(ref device, status));
            };

            Native.SetDeviceConnectionChangedCallback(Handle, _deviceConnectionChangedCallback, IntPtr.Zero, out _connectionCallbackId).
            ThrowIfFailed("Failed to set device connection changed callback");

            Log.Debug(CameraLog.Tag, $"callbackId[{_connectionCallbackId}]");
        }
예제 #5
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    // to be used if there are any other disposable objects
                }

                if (_handle != IntPtr.Zero)
                {
                    UnregisterDeviceConnectionChangedCallback();

                    Native.Deinitialize(_handle);
                    _handle = IntPtr.Zero;
                }

                _disposed = true;
            }
        }
예제 #6
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                Log.Debug(CameraLog.Tag, $"Enter. disposing:{disposing.ToString()}");

                if (disposing)
                {
                    // to be used if there are any other disposable objects
                }

                if (_handle != IntPtr.Zero)
                {
                    UnregisterDeviceConnectionChangedCallback();

                    Native.Deinitialize(_handle);
                    _handle = IntPtr.Zero;
                }

                _disposed = true;
            }
        }
예제 #7
0
 public CameraDeviceManager()
 {
     Native.Initialize(out _handle).ThrowIfFailed("Failed to initialize CameraDeviceManager");
 }
예제 #8
0
        public CameraDeviceManager()
        {
            Native.Initialize(out _handle).ThrowIfFailed("Failed to initialize CameraDeviceManager");

            RegisterDeviceConnectionChangedCallback();
        }
예제 #9
0
 private void UnregisterDeviceConnectionChangedCallback()
 {
     Native.UnsetDeviceConnectionChangedCallback(Handle, connectionCallbackId).
     ThrowIfFailed("Failed to unset device connection changed callback");
 }