[MediaController] Add the result code for Response and playback state enum (#1782)
authorhsgwon <haesu.gwon@samsung.com>
Thu, 9 Jul 2020 04:51:29 +0000 (13:51 +0900)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2020 04:51:29 +0000 (13:51 +0900)
* [MediaController] Add the result code for Response and playback state enum

src/Tizen.Multimedia.Remoting/MediaController/InternalEnums.cs
src/Tizen.Multimedia.Remoting/MediaController/MediaControlEnums.cs
src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs
src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs

index df5aa6b..1ce95d7 100644 (file)
@@ -30,7 +30,10 @@ namespace Tizen.Multimedia.Remoting
         MovingToNext,   // Since 4.0
         MovingToPrev,   // Since 4.0
         FastForwarding, // Since 4.0
-        Rewinding       // Since 4.0
+        Rewinding,      // Since 4.0
+        Connecting,     // Since 6.0(API8)
+        Buffering,      // Since 6.0(API8)
+        Error           // Since 6.0(API8)
     }
 
     internal enum MediaControllerNativePlaybackAction
index 1d84f55..b066a65 100644 (file)
@@ -155,6 +155,24 @@ namespace Tizen.Multimedia.Remoting
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
         MovingToPrevious,
+
+        /// <summary>
+        /// Connecting.
+        /// </summary>
+        /// <since_tizen> 8 </since_tizen>
+        Connecting,
+
+        /// <summary>
+        /// Buffering.
+        /// </summary>
+        /// <since_tizen> 8 </since_tizen>
+        Buffering,
+
+        /// <summary>
+        /// Error while playback.
+        /// </summary>
+        /// <since_tizen> 8 </since_tizen>
+        Error
     }
 
     /// <summary>
@@ -276,6 +294,88 @@ namespace Tizen.Multimedia.Remoting
         CroppedFull
     }
 
+    /// <summary>
+    /// Specifies the code which represents the result of commnunication between client and server.
+    /// </summary>
+    /// <since_tizen> 8 </since_tizen>
+    public enum MediaControlResult
+    {
+        /// <summary>
+        /// The command or the event has been successfully completed.
+        /// </summary>
+        Success,
+
+        /// <summary>
+        /// The command or the event had already been completed.
+        /// </summary>
+        AlreadyDone = 200,
+
+        /// <summary>
+        /// The command or the event is aborted by some external event (e.g. aborted play command by incoming call).
+        /// </summary>
+        Aborted = 300,
+
+        /// <summary>
+        /// The command or the event is denied due to application policy (e.g. cannot rewind in recording).
+        /// </summary>
+        ActionDenied,
+
+        /// <summary>
+        /// The command or the event is not supported.
+        /// </summary>
+        NotSupported,
+
+        /// <summary>
+        /// The command or the event is out of supported range or the limit is reached.
+        /// </summary>
+        Invalid,
+
+        /// <summary>
+        /// Timeout has occurred.
+        /// </summary>
+        Timeout = 400,
+
+        /// <summary>
+        /// The application has failed.
+        /// </summary>
+        ApplicationFailed,
+
+        /// <summary>
+        /// The command or the event has failed because the application has no media.
+        /// </summary>
+        NoMedia,
+
+        /// <summary>
+        /// The command or the event has failed because there is no audio output device.
+        /// </summary>
+        NoAudioOutputDevice,
+
+        /// <summary>
+        /// The command or the event has failed because there is no peer.
+        /// </summary>
+        NoPeer,
+
+        /// <summary>
+        /// The network has failed.
+        /// </summary>
+        NetworkFailed = 500,
+
+        /// <summary>
+        /// The application does not have account.
+        /// </summary>
+        NoAccount = 600,
+
+        /// <summary>
+        /// The application could not log in.
+        /// </summary>
+        LoginFailed,
+
+        /// <summary>
+        /// Unknown error.
+        /// </summary>
+        Unknown = Int32.MaxValue
+    }
+
     internal static class EnumExtensions
     {
         internal static MediaControlPlaybackState ToPublic(this MediaControllerNativePlaybackState nativeState)
@@ -294,6 +394,9 @@ namespace Tizen.Multimedia.Remoting
                 case MediaControllerNativePlaybackState.FastForwarding: return MediaControlPlaybackState.FastForwarding;
                 case MediaControllerNativePlaybackState.Rewind:
                 case MediaControllerNativePlaybackState.Rewinding: return MediaControlPlaybackState.Rewinding;
+                case MediaControllerNativePlaybackState.Connecting: return MediaControlPlaybackState.Connecting;
+                case MediaControllerNativePlaybackState.Buffering: return MediaControlPlaybackState.Buffering;
+                case MediaControllerNativePlaybackState.Error: return MediaControlPlaybackState.Error;
             }
 
             Debug.Fail($"Not supported code for playback state{nativeState}.");
@@ -311,6 +414,9 @@ namespace Tizen.Multimedia.Remoting
                 case MediaControlPlaybackState.MovingToPrevious: return MediaControllerNativePlaybackState.MovingToPrev;
                 case MediaControlPlaybackState.FastForwarding: return MediaControllerNativePlaybackState.FastForwarding;
                 case MediaControlPlaybackState.Rewinding: return MediaControllerNativePlaybackState.Rewinding;
+                case MediaControlPlaybackState.Connecting: return MediaControllerNativePlaybackState.Connecting;
+                case MediaControlPlaybackState.Buffering: return MediaControllerNativePlaybackState.Buffering;
+                case MediaControlPlaybackState.Error: return MediaControllerNativePlaybackState.Error;
             }
             return MediaControllerNativePlaybackState.None;
         }
index d182e63..5d3aa48 100644 (file)
@@ -863,12 +863,42 @@ namespace Tizen.Multimedia.Remoting
         /// <since_tizen> 5 </since_tizen>
         public static void Response(Command command, int result)
         {
-            if (command == null)
-            {
-                throw new ArgumentNullException(nameof(command));
-            }
+            Response(command, result, null);
+        }
+
+        /// <summary>
+        /// Sends the result of each command.
+        /// </summary>
+        /// <param name="command">The command that return to client.</param>
+        /// <param name="result">The <see cref="MediaControlResult"/> of <paramref name="command"/>.</param>
+        /// <param name="bundle">The extra data.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .<br/>
+        ///     -or-<br/>
+        ///     An internal error occurs.
+        /// </exception>
+        /// <since_tizen> 8 </since_tizen>
+        public static void Response(Command command, MediaControlResult result, Bundle bundle)
+        {
+            Response(command, (int)result, bundle);
+        }
 
-            command.Response(Handle, result, null);
+        /// <summary>
+        /// Sends the result of each command.
+        /// </summary>
+        /// <param name="command">The command that return to client.</param>
+        /// <param name="result">The <see cref="MediaControlResult"/> of <paramref name="command"/>.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .<br/>
+        ///     -or-<br/>
+        ///     An internal error occurs.
+        /// </exception>
+        /// <since_tizen> 8 </since_tizen>
+        public static void Response(Command command, MediaControlResult result)
+        {
+            Response(command, (int)result, null);
         }
         #endregion Command
     }
index 4ae9477..dbb8f64 100644 (file)
@@ -825,12 +825,42 @@ namespace Tizen.Multimedia.Remoting
         /// <since_tizen> 5 </since_tizen>
         public void Response(Command command, int result)
         {
-            if (command == null)
-            {
-                throw new ArgumentNullException(nameof(command));
-            }
+            Response(command, result, null);
+        }
+
+        /// <summary>
+        /// Sends the result of each command.
+        /// </summary>
+        /// <param name="command">The command that return to client.</param>
+        /// <param name="result">The <see cref="MediaControlResult"/> of <paramref name="command"/>.</param>
+        /// <param name="bundle">The extra data.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .<br/>
+        ///     -or-<br/>
+        ///     An internal error occurs.
+        /// </exception>
+        /// <since_tizen> 8 </since_tizen>
+        public void Response(Command command, MediaControlResult result, Bundle bundle)
+        {
+            Response(command, (int)result, bundle);
+        }
 
-            command.Response(Manager.Handle, result, null);
+        /// <summary>
+        /// Sends the result of each command.
+        /// </summary>
+        /// <param name="command">The command that return to client.</param>
+        /// <param name="result">The <see cref="MediaControlResult"/> of <paramref name="command"/>.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .<br/>
+        ///     -or-<br/>
+        ///     An internal error occurs.
+        /// </exception>
+        /// <since_tizen> 8 </since_tizen>
+        public void Response(Command command, MediaControlResult result)
+        {
+            Response(command, (int)result, null);
         }
 
         /// <summary>