Change-Id: I496a2a35a883f3853dfa59a61ad1e89b4c50d463
Signed-off-by: Haesu Gwon <haesu.gwon@samsung.com>
{
lock (_deviceStateChangedEventLock)
{
{
lock (_deviceStateChangedEventLock)
{
_deviceStateChangedCallback = (CameraDevice device, CameraDeviceState state, IntPtr userData) =>
{
_deviceStateChanged?.Invoke(null, new CameraDeviceStateChangedEventArgs(device, state));
};
_deviceStateChangedCallback = (CameraDevice device, CameraDeviceState state, IntPtr userData) =>
{
_deviceStateChanged?.Invoke(null, new CameraDeviceStateChangedEventArgs(device, state));
};
- CameraErrorFactory.ThrowIfError(Native.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out callbackId),
+ CameraErrorFactory.ThrowIfError(Native.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out int callbackId),
"Failed to set interrupt callback");
// Keep current callbackId and EventHandler pair to remove EventHandler later.
"Failed to set interrupt callback");
// Keep current callbackId and EventHandler pair to remove EventHandler later.
{
_deviceStateChanged -= value;
{
_deviceStateChanged -= value;
- int callbackId = 0;
- _callbackIdInfo.TryGetValue(value, out callbackId);
+ _callbackIdInfo.TryGetValue(value, out int callbackId);
Log.Info(CameraLog.Tag, "remove callbackId " + callbackId.ToString());
CameraErrorFactory.ThrowIfError(Native.UnsetDeviceStateChangedCallback(callbackId),
Log.Info(CameraLog.Tag, "remove callbackId " + callbackId.ToString());
CameraErrorFactory.ThrowIfError(Native.UnsetDeviceStateChangedCallback(callbackId),
- bool val = false;
-
- CameraErrorFactory.ThrowIfError(Native.GetDisplayReuseHint(_handle, out val),
+ CameraErrorFactory.ThrowIfError(Native.GetDisplayReuseHint(_handle, out bool val),
"Failed to get camera display reuse hint");
return val;
"Failed to get camera display reuse hint");
return val;
- CameraFacingDirection val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetFacingDirection(_handle, out val),
+ CameraErrorFactory.ThrowIfError(Native.GetFacingDirection(_handle, out var val),
"Failed to get camera direction");
return val;
"Failed to get camera direction");
return val;
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetDeviceCount(_handle, out val),
+ CameraErrorFactory.ThrowIfError(Native.GetDeviceCount(_handle, out int val),
"Failed to get camera device count");
return val;
"Failed to get camera device count");
return val;
ValidateState(CameraState.Created);
ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
ValidateState(CameraState.Created);
ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
- CameraErrorFactory.ThrowIfError(Native.ChangeDevice(_handle, (int)device),
+ CameraErrorFactory.ThrowIfError(Native.ChangeDevice(_handle, device),
"Failed to change the camera device");
}
"Failed to change the camera device");
}
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public CameraDeviceState GetDeviceState(CameraDevice device)
{
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public CameraDeviceState GetDeviceState(CameraDevice device)
{
ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
- CameraErrorFactory.ThrowIfError(Native.GetDeviceState(device, out val),
+ CameraErrorFactory.ThrowIfError(Native.GetDeviceState(device, out var val),
"Failed to get the camera device state.");
"Failed to get the camera device state.");
- return (CameraDeviceState)val;
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public static CameraFlashState GetFlashState(CameraDevice device)
{
/// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
public static CameraFlashState GetFlashState(CameraDevice device)
{
- CameraFlashState val = CameraFlashState.NotUsed;
ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
- CameraErrorFactory.ThrowIfError(Native.GetFlashState(device, out val),
+ CameraErrorFactory.ThrowIfError(Native.GetFlashState(device, out var val),
"Failed to get camera flash state");
return val;
"Failed to get camera flash state");
return val;
- CameraDisplayMode val = CameraDisplayMode.LetterBox;
-
- CameraErrorFactory.ThrowIfError(Native.GetMode(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetMode(_camera.GetHandle(), out var val),
"Failed to get camera display mode");
return val;
"Failed to get camera display mode");
return val;
- bool val = false;
-
- CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out bool val),
"Failed to get visible value");
return val;
"Failed to get visible value");
return val;
- int x = 0;
- int y = 0;
- int width = 0;
- int height = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(), out x, out y, out width, out height),
- "Failed to get display roi area");
+ CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(),
+ out int x, out int y, out int width, out int height), "Failed to get display roi area");
return new Rectangle(x, y, width, height);
}
return new Rectangle(x, y, width, height);
}
private bool CheckRangeValid(GetRangeDelegate func)
{
private bool CheckRangeValid(GetRangeDelegate func)
{
- int min = 0;
- int max = 0;
-
- CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out min, out max),
+ CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out int min, out int max),
"Failed to check feature is suported or not.");
return min < max;
"Failed to check feature is suported or not.");
return min < max;
private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
private Range? GetRange(GetRangeDelegate func)
{
private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
private Range? GetRange(GetRangeDelegate func)
{
- int min = 0;
- int max = 0;
-
- CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out min, out max),
+ CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out int min, out int max),
"Failed to initialize the camera settings");
if (min > max)
"Failed to initialize the camera settings");
if (min > max)
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out int val),
"Failed to get camera contrast value");
return val;
"Failed to get camera contrast value");
return val;
- bool val = false;
-
- CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out bool val),
"Failed to get camera auto contrast");
return val;
"Failed to get camera auto contrast");
return val;
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out int val),
"Failed to get camera brightness value");
return val;
"Failed to get camera brightness value");
return val;
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out int val),
"Failed to get camera exposure value");
return val;
"Failed to get camera exposure value");
return val;
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out int val),
"Failed to get zoom level");
return val;
"Failed to get zoom level");
return val;
- CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), (int)value),
+ CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), value),
"Failed to set zoom level.");
}
}
"Failed to set zoom level.");
}
}
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out int val),
"Failed to get image quality");
return val;
"Failed to get image quality");
return val;
- CameraFps val = CameraFps.Auto;
-
- CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out var val),
"Failed to get camera preview fps");
return val;
"Failed to get camera preview fps");
return val;
- int width = 0;
- int height = 0;
-
- CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out width, out height),
+ CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out int width, out int height),
"Failed to get camera preview resolution");
return new Size(width, height);
"Failed to get camera preview resolution");
return new Size(width, height);
- int width = 0;
- int height = 0;
-
- CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out width, out height),
+ CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out int width, out int height),
"Failed to get recommended preview resolution");
return new Size(width, height);
"Failed to get recommended preview resolution");
return new Size(width, height);
- CameraPixelFormat val = 0;
-
- CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out var val),
"Failed to get preview format");
return val;
"Failed to get preview format");
return val;
- int width = 0;
- int height = 0;
-
- CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out width, out height),
+ CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out int width, out int height),
"Failed to get camera capture resolution");
return new Size(width, height);
"Failed to get camera capture resolution");
return new Size(width, height);
- CameraPixelFormat val = CameraPixelFormat.Invalid;
-
- CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out var val),
"Failed to get camera capture formats");
return val;
"Failed to get camera capture formats");
return val;
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out int val),
"Failed to get preview bitrate");
return val;
"Failed to get preview bitrate");
return val;
- CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), (int)value),
+ CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), value),
"Failed to set encoded preview bitrate.");
}
}
"Failed to set encoded preview bitrate.");
}
}
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out int val),
"Failed to get preview gop interval");
return val;
"Failed to get preview gop interval");
return val;
- CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), (int)value),
+ CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), value),
"Failed to set encoded preview gop intervals.");
}
}
"Failed to set encoded preview gop intervals.");
}
}
- CameraTheaterMode val = CameraTheaterMode.Disable;
-
- CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out var val),
"Failed to get camera theater mode");
return val;
"Failed to get camera theater mode");
return val;
- CameraEffectMode val = CameraEffectMode.None;
-
- CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out var val),
"Failed to get camera effect");
return val;
"Failed to get camera effect");
return val;
- CameraSceneMode val = CameraSceneMode.Normal;
-
- CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out var val),
"Failed to get camera scene mode");
return val;
"Failed to get camera scene mode");
return val;
- CameraFlashMode val = CameraFlashMode.Off;
-
- CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out var val),
"Failed to get camera flash mode");
return val;
"Failed to get camera flash mode");
return val;
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out var val),
"Failed to get camera lens orientation");
return val;
"Failed to get camera lens orientation");
return val;
- CameraRotation val = CameraRotation.None;
-
- CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out var val),
"Failed to get camera stream rotation");
return val;
"Failed to get camera stream rotation");
return val;
- CameraFlip val = CameraFlip.None;
-
- CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val),
"Failed to get camera stream flip");
return val;
"Failed to get camera stream flip");
return val;
- CameraHdrMode val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out var val),
"Failed to get camera hdr mode");
return val;
"Failed to get camera hdr mode");
return val;
- bool val = false;
-
- CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out bool val),
"Failed to get camera anti shake value");
return val;
"Failed to get camera anti shake value");
return val;
- bool val = false;
-
- CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out bool val),
"Failed to get camera video stabilization");
return val;
"Failed to get camera video stabilization");
return val;
set
{
ValidationUtil.ValidateEnum(typeof(CameraPtzType), value);
set
{
ValidationUtil.ValidateEnum(typeof(CameraPtzType), value);
- CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), (int)value),
+
+ CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), value),
"Failed to set camera ptz type.");
}
}
"Failed to set camera ptz type.");
}
}
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int GetPan()
{
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int GetPan()
{
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out int val),
"Failed to get the camera pan step.");
return val;
"Failed to get the camera pan step.");
return val;
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int GetTilt()
{
/// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
public int GetTilt()
{
- int val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out int val),
"Failed to set the camera current position.");
return val;
"Failed to set the camera current position.");
return val;
- bool val = false;
-
- CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out bool val),
"Failed to get camera enable tag");
return val;
"Failed to get camera enable tag");
return val;
- double latitude = 0.0;
- double longitude = 0.0;
- double altitude = 0.0;
-
- CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(), out latitude, out longitude, out altitude),
- "Failed to get tag");
+ CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(),
+ out double latitude, out double longitude, out double altitude), "Failed to get tag");
return new Location(latitude, longitude, altitude);
}
return new Location(latitude, longitude, altitude);
}
- CameraTagOrientation val = 0;
-
- CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out val),
+ CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out var val),
"Failed to get camera tag orientation");
return val;
"Failed to get camera tag orientation");
return val;
internal static extern CameraError Create(CameraDevice device, out IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_change_device")]
internal static extern CameraError Create(CameraDevice device, out IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_change_device")]
- internal static extern CameraError ChangeDevice(IntPtr handle, int device);
+ internal static extern CameraError ChangeDevice(IntPtr handle, CameraDevice device);
[DllImport(Libraries.Camera, EntryPoint = "camera_destroy")]
internal static extern CameraError Destroy(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_destroy")]
internal static extern CameraError Destroy(IntPtr handle);
internal static extern CameraError StopPreview(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_device_state")]
internal static extern CameraError StopPreview(IntPtr handle);
[DllImport(Libraries.Camera, EntryPoint = "camera_get_device_state")]
- internal static extern CameraError GetDeviceState(CameraDevice device, out int state);
+ internal static extern CameraError GetDeviceState(CameraDevice device, out CameraDeviceState state);
[DllImport(Libraries.Camera, EntryPoint = "camera_start_capture")]
internal static extern CameraError StartCapture(IntPtr handle, CapturingCallback captureCallback,
[DllImport(Libraries.Camera, EntryPoint = "camera_start_capture")]
internal static extern CameraError StartCapture(IntPtr handle, CapturingCallback captureCallback,
internal static extern CameraError GetTiltRange(IntPtr handle, out int min, out int max);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_ptz_type")]
internal static extern CameraError GetTiltRange(IntPtr handle, out int min, out int max);
[DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_ptz_type")]
- internal static extern CameraError SetPtzType(IntPtr handle, int type);
+ internal static extern CameraError SetPtzType(IntPtr handle, CameraPtzType type);