Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master -> DevelNUI integration #5853

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Tizen.Applications;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using NativeClient = Interop.MediaControllerClient;
using NativeServer = Interop.MediaControllerServer;
using NativeClientHandle = Interop.MediaControllerClientHandle;
Expand Down Expand Up @@ -59,10 +60,33 @@ internal void SetRequestInformation(string receiverId)
/// <param name="requestId">The request Id for each command.</param>
internal void SetResponseInformation(string receiverId, string requestId)
{
ReceiverId = receiverId ?? throw new ArgumentNullException(nameof(receiverId)); ;
_requestId = requestId ?? throw new ArgumentNullException(nameof(requestId)); ;
ReceiverId = receiverId ?? throw new ArgumentNullException(nameof(receiverId));
_requestId = requestId;

if (_requestId == null)
{
Log.Info(GetType().FullName, "request_id is null. Response() should not be called.");
}
}

/// <summary>
/// Indicates if the response is needed.
/// </summary>
/// <remarks>If false, the receiver should not respond to the received command.</remarks>
/// <since_tizen> 12 </since_tizen>
public bool IsResponseNeeded => NeedToResponse;

/// <summary>
/// Indicates if the response is needed.
/// </summary>
/// <remarks>
/// This internal API is retained for backward compatibility but is not recommended for new development.
/// Please use <see cref="IsResponseNeeded"/> instead.<br/>
/// If false, the receiver should not respond to the received command.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool NeedToResponse => _requestId != null;

/// <summary>
/// Requests command to server.
/// </summary>
Expand All @@ -83,13 +107,18 @@ internal void SetResponseInformation(string receiverId, string requestId)
protected virtual void OnResponseCompleted() { }

/// <summary>
/// Responses command to the client.
/// Responds to the clients command.
/// </summary>
/// <param name="serverHandle">The server handle.</param>
/// <param name="result">The result of each command.</param>
/// <param name="bundle">The extra data.</param>
internal void Response(IntPtr serverHandle, int result, Bundle bundle)
{
if (NeedToResponse == false)
{
throw new InvalidOperationException("The receiver should not call this, if NeedToResponse is false.");
}

try
{
if (bundle != null)
Expand All @@ -114,13 +143,18 @@ internal void Response(IntPtr serverHandle, int result, Bundle bundle)
}

/// <summary>
/// Responses command to the server.
/// Responds to the clients command.
/// </summary>
/// <param name="clientHandle">The client handle.</param>
/// <param name="result">The result of each command.</param>
/// <param name="bundle">The extra data.</param>
internal void Response(NativeClientHandle clientHandle, int result, Bundle bundle)
{
if (NeedToResponse == false)
{
throw new InvalidOperationException("The receiver should not call this, if NeedToResponse is false.");
}

try
{
if (bundle != null)
Expand Down Expand Up @@ -645,7 +679,7 @@ public SearchCommand(MediaControlSearchCondition condition)
NativeClient.CreateSearchHandle(out _searchHandle).ThrowIfError("Failed to create search handle.");

try
{
{
if (condition.Bundle != null)
{
NativeClient.SetSearchConditionBundle(_searchHandle, condition.ContentType, condition.Category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ namespace Tizen.Multimedia.Vision
/// <summary>
/// Provides the ability to recognize face based on previously registered face data.
/// </summary>
/// <feature>http://tizen.org/feature/vision.inference</feature>
/// <feature>http://tizen.org/feature/vision.inference.face_recognition</feature>
/// <feature>http://tizen.org/feature/vision.training</feature>
/// <feature>http://tizen.org/feature/vision.training.face_recognition</feature>
/// <since_tizen> 10 </since_tizen>
public class DeepLearningFaceRecognizer : IDisposable
{
Expand All @@ -34,11 +38,13 @@ public class DeepLearningFaceRecognizer : IDisposable
/// This class is different from <see cref="FaceRecognizer"/> in aspect of using internal machine learning algorithm.
/// </remarks>
/// <exception cref="NotSupportedException">The required features are not supported.</exception>
/// <feature>http://tizen.org/feature/vision.face_recognition</feature>
/// <since_tizen> 10 </since_tizen>
public DeepLearningFaceRecognizer()
{
ValidationUtil.ValidateFeatureSupported(VisionFeatures.FaceRecognition);
ValidationUtil.ValidateFeatureSupported(VisionFeatures.Inference);
ValidationUtil.ValidateFeatureSupported(VisionFeatures.Training);
ValidationUtil.ValidateFeatureSupported(VisionFeatures.InferenceFaceRecognition);
ValidationUtil.ValidateFeatureSupported(VisionFeatures.TrainingFaceRecognition);

InteropFace.Create(out _handle).Validate("Failed to create face recognizer");

Expand Down
14 changes: 10 additions & 4 deletions src/Tizen.Multimedia.Vision/MediaVision/VisionFeatures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ namespace Tizen.Multimedia
{
internal static class VisionFeatures
{
internal const string RoiTracking = "http://tizen.org/feature/vision.roi_tracking";
internal const string InferenceFace = "http://tizen.org/feature/vision.inference.face";
internal const string InferenceImage = "http://tizen.org/feature/vision.inference.image";
internal const string FaceRecognition = "http://tizen.org/feature/vision.face_recognition";
internal const string RoiTracking = "http://tizen.org/feature/vision.roi_tracking";
internal const string FaceRecognition = "http://tizen.org/feature/vision.face_recognition";

internal const string Inference = "http://tizen.org/feature/vision.inference";
internal const string InferenceFace = "http://tizen.org/feature/vision.inference.face";
internal const string InferenceFaceRecognition = "http://tizen.org/feature/vision.inference.face_recognition";
internal const string InferenceImage = "http://tizen.org/feature/vision.inference.image";

internal const string Training = "http://tizen.org/feature/vision.training";
internal const string TrainingFaceRecognition = "http://tizen.org/feature/vision.training.face_recognition";
}
}