private void Create(CameraDevice device) { CameraDeviceType cameraDeviceType = CameraDeviceType.BuiltIn; try { _cameraDeviceManager = new CameraDeviceManager(); var deviceInfo = _cameraDeviceManager.GetDeviceInformation(); Log.Info(CameraLog.Tag, deviceInfo.ToString()); cameraDeviceType = deviceInfo.First().Type; } catch (NotSupportedException e) { Tizen.Log.Info(CameraLog.Tag, $"CameraDeviceManager is not supported. {e.Message}. Not error."); } if (cameraDeviceType == CameraDeviceType.BuiltIn || cameraDeviceType == CameraDeviceType.Usb) { Native.Create(device, out _handle). ThrowIfFailed($"Failed to create {cameraDeviceType.ToString()} camera"); } else { Native.CreateNetworkCamera(device, out _handle). ThrowIfFailed($"Failed to create {cameraDeviceType.ToString()} camera"); } }
private void Create(CameraDevice device) { CameraDeviceType cameraDeviceType = CameraDeviceType.BuiltIn; try { using (var cameraDeviceManager = new CameraDeviceManager()) { var deviceInfo = cameraDeviceManager.GetDeviceInformation(); if (!deviceInfo.Any()) { throw new InvalidOperationException("There's no available camera device."); } cameraDeviceType = deviceInfo.First().Type; } } catch (NotSupportedException e) { Log.Info(CameraLog.Tag, $"CameraDeviceManager is not supported. {e.Message}. Not error."); } if (cameraDeviceType == CameraDeviceType.BuiltIn || cameraDeviceType == CameraDeviceType.Usb) { Native.Create(device, out _handle). ThrowIfFailed($"Failed to create {cameraDeviceType.ToString()} camera"); } else { Native.CreateNetworkCamera(device, out _handle). ThrowIfFailed($"Failed to create {cameraDeviceType.ToString()} camera"); } }
private IEnumerable <CameraDeviceInformation> GetDeviceInformation() { using (var cameraDeviceManager = new CameraDeviceManager()) { return(cameraDeviceManager.GetDeviceInformation()); } }
internal CameraDeviceConnectionChangedEventArgs(ref CameraDeviceStruct device, bool status) { CameraDeviceInformation = CameraDeviceManager.GetDeviceInformation(device); IsConnected = status; }