From 78acdaa2d0031c559d2db37ea916378e7ef21257 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Tue, 2 Jan 2024 10:17:58 +0900 Subject: [PATCH 1/2] [MediaController] Add new API to check Response request (#5672) * [MediaController] Add new API to check Response request --- .../MediaController/MediaControlCommand.cs | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlCommand.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlCommand.cs index 39ec1528bda..7c4f14cb3ae 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlCommand.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlCommand.cs @@ -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; @@ -59,10 +60,33 @@ internal void SetRequestInformation(string receiverId) /// The request Id for each command. 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."); + } } + /// + /// Indicates if the response is needed. + /// + /// If false, the receiver should not respond to the received command. + /// 12 + public bool IsResponseNeeded => NeedToResponse; + + /// + /// Indicates if the response is needed. + /// + /// + /// This internal API is retained for backward compatibility but is not recommended for new development. + /// Please use instead.
+ /// If false, the receiver should not respond to the received command. + ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public bool NeedToResponse => _requestId != null; + /// /// Requests command to server. /// @@ -83,13 +107,18 @@ internal void SetResponseInformation(string receiverId, string requestId) protected virtual void OnResponseCompleted() { } /// - /// Responses command to the client. + /// Responds to the clients command. /// /// The server handle. /// The result of each command. /// The extra data. 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) @@ -114,13 +143,18 @@ internal void Response(IntPtr serverHandle, int result, Bundle bundle) } /// - /// Responses command to the server. + /// Responds to the clients command. /// /// The client handle. /// The result of each command. /// The extra data. 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) @@ -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, From a1fc51c7a10ebf1c46f4192d79bed97e8252f997 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Tue, 2 Jan 2024 14:55:38 +0900 Subject: [PATCH 2/2] [MediaVision] Change feature key of inference face recognition (#5802) * [MediaVision] Change feature key of inference face recognition --- .../MediaVision/DeepLearningFaceRecognizer.cs | 10 ++++++++-- .../MediaVision/VisionFeatures.cs | 14 ++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Tizen.Multimedia.Vision/MediaVision/DeepLearningFaceRecognizer.cs b/src/Tizen.Multimedia.Vision/MediaVision/DeepLearningFaceRecognizer.cs index 2ee8b0e6a79..0cf02725a51 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/DeepLearningFaceRecognizer.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/DeepLearningFaceRecognizer.cs @@ -23,6 +23,10 @@ namespace Tizen.Multimedia.Vision /// /// Provides the ability to recognize face based on previously registered face data. /// + /// http://tizen.org/feature/vision.inference + /// http://tizen.org/feature/vision.inference.face_recognition + /// http://tizen.org/feature/vision.training + /// http://tizen.org/feature/vision.training.face_recognition /// 10 public class DeepLearningFaceRecognizer : IDisposable { @@ -34,11 +38,13 @@ public class DeepLearningFaceRecognizer : IDisposable /// This class is different from in aspect of using internal machine learning algorithm. /// /// The required features are not supported. - /// http://tizen.org/feature/vision.face_recognition /// 10 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"); diff --git a/src/Tizen.Multimedia.Vision/MediaVision/VisionFeatures.cs b/src/Tizen.Multimedia.Vision/MediaVision/VisionFeatures.cs index 8780c7e48a3..da6bf66d64d 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/VisionFeatures.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/VisionFeatures.cs @@ -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"; } }