[Multimedia] MediaController API redesign. 30/146430/4
authorcoderhyme <jhyo.kim@samsung.com>
Mon, 28 Aug 2017 13:01:55 +0000 (22:01 +0900)
committercoderhyme <jhyo.kim@samsung.com>
Wed, 30 Aug 2017 04:25:21 +0000 (13:25 +0900)
Change-Id: Ic4956f45fe328102430073642fbaad1cbd107705
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
33 files changed:
src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs [deleted file]
src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerClient.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/EnumExtensions.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/InternalEnums.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControlMetadata.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaybackCommand.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaybackState.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControlServerStartedEventArgs.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControlServerStoppedEventArgs.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerError.cs
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerManager.Events.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerManager.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerRepeatMode.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/MetadataUpdatedEventArgs.cs
src/Tizen.Multimedia.Remoting/MediaController/PlaybackCommandReceivedEventArgs.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateUpdatedEventArgs.cs [new file with mode: 0644]
src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/RepeatModeUpdatedEventArgs.cs
src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs [deleted file]
src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeUpdatedEventArgs.cs

diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs
deleted file mode 100644 (file)
index 7efbf0a..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.Runtime.InteropServices;
-using Tizen.Applications;
-using Tizen.Multimedia;
-using Tizen.Multimedia.MediaController;
-
-internal static partial class Interop
-{
-    internal static partial class MediaControllerClient
-    {
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void ServerUpdatedCallback(IntPtr serverName, MediaControllerServerState serverState, IntPtr userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void PlaybackUpdatedCallback(IntPtr serverName, IntPtr playback, IntPtr userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void MetadataUpdatedCallback(IntPtr serverName, IntPtr metadata, IntPtr userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void ShuffleModeUpdatedCallback(IntPtr serverName, MediaControllerShuffleMode shuffleMode, IntPtr userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void RepeatModeUpdatedCallback(IntPtr serverName, MediaControllerRepeatMode repeatMode, IntPtr userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void CommandReplyRecievedCallback(IntPtr serverName, int result, IntPtr bundle, IntPtr userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate bool SubscribedServerCallback(IntPtr serverName, IntPtr userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate bool ActivatedServerCallback(IntPtr serverName, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_create")]
-        internal static extern MediaControllerError Create(out IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy")]
-        internal static extern MediaControllerError Destroy(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_server_update_cb")]
-        internal static extern MediaControllerError SetServerUpdatedCb(IntPtr handle, ServerUpdatedCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_server_update_cb")]
-        internal static extern MediaControllerError UnsetServerUpdatedCb(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_playback_update_cb")]
-        internal static extern MediaControllerError SetPlaybackUpdatedCb(IntPtr handle, PlaybackUpdatedCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_playback_update_cb")]
-        internal static extern MediaControllerError UnsetPlaybackUpdatedCb(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_metadata_update_cb")]
-        internal static extern MediaControllerError SetMetadataUpdatedCb(IntPtr handle, MetadataUpdatedCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_metadata_update_cb")]
-        internal static extern MediaControllerError UnsetMetadataUpdatedCb(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_shuffle_mode_update_cb")]
-        internal static extern MediaControllerError SetShuffleModeUpdatedCb(IntPtr handle, ShuffleModeUpdatedCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_shuffle_mode_update_cb")]
-        internal static extern MediaControllerError UnsetShuffleModeUpdatedCb(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_repeat_mode_update_cb")]
-        internal static extern MediaControllerError SetRepeatModeUpdatedCb(IntPtr handle, RepeatModeUpdatedCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_repeat_mode_update_cb")]
-        internal static extern MediaControllerError UnsetRepeatModeUpdatedCb(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_subscribe")]
-        internal static extern MediaControllerError Subscribe(IntPtr handle, MediaControllerSubscriptionType subscriptionType, string serverName);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unsubscribe")]
-        internal static extern MediaControllerError Unsubscribe(IntPtr handle, MediaControllerSubscriptionType subscriptionType, string serverName);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_state")]
-        internal static extern MediaControllerError GetPlaybackState(IntPtr playback, out MediaControllerPlaybackState state);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_position")]
-        internal static extern MediaControllerError GetPlaybackPosition(IntPtr playback, out ulong position);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_playback")]
-        internal static extern MediaControllerError DestroyPlayback(IntPtr playback);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_metadata")]
-        private static extern MediaControllerError GetMetadata(IntPtr metadata, MediaControllerAttributes attribute, out IntPtr value);
-
-        internal static string GetMetadata(IntPtr handle, MediaControllerAttributes attr)
-        {
-            IntPtr valuePtr = IntPtr.Zero;
-
-            try
-            {
-                var ret = GetMetadata(handle, attr, out valuePtr);
-                MediaControllerValidator.ThrowIfError(ret, "Failed to get value for " + attr);
-                return Marshal.PtrToStringAnsi(valuePtr);
-            }
-            finally
-            {
-                LibcSupport.Free(valuePtr);
-            }
-        }
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_metadata")]
-        internal static extern MediaControllerError DestroyMetadata(IntPtr metadata);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_latest_server_info")]
-        internal static extern MediaControllerError GetLatestServer(IntPtr handle, out IntPtr serverName, out MediaControllerServerState serverState);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_playback_info")]
-        internal static extern MediaControllerError GetServerPlayback(IntPtr handle, string serverName, out IntPtr playback);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_metadata")]
-        internal static extern MediaControllerError GetServerMetadata(IntPtr handle, string serverName, out IntPtr metadata);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_shuffle_mode")]
-        internal static extern MediaControllerError GetServerShuffleMode(IntPtr handle, string serverName, out MediaControllerShuffleMode mode);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_repeat_mode")]
-        internal static extern MediaControllerError GetServerRepeatMode(IntPtr handle, string serverName, out MediaControllerRepeatMode mode);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_playback_state_command")]
-        internal static extern MediaControllerError SendPlaybackStateCommand(IntPtr handle, string serverName, MediaControllerPlaybackState state);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_custom_command")]
-        internal static extern MediaControllerError SendCustomCommand(IntPtr handle, string serverName, string command, SafeBundleHandle bundle, CommandReplyRecievedCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server_subscribed")]
-        internal static extern MediaControllerError ForeachSubscribedServer(IntPtr handle, MediaControllerSubscriptionType subscriptionType, SubscribedServerCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server")]
-        internal static extern MediaControllerError ForeachActivatedServer(IntPtr handle, ActivatedServerCallback callback, IntPtr userData);
-    }
-
-    internal static partial class MediaControllerServer
-    {
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void PlaybackStateCommandRecievedCallback(IntPtr clientName, MediaControllerPlaybackState state, IntPtr userData);
-
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        internal delegate void CustomCommandRecievedCallback(IntPtr clientName, IntPtr command, IntPtr bundle, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create")]
-        internal static extern MediaControllerError Create(out IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_destroy")]
-        internal static extern MediaControllerError Destroy(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state")]
-        internal static extern MediaControllerError SetPlaybackState(IntPtr handle, MediaControllerPlaybackState state);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_position")]
-        internal static extern MediaControllerError SetPlaybackPosition(IntPtr handle, ulong position);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playback_info")]
-        internal static extern MediaControllerError UpdatePlayback(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_metadata")]
-        internal static extern MediaControllerError SetMetadata(IntPtr handle, MediaControllerAttributes attribute, string value);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_metadata")]
-        internal static extern MediaControllerError UpdateMetadata(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_shuffle_mode")]
-        internal static extern MediaControllerError UpdateShuffleMode(IntPtr handle, MediaControllerShuffleMode mode);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_repeat_mode")]
-        internal static extern MediaControllerError UpdateRepeatMode(IntPtr handle, MediaControllerRepeatMode mode);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state_command_received_cb")]
-        internal static extern MediaControllerError SetPlaybackStateCmdRecvCb(IntPtr handle, PlaybackStateCommandRecievedCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playback_state_command_received_cb")]
-        internal static extern MediaControllerError UnsetPlaybackStateCmdRecvCb(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_custom_command_received_cb")]
-        internal static extern MediaControllerError SetCustomCmdRecvCb(IntPtr handle, CustomCommandRecievedCallback callback, IntPtr userData);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_custom_command_received_cb")]
-        internal static extern MediaControllerError UnsetCustomCmdRecvCb(IntPtr handle);
-
-        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_command_reply")]
-        internal static extern MediaControllerError SendCommandReply(IntPtr handle, string clientName, int result, SafeBundleHandle bundle);
-    }
-}
diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerClient.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerClient.cs
new file mode 100644 (file)
index 0000000..2029564
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Multimedia.Remoting;
+
+internal static partial class Interop
+{
+    internal static partial class MediaControllerClient
+    {
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        internal delegate void ServerUpdatedCallback(string serverName, MediaControllerServerState serverState,
+            IntPtr userData);
+
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        internal delegate void PlaybackUpdatedCallback(string serverName, IntPtr playback, IntPtr userData);
+
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        internal delegate void MetadataUpdatedCallback(string serverName, IntPtr metadata, IntPtr userData);
+
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        internal delegate void ShuffleModeUpdatedCallback(string serverName, MediaControllerShuffleMode shuffleMode,
+            IntPtr userData);
+
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        internal delegate void RepeatModeUpdatedCallback(string serverName, NativeRepeatMode repeatMode, IntPtr userData);
+
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        internal delegate bool ActivatedServerCallback(string serverName, IntPtr userData);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_create")]
+        internal static extern MediaControllerError Create(out MediaControllerClientHandle handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy")]
+        internal static extern MediaControllerError Destroy(IntPtr handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_server_update_cb")]
+        internal static extern MediaControllerError SetServerUpdatedCb(MediaControllerClientHandle handle,
+            ServerUpdatedCallback callback, IntPtr userData = default(IntPtr));
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_server_update_cb")]
+        internal static extern MediaControllerError UnsetServerUpdatedCb(MediaControllerClientHandle handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_playback_update_cb")]
+        internal static extern MediaControllerError SetPlaybackUpdatedCb(MediaControllerClientHandle handle,
+            PlaybackUpdatedCallback callback, IntPtr userData = default(IntPtr));
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_playback_update_cb")]
+        internal static extern MediaControllerError UnsetPlaybackUpdatedCb(MediaControllerClientHandle handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_metadata_update_cb")]
+        internal static extern MediaControllerError SetMetadataUpdatedCb(MediaControllerClientHandle handle,
+            MetadataUpdatedCallback callback, IntPtr userData = default(IntPtr));
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_metadata_update_cb")]
+        internal static extern MediaControllerError UnsetMetadataUpdatedCb(MediaControllerClientHandle handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_shuffle_mode_update_cb")]
+        internal static extern MediaControllerError SetShuffleModeUpdatedCb(MediaControllerClientHandle handle,
+            ShuffleModeUpdatedCallback callback, IntPtr userData = default(IntPtr));
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_shuffle_mode_update_cb")]
+        internal static extern MediaControllerError UnsetShuffleModeUpdatedCb(MediaControllerClientHandle handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_repeat_mode_update_cb")]
+        internal static extern MediaControllerError SetRepeatModeUpdatedCb(MediaControllerClientHandle handle,
+            RepeatModeUpdatedCallback callback, IntPtr userData = default(IntPtr));
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_repeat_mode_update_cb")]
+        internal static extern MediaControllerError UnsetRepeatModeUpdatedCb(MediaControllerClientHandle handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_state")]
+        internal static extern MediaControllerError GetPlaybackState(IntPtr playback, out MediaControllerPlaybackCode state);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_position")]
+        internal static extern MediaControllerError GetPlaybackPosition(IntPtr playback, out ulong position);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_playback")]
+        internal static extern MediaControllerError DestroyPlayback(IntPtr playback);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_metadata")]
+        private static extern MediaControllerError GetMetadata(IntPtr metadata, MediaControllerAttribute attribute,
+            out IntPtr value);
+
+        internal static string GetMetadata(IntPtr handle, MediaControllerAttribute attr)
+        {
+            IntPtr valuePtr = IntPtr.Zero;
+
+            try
+            {
+                GetMetadata(handle, attr, out valuePtr).ThrowIfError($"Failed to get value for {attr}.");
+                return Marshal.PtrToStringAnsi(valuePtr);
+            }
+            finally
+            {
+                Tizen.Multimedia.LibcSupport.Free(valuePtr);
+            }
+        }
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_metadata")]
+        internal static extern MediaControllerError DestroyMetadata(IntPtr metadata);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_latest_server_info")]
+        internal static extern MediaControllerError GetLatestServer(MediaControllerClientHandle handle,
+            out IntPtr serverName, out MediaControllerServerState serverState);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_playback_info")]
+        internal static extern MediaControllerError GetServerPlayback(MediaControllerClientHandle handle,
+            string serverName, out IntPtr playback);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_metadata")]
+        internal static extern MediaControllerError GetServerMetadata(MediaControllerClientHandle handle,
+            string serverName, out IntPtr metadata);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_shuffle_mode")]
+        internal static extern MediaControllerError GetServerShuffleMode(MediaControllerClientHandle handle,
+            string serverName, out MediaControllerShuffleMode mode);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_repeat_mode")]
+        internal static extern MediaControllerError GetServerRepeatMode(MediaControllerClientHandle handle,
+            string serverName, out NativeRepeatMode mode);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_playback_state_command")]
+        internal static extern MediaControllerError SendPlaybackStateCommand(MediaControllerClientHandle handle,
+            string serverName, MediaControllerPlaybackCode command);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server")]
+        internal static extern MediaControllerError ForeachActivatedServer(MediaControllerClientHandle handle,
+            ActivatedServerCallback callback, IntPtr userData);
+    }
+
+    internal class MediaControllerClientHandle : SafeHandle
+    {
+        protected MediaControllerClientHandle() : base(IntPtr.Zero, true)
+        {
+        }
+
+        public override bool IsInvalid => handle == IntPtr.Zero;
+
+        protected override bool ReleaseHandle()
+        {
+            var ret = MediaControllerClient.Destroy(handle);
+            if (ret != MediaControllerError.None)
+            {
+                Tizen.Log.Debug(GetType().FullName, $"Failed to release native {GetType().Name}");
+                return false;
+            }
+
+            return true;
+        }
+    }
+}
diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs
new file mode 100644 (file)
index 0000000..6fe514d
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Multimedia.Remoting;
+
+internal static partial class Interop
+{
+    internal static partial class MediaControllerServer
+    {
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        internal delegate void PlaybackStateCommandReceivedCallback(string clientName,
+            MediaControllerPlaybackCode state, IntPtr userData);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create")]
+        internal static extern MediaControllerError Create(out IntPtr handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_destroy")]
+        internal static extern MediaControllerError Destroy(IntPtr handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state")]
+        internal static extern MediaControllerError SetPlaybackState(IntPtr handle,
+            MediaControllerPlaybackCode state);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_position")]
+        internal static extern MediaControllerError SetPlaybackPosition(IntPtr handle, ulong position);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playback_info")]
+        internal static extern MediaControllerError UpdatePlayback(IntPtr handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_metadata")]
+        internal static extern MediaControllerError SetMetadata(IntPtr handle,
+            MediaControllerAttribute attribute, string value);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_metadata")]
+        internal static extern MediaControllerError UpdateMetadata(IntPtr handle);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_shuffle_mode")]
+        internal static extern MediaControllerError UpdateShuffleMode(IntPtr handle,
+            MediaControllerShuffleMode mode);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_repeat_mode")]
+        internal static extern MediaControllerError UpdateRepeatMode(IntPtr handle, NativeRepeatMode mode);
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state_command_received_cb")]
+        internal static extern MediaControllerError SetPlaybackStateCmdRecvCb(IntPtr handle,
+            PlaybackStateCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
+
+        [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playback_state_command_received_cb")]
+        internal static extern MediaControllerError UnsetPlaybackStateCmdRecvCb(IntPtr handle);
+    }
+}
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs
deleted file mode 100755 (executable)
index a485e3f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-using Tizen.Applications;
-
-namespace Tizen.Multimedia.MediaController
-{
-
-    /// <summary>
-    /// CustomCommandRecieved event arguments
-    /// </summary>
-    /// <remarks>
-    /// CustomCommandRecieved event arguments
-    /// </remarks>
-    public class CustomCommandEventArgs : EventArgs
-    {
-        internal CustomCommandEventArgs(string name, string command, Bundle bundle)
-        {
-            ClientName = name;
-            Command = command;
-            BundleData = bundle;
-        }
-
-        /// <summary>
-        /// Get the Client Name.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string ClientName { get; }
-
-        /// <summary>
-        /// Get the Custom Command.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Command { get; }
-
-        /// <summary>
-        /// Get the Bundle Data.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public Bundle BundleData { get; }
-    }
-}
-
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs
deleted file mode 100755 (executable)
index e7bac0e..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-using Tizen.Applications;
-
-namespace Tizen.Multimedia.MediaController
-{
-
-    /// <summary>
-    /// CustomCommandRecieved event arguments
-    /// </summary>
-    /// <remarks>
-    /// CustomCommandRecieved event arguments
-    /// </remarks>
-    public class CustomCommandReplyEventArgs : EventArgs
-    {
-        internal CustomCommandReplyEventArgs(string serverName, int result, Bundle bundle)
-        {
-            ServerName = serverName;
-            Result = result;
-            BundleData = bundle;
-        }
-
-        /// <summary>
-        /// Get the Sserver Name.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string ServerName { get; }
-
-        /// <summary>
-        /// Get the Result.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public int Result { get; }
-
-        /// <summary>
-        /// Get the Bundle Data.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public Bundle BundleData { get; }
-    }
-}
-
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/EnumExtensions.cs b/src/Tizen.Multimedia.Remoting/MediaController/EnumExtensions.cs
new file mode 100644 (file)
index 0000000..d49135e
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Diagnostics;
+
+namespace Tizen.Multimedia.Remoting
+{
+    internal static class EnumExtensions
+    {
+        internal static MediaControlPlaybackState ToState(this MediaControllerPlaybackCode code)
+        {
+            switch (code)
+            {
+                case MediaControllerPlaybackCode.None: return MediaControlPlaybackState.None;
+                case MediaControllerPlaybackCode.Play: return MediaControlPlaybackState.Playing;
+                case MediaControllerPlaybackCode.Pause: return MediaControlPlaybackState.Paused;
+                case MediaControllerPlaybackCode.Stop: return MediaControlPlaybackState.Stopped;
+                case MediaControllerPlaybackCode.FastForward: return MediaControlPlaybackState.FastForwarding;
+                case MediaControllerPlaybackCode.Rewind: return MediaControlPlaybackState.Rewinding;
+            }
+
+            Debug.Fail($"Not supported code for playback state{code}.");
+            return MediaControlPlaybackState.None;
+        }
+
+        internal static MediaControllerPlaybackCode ToCode(this MediaControlPlaybackState state)
+        {
+            switch (state)
+            {
+                case MediaControlPlaybackState.Playing: return MediaControllerPlaybackCode.Play;
+                case MediaControlPlaybackState.Paused: return MediaControllerPlaybackCode.Pause;
+                case MediaControlPlaybackState.Stopped: return MediaControllerPlaybackCode.Stop;
+                case MediaControlPlaybackState.FastForwarding: return MediaControllerPlaybackCode.FastForward;
+                case MediaControlPlaybackState.Rewinding: return MediaControllerPlaybackCode.Rewind;
+            }
+            return MediaControllerPlaybackCode.None;
+        }
+
+        internal static MediaControlPlaybackCommand ToCommand(this MediaControllerPlaybackCode code)
+        {
+            switch (code)
+            {
+                case MediaControllerPlaybackCode.Play: return MediaControlPlaybackCommand.Play;
+                case MediaControllerPlaybackCode.Pause: return MediaControlPlaybackCommand.Pause;
+                case MediaControllerPlaybackCode.Stop: return MediaControlPlaybackCommand.Stop;
+                case MediaControllerPlaybackCode.Next: return MediaControlPlaybackCommand.Next;
+                case MediaControllerPlaybackCode.Prev: return MediaControlPlaybackCommand.Previous;
+                case MediaControllerPlaybackCode.FastForward: return MediaControlPlaybackCommand.FastForward;
+                case MediaControllerPlaybackCode.Rewind: return MediaControlPlaybackCommand.Rewind;
+            }
+
+            Debug.Fail($"Not supported code for playback command{code}.");
+            return MediaControlPlaybackCommand.Play;
+        }
+
+        internal static MediaControllerPlaybackCode ToCode(this MediaControlPlaybackCommand command)
+        {
+            switch (command)
+            {
+                case MediaControlPlaybackCommand.Play: return MediaControllerPlaybackCode.Play;
+                case MediaControlPlaybackCommand.Pause: return MediaControllerPlaybackCode.Pause;
+                case MediaControlPlaybackCommand.Stop: return MediaControllerPlaybackCode.Stop;
+                case MediaControlPlaybackCommand.Next: return MediaControllerPlaybackCode.Next;
+                case MediaControlPlaybackCommand.Previous: return MediaControllerPlaybackCode.Prev;
+                case MediaControlPlaybackCommand.FastForward: return MediaControllerPlaybackCode.FastForward;
+                case MediaControlPlaybackCommand.Rewind: return MediaControllerPlaybackCode.Rewind;
+            }
+            return MediaControllerPlaybackCode.Play;
+        }
+
+        internal static NativeRepeatMode ToNative(this MediaControlRepeatMode mode)
+        {
+            Debug.Assert(Enum.IsDefined(typeof(MediaControlRepeatMode), mode));
+
+            return mode == MediaControlRepeatMode.Off ? NativeRepeatMode.On : NativeRepeatMode.Off;
+        }
+
+        internal static MediaControlRepeatMode ToPublic(this NativeRepeatMode mode)
+        {
+            Debug.Assert(Enum.IsDefined(typeof(NativeRepeatMode), mode));
+
+            return mode == NativeRepeatMode.Off ? MediaControlRepeatMode.On : MediaControlRepeatMode.Off;
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/InternalEnums.cs b/src/Tizen.Multimedia.Remoting/MediaController/InternalEnums.cs
new file mode 100644 (file)
index 0000000..b25c43b
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.Diagnostics;
+
+namespace Tizen.Multimedia.Remoting
+{
+    internal enum MediaControllerPlaybackCode
+    {
+        None,
+        Play,
+        Pause,
+        Stop,
+        Next,
+        Prev,
+        FastForward,
+        Rewind,
+    }
+
+    internal enum MediaControllerServerState
+    {
+        None,
+        Activated,
+        Deactivated,
+    }
+
+    internal enum MediaControllerShuffleMode
+    {
+        On,
+        Off,
+    }
+
+    internal enum NativeRepeatMode
+    {
+        On,
+        Off,
+    }
+
+    internal enum MediaControllerAttribute
+    {
+        Title,
+        Artist,
+        Album,
+        Author,
+        Genre,
+        Duration,
+        Date,
+        Copyright,
+        Description,
+        TrackNumber,
+        Picture,
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlMetadata.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlMetadata.cs
new file mode 100644 (file)
index 0000000..8ec676d
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Diagnostics;
+using Native = Interop.MediaControllerClient;
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Represents metadata for media control.
+    /// </summary>
+    public class MediaControlMetadata
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="MediaControlMetadata"/> class.
+        /// </summary>
+        public MediaControlMetadata()
+        {
+        }
+
+        internal MediaControlMetadata(IntPtr handle)
+        {
+            Debug.Assert(handle != IntPtr.Zero);
+
+            Title = Native.GetMetadata(handle, MediaControllerAttribute.Title);
+            Artist = Native.GetMetadata(handle, MediaControllerAttribute.Artist);
+            Album = Native.GetMetadata(handle, MediaControllerAttribute.Album);
+            Author = Native.GetMetadata(handle, MediaControllerAttribute.Author);
+            Genre = Native.GetMetadata(handle, MediaControllerAttribute.Genre);
+            Duration = Native.GetMetadata(handle, MediaControllerAttribute.Duration);
+            Date = Native.GetMetadata(handle, MediaControllerAttribute.Date);
+            Copyright = Native.GetMetadata(handle, MediaControllerAttribute.Copyright);
+            Description = Native.GetMetadata(handle, MediaControllerAttribute.Description);
+            TrackNumber = Native.GetMetadata(handle, MediaControllerAttribute.TrackNumber);
+            AlbumArtPath = Native.GetMetadata(handle, MediaControllerAttribute.Picture);
+        }
+
+        /// <summary>
+        /// Gets or sets the title.
+        /// </summary>
+        public string Title { get; set; }
+
+        /// <summary>
+        /// Gets or sets the artist.
+        /// </summary>
+        public string Artist { get; set; }
+
+        /// <summary>
+        /// Gets or sets the album.
+        /// </summary>
+        public string Album { get; set; }
+
+        /// <summary>
+        /// Gets or sets the author.
+        /// </summary>
+        public string Author { get; set; }
+
+        /// <summary>
+        /// Gets or sets the genre.
+        /// </summary>
+        public string Genre { get; set; }
+
+        /// <summary>
+        /// Gets or sets the duration.
+        /// </summary>
+        public string Duration { get; set; }
+
+        /// <summary>
+        /// Gets or sets the date.
+        /// </summary>
+        public string Date { get; set; }
+
+        /// <summary>
+        /// Gets or sets the copyright.
+        /// </summary>
+        public string Copyright { get; set; }
+
+        /// <summary>
+        /// Gets or sets the description.
+        /// </summary>
+        public string Description { get; set; }
+
+        /// <summary>
+        /// Gets or sets the track number.
+        /// </summary>
+        public string TrackNumber { get; set; }
+
+        /// <summary>
+        /// Gets or sets the path of the album art.
+        /// </summary>
+        public string AlbumArtPath { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaybackCommand.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaybackCommand.cs
new file mode 100644 (file)
index 0000000..664eb19
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Specifies playback commands.
+    /// </summary>
+    public enum MediaControlPlaybackCommand
+    {
+        /// <summary>
+        /// Play.
+        /// </summary>
+        Play,
+
+        /// <summary>
+        /// Pause.
+        /// </summary>
+        Pause,
+
+        /// <summary>
+        /// Stop.
+        /// </summary>
+        Stop,
+
+        /// <summary>
+        /// Skip to next.
+        /// </summary>
+        Next,
+
+        /// <summary>
+        /// Skip to previous.
+        /// </summary>
+        Previous,
+
+        /// <summary>
+        /// Fast forward.
+        /// </summary>
+        FastForward,
+
+        /// <summary>
+        /// Rewind.
+        /// </summary>
+        Rewind,
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaybackState.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaybackState.cs
new file mode 100644 (file)
index 0000000..e1f3fc1
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Specifies playback states.
+    /// </summary>
+    public enum MediaControlPlaybackState
+    {
+        /// <summary>
+        /// Unknown; no state is set.
+        /// </summary>
+        None,
+
+        /// <summary>
+        /// Playing.
+        /// </summary>
+        Playing,
+
+        /// <summary>
+        /// Paused.
+        /// </summary>
+        Paused,
+
+        /// <summary>
+        /// Stopped.
+        /// </summary>
+        Stopped,
+
+        /// <summary>
+        /// Fast forwarding.
+        /// </summary>
+        FastForwarding,
+
+        /// <summary>
+        /// Rewinding.
+        /// </summary>
+        Rewinding,
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs
new file mode 100644 (file)
index 0000000..f4fcdf2
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Native = Interop.MediaControllerServer;
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Provides a means to set playback information and metadata and receive commands from clients.
+    /// </summary>
+    /// <seealso cref="MediaControllerManager"/>
+    /// <seealso cref="MediaController"/>
+    public static class MediaControlServer
+    {
+        private static IntPtr _handle = IntPtr.Zero;
+
+        /// <summary>
+        /// Gets a value indicating whether the server is running.
+        /// </summary>
+        /// <value>true if the server has started; otherwise, false.</value>
+        /// <seealso cref="Start"/>
+        /// <seealso cref="Stop"/>
+        public static bool IsRunning
+        {
+            get => _handle != IntPtr.Zero;
+        }
+
+        private static void ThrowIfNotRunning()
+        {
+            if (IsRunning == false)
+            {
+                throw new InvalidOperationException("The server is not running.");
+            }
+        }
+
+        private static IntPtr Handle
+        {
+            get
+            {
+                ThrowIfNotRunning();
+
+                return _handle;
+            }
+        }
+
+        /// <summary>
+        /// Starts the media control server.
+        /// </summary>
+        /// <remarks>
+        /// When the server starts, <see cref="MediaControllerManager.ServerStarted"/> will be raised.
+        /// </remarks>
+        /// <privilege>http://tizen.org/privilege/mediacontroller.server</privilege>
+        /// <exception cref="InvalidOperationException">
+        ///     The server has already started.\n
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege.</exception>
+        /// <seealso cref="MediaControllerManager.ServerStarted"/>
+        public static void Start()
+        {
+            if (IsRunning)
+            {
+                throw new InvalidOperationException("The server is already running.");
+            }
+
+            Native.Create(out _handle).ThrowIfError("Failed to create media controller server.");
+
+            try
+            {
+                RegisterPlaybackCommandReceivedEvent();
+            }
+            catch
+            {
+                Native.Destroy(_handle);
+                _playbackCommandCallback = null;
+                _handle = IntPtr.Zero;
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// Stops the media control server.
+        /// </summary>
+        /// <remarks>
+        /// When the server stops, <see cref="MediaControllerManager.ServerStopped"/> will be raised.
+        /// </remarks>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .\n
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <seealso cref="MediaControllerManager.ServerStopped"/>
+        public static void Stop()
+        {
+            ThrowIfNotRunning();
+
+            Native.Destroy(_handle).ThrowIfError("Failed to stop the server.");
+
+            _handle = IntPtr.Zero;
+            _playbackCommandCallback = null;
+        }
+
+        /// <summary>
+        /// Updates playback state and playback position.</summary>
+        /// <param name="state">The playback state.</param>
+        /// <param name="position">The playback position in milliseconds.</param>
+        /// <exception cref="ArgumentException"><paramref name="state"/> is not valid.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="position"/> is less than zero.</exception>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .\n
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        public static void SetPlaybackState(MediaControlPlaybackState state, long position)
+        {
+            ValidationUtil.ValidateEnum(typeof(MediaControlPlaybackState), state, nameof(state));
+
+            if (position < 0)
+            {
+                throw new ArgumentOutOfRangeException(nameof(position), position, "position can't be less than zero.");
+            }
+
+            Native.SetPlaybackState(Handle, state.ToCode()).ThrowIfError("Failed to set playback state.");
+
+            Native.SetPlaybackPosition(Handle, (ulong)position).ThrowIfError("Failed to set playback position.");
+
+            Native.UpdatePlayback(Handle).ThrowIfError("Failed to set playback.");
+        }
+
+        private static void SetMetadata(MediaControllerAttribute attribute, string value)
+        {
+            Native.SetMetadata(Handle, attribute, value).ThrowIfError($"Failed to set metadata({attribute}).");
+        }
+
+        /// <summary>
+        /// Updates metadata information.
+        /// </summary>
+        /// <param name="metadata">The metadata to update.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="metadata"/> is null.</exception>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .\n
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        public static void SetMetadata(MediaControlMetadata metadata)
+        {
+            if (metadata == null)
+            {
+                throw new ArgumentNullException(nameof(metadata));
+            }
+
+            SetMetadata(MediaControllerAttribute.Title, metadata.Title);
+            SetMetadata(MediaControllerAttribute.Artist, metadata.Artist);
+            SetMetadata(MediaControllerAttribute.Album, metadata.Album);
+            SetMetadata(MediaControllerAttribute.Author, metadata.Author);
+            SetMetadata(MediaControllerAttribute.Genre, metadata.Genre);
+            SetMetadata(MediaControllerAttribute.Duration, metadata.Duration);
+            SetMetadata(MediaControllerAttribute.Date, metadata.Date);
+            SetMetadata(MediaControllerAttribute.Copyright, metadata.Copyright);
+            SetMetadata(MediaControllerAttribute.Description, metadata.Description);
+            SetMetadata(MediaControllerAttribute.TrackNumber, metadata.TrackNumber);
+            SetMetadata(MediaControllerAttribute.Picture, metadata.AlbumArtPath);
+
+            Native.UpdateMetadata(Handle).ThrowIfError("Failed to set metadata.");
+        }
+
+        /// <summary>
+        /// Updates the shuffle mode.
+        /// </summary>
+        /// <param name="enabled">A value indicating whether the shuffle mode is enabled.</param>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .\n
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        public static void SetShuffleModeEnabled(bool enabled)
+        {
+            Native.UpdateShuffleMode(Handle, enabled ? MediaControllerShuffleMode.On : MediaControllerShuffleMode.Off).
+                ThrowIfError("Failed to set shuffle mode.");
+        }
+
+        /// <summary>
+        /// Updates the repeat mode.
+        /// </summary>
+        /// <param name="mode">A value indicating the repeat mode.</param>
+        /// <exception cref="InvalidOperationException">
+        ///     The server is not running .\n
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <exception cref="ArgumentException"/><paramref name="mode"/> is invalid.</exception>
+        public static void SetRepeatMode(MediaControlRepeatMode mode)
+        {
+            ValidationUtil.ValidateEnum(typeof(MediaControlRepeatMode), mode, nameof(mode));
+
+            Native.UpdateRepeatMode(Handle, mode.ToNative()).ThrowIfError("Failed to set repeat mode.");
+        }
+
+        /// <summary>
+        /// Occurs when a client sends playback command.
+        /// </summary>
+        public static event EventHandler<PlaybackCommandReceivedEventArgs> PlaybackCommandReceived;
+
+        private static Native.PlaybackStateCommandReceivedCallback _playbackCommandCallback;
+
+        private static void RegisterPlaybackCommandReceivedEvent()
+        {
+            _playbackCommandCallback = (clientName, playbackCode, _) =>
+            {
+                PlaybackCommandReceived?.Invoke(null, new PlaybackCommandReceivedEventArgs(clientName, playbackCode.ToCommand()));
+            };
+            Native.SetPlaybackStateCmdRecvCb(Handle, _playbackCommandCallback).
+                ThrowIfError("Failed to init PlaybackStateCommandReceived event."); ;
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServerStartedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServerStartedEventArgs.cs
new file mode 100644 (file)
index 0000000..5749d51
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Provides data for the <see cref="MediaControllerManager.ServerStarted"/> event.
+    /// </summary>
+    public class MediaControlServerStartedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="MediaControlServerStartedEventArgs"/> class.
+        /// </summary>
+        /// <param name="mediaController">A <see cref="MediaController"/> of the server.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="mediaController"/> is null.</exception>
+        public MediaControlServerStartedEventArgs(MediaController mediaController)
+        {
+            if (mediaController == null)
+            {
+                throw new ArgumentNullException(nameof(mediaController));
+            }
+
+            Controller = mediaController;
+        }
+
+        /// <summary>
+        /// Gets the controller of the server added.
+        /// </summary>
+        /// <value>A <see cref="MediaController"/>.</value>
+        public MediaController Controller { get; }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServerStoppedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServerStoppedEventArgs.cs
new file mode 100644 (file)
index 0000000..bb0636d
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Provides data for the <see cref="MediaControllerManager.ServerStopped"/> event.
+    /// </summary>
+    public class MediaControlServerStoppedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="MediaControlServerStoppedEventArgs"/> class.
+        /// </summary>
+        /// <param name="serverAppId">The application id of the server stopped.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="serverAppId"/> is null.</exception>
+        public MediaControlServerStoppedEventArgs(string serverAppId)
+        {
+            if (serverAppId == null)
+            {
+                throw new ArgumentNullException(nameof(serverAppId));
+            }
+
+            ServerAppId = serverAppId;
+        }
+
+        /// <summary>
+        /// Gets the application id of the server.
+        /// </summary>
+        /// <value>A string represents the application id.</value>
+        public string ServerAppId { get; }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs
new file mode 100644 (file)
index 0000000..fd35a57
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Diagnostics;
+using Native = Interop.MediaControllerClient;
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Provides a means to to send commands to and handle events from media control server.
+    /// </summary>
+    public class MediaController
+    {
+        internal MediaController(MediaControllerManager manager, string serverAppId)
+        {
+            Debug.Assert(manager != null);
+            Debug.Assert(serverAppId != null);
+
+            Manager = manager;
+            ServerAppId = serverAppId;
+        }
+
+        private MediaControllerManager Manager { get; }
+
+        /// <summary>
+        /// Gets the application id of the server.
+        /// </summary>
+        /// <value>The server application id.</value>
+        public string ServerAppId { get; }
+
+        /// <summary>
+        /// Gets a value indicating whether the sever has been stopped.
+        /// </summary>
+        /// <value>true if the server has been stopped; otherwise, false.</value>
+        public bool IsStopped
+        {
+            get;
+            private set;
+        }
+
+        private void ThrowIfStopped()
+        {
+            if (IsStopped)
+            {
+                throw new InvalidOperationException("The server has already been stopped.");
+            }
+        }
+
+        /// <summary>
+        /// Occurs when the server is stopped.
+        /// </summary>
+        public event EventHandler ServerStopped;
+
+        internal void RaiseStoppedEvent()
+        {
+            IsStopped = true;
+            ServerStopped?.Invoke(this, EventArgs.Empty);
+        }
+
+        /// <summary>
+        /// Occurs when the playback state is updated.
+        /// </summary>
+        public event EventHandler<PlaybackStateUpdatedEventArgs> PlaybackStateUpdated;
+
+        private PlaybackStateUpdatedEventArgs CreatePlaybackUpdatedEventArgs(IntPtr playbackHandle)
+        {
+            try
+            {
+                Native.GetPlaybackState(playbackHandle, out var playbackCode).ThrowIfError("Failed to get state.");
+
+                Native.GetPlaybackPosition(playbackHandle, out var position).ThrowIfError("Failed to get position.");
+
+                return new PlaybackStateUpdatedEventArgs(playbackCode.ToState(), (long)position);
+            }
+            catch (Exception e)
+            {
+                Log.Error(GetType().FullName, e.ToString());
+            }
+            return null;
+        }
+
+        internal void RaisePlaybackUpdatedEvent(IntPtr playbackHandle)
+        {
+            var eventHandler = PlaybackStateUpdated;
+
+            if (eventHandler == null)
+            {
+                return;
+            }
+
+            var args = CreatePlaybackUpdatedEventArgs(playbackHandle);
+
+            if (args != null)
+            {
+                eventHandler.Invoke(this, args);
+            }
+        }
+
+        /// <summary>
+        /// Occurs when the metadata is updated.
+        /// </summary>
+        public event EventHandler<MetadataUpdatedEventArgs> MetadataUpdated;
+
+        private MetadataUpdatedEventArgs CreateMetadataUpdatedEventArgs(IntPtr metadataHandle)
+        {
+            try
+            {
+                return new MetadataUpdatedEventArgs(new MediaControlMetadata(metadataHandle));
+            }
+            catch (Exception e)
+            {
+                Log.Error(GetType().FullName, e.ToString());
+            }
+            return null;
+        }
+
+        internal void RaiseMetadataUpdatedEvent(IntPtr metadataHandle)
+        {
+            var eventHandler = MetadataUpdated;
+
+            if (eventHandler == null)
+            {
+                return;
+            }
+
+            var args = CreateMetadataUpdatedEventArgs(metadataHandle);
+
+            if (args != null)
+            {
+                eventHandler.Invoke(this, args);
+            }
+        }
+
+        /// <summary>
+        /// Occurs when the shuffle mode is updated.
+        /// </summary>
+        public event EventHandler<ShuffleModeUpdatedEventArgs> ShuffleModeUpdated;
+
+        internal void RaiseShuffleModeUpdatedEvent(MediaControllerShuffleMode mode)
+        {
+            ShuffleModeUpdated?.Invoke(this, new ShuffleModeUpdatedEventArgs(mode == MediaControllerShuffleMode.On));
+        }
+
+        /// <summary>
+        /// Occurs when the repeat mode is updated.
+        /// </summary>
+        public event EventHandler<RepeatModeUpdatedEventArgs> RepeatModeUpdated;
+
+        internal void RaiseRepeatModeUpdatedEvent(MediaControlRepeatMode mode)
+        {
+            RepeatModeUpdated?.Invoke(this, new RepeatModeUpdatedEventArgs(mode));
+        }
+
+        /// <summary>
+        /// Returns the playback state set by the server.
+        /// </summary>
+        /// <returns>The playback state.</returns>
+        /// <exception cref="InvalidOperationException">
+        ///     The server has already been stopped.
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+        /// <seealso cref="MediaControlServer.SetPlaybackState(MediaControlPlaybackState, long)"/>
+        public MediaControlPlaybackState GetPlaybackState()
+        {
+            ThrowIfStopped();
+
+            IntPtr playbackHandle = IntPtr.Zero;
+
+            try
+            {
+                Native.GetServerPlayback(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback.");
+
+                Native.GetPlaybackState(playbackHandle, out var playbackCode).ThrowIfError("Failed to get state.");
+
+                return playbackCode.ToState();
+            }
+            finally
+            {
+                if (playbackHandle != IntPtr.Zero)
+                {
+                    Native.DestroyPlayback(playbackHandle);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Returns the playback position set by the server.
+        /// </summary>
+        /// <returns>The playback position in milliseconds.</returns>
+        /// <exception cref="InvalidOperationException">
+        ///     The server has already been stopped.
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+        /// <seealso cref="MediaControlServer.SetPlaybackState(MediaControlPlaybackState, long)"/>
+        public long GetPlaybackPosition()
+        {
+            ThrowIfStopped();
+
+            IntPtr playbackHandle = IntPtr.Zero;
+
+            try
+            {
+                Native.GetServerPlayback(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback.");
+
+                Native.GetPlaybackPosition(playbackHandle, out var position).ThrowIfError("Failed to get position.");
+
+                return (long)position;
+            }
+            finally
+            {
+                if (playbackHandle != IntPtr.Zero)
+                {
+                    Native.DestroyPlayback(playbackHandle);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Returns the metadata set by the server.
+        /// </summary>
+        /// <returns>The metadata.</returns>
+        /// <exception cref="InvalidOperationException">
+        ///     The server has already been stopped.
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+        /// <seealso cref="MediaControlServer.SetMetadata(MediaControlMetadata)"/>
+        public MediaControlMetadata GetMetadata()
+        {
+            ThrowIfStopped();
+
+            IntPtr metadataHandle = IntPtr.Zero;
+
+            try
+            {
+                Native.GetServerMetadata(Manager.Handle, ServerAppId, out metadataHandle).
+                    ThrowIfError("Failed to get metadata.");
+
+                return new MediaControlMetadata(metadataHandle);
+            }
+            finally
+            {
+                if (metadataHandle != IntPtr.Zero)
+                {
+                    Native.DestroyMetadata(metadataHandle);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Returns whether the shuffle mode is enabled.
+        /// </summary>
+        /// <returns>A value indicating whether the shuffle mode is enabled.</returns>
+        /// <exception cref="InvalidOperationException">
+        ///     The server has already been stopped.
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+        /// <seealso cref="MediaControlServer.SetShuffleModeEnabled(bool)"/>
+        public bool IsShuffleModeEnabled()
+        {
+            ThrowIfStopped();
+
+            Native.GetServerShuffleMode(Manager.Handle, ServerAppId, out var shuffleMode).
+                ThrowIfError("Failed to get shuffle mode state.");
+
+            return shuffleMode == MediaControllerShuffleMode.On;
+        }
+
+        /// <summary>
+        /// Returns the repeat mode.
+        /// </summary>
+        /// <returns>A <see cref="MediaControlRepeatMode"/> set by the server.</returns>
+        /// <exception cref="InvalidOperationException">
+        ///     The server has already been stopped.
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+        /// <seealso cref="MediaControlServer.SetRepeatMode(MediaControlRepeatMode)"/>
+        public MediaControlRepeatMode GetRepeatMode()
+        {
+            ThrowIfStopped();
+
+            Native.GetServerRepeatMode(Manager.Handle, ServerAppId, out var repeatMode).
+                ThrowIfError("Failed to get repeat mode state.");
+
+            return repeatMode.ToPublic();
+        }
+
+        /// <summary>
+        /// Sends playback command to the server.</summary>
+        /// <param name="command">A playback command.</param>
+        /// <exception cref="InvalidOperationException">
+        ///     The server has already been stopped.
+        ///     -or-\n
+        ///     An internal error occurs.
+        /// </exception>
+        /// <exception cref="ArgumentException"><paramref name="command"/> is not valid.</exception>
+        /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+        /// <seealso cref="MediaControlServer.PlaybackCommandReceived"/>
+        public void SendPlaybackCommand(MediaControlPlaybackCommand command)
+        {
+            ThrowIfStopped();
+
+            ValidationUtil.ValidateEnum(typeof(MediaControlPlaybackCommand), command, nameof(command));
+
+            Native.SendPlaybackStateCommand(Manager.Handle, ServerAppId, command.ToCode()).
+                ThrowIfError("Failed to send command.");
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs
deleted file mode 100755 (executable)
index 529719a..0000000
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-using Tizen.Applications;
-using Native = Interop.MediaControllerClient;
-
-namespace Tizen.Multimedia.MediaController
-{
-
-    /// <summary>
-    /// The MediaControllerClient class provides APIs required for media-controller-client.
-    /// </summary>
-    /// <privilege>
-    /// http://tizen.org/privilege/mediacontroller.client
-    /// </privilege>
-    /// <remarks>
-    /// The MediaControllerClient APIs provides functions to get media information from server.
-    /// </remarks>
-    public class MediaControllerClient : IDisposable
-    {
-        internal IntPtr _handle = IntPtr.Zero;
-
-        private bool _disposed = false;
-        private EventHandler<ServerUpdatedEventArgs> _serverUpdated;
-        private Native.ServerUpdatedCallback _serverUpdatedCallback;
-        private EventHandler<PlaybackUpdatedEventArgs> _playbackUpdated;
-        private Native.PlaybackUpdatedCallback _playbackUpdatedCallback;
-        private EventHandler<MetadataUpdatedEventArgs> _metadataUpdated;
-        private Native.MetadataUpdatedCallback _metadataUpdatedCallback;
-        private EventHandler<ShuffleModeUpdatedEventArgs> _shufflemodeUpdated;
-        private Native.ShuffleModeUpdatedCallback _shufflemodeUpdatedCallback;
-        private EventHandler<RepeatModeUpdatedEventArgs> _repeatmodeUpdated;
-        private Native.RepeatModeUpdatedCallback _repeatmodeUpdatedCallback;
-        private EventHandler<CustomCommandReplyEventArgs> _customcommandReply;
-        private Native.CommandReplyRecievedCallback _customcommandReplyCallback;
-
-        private bool IsValidHandle
-        {
-            get { return (_handle != IntPtr.Zero); }
-        }
-
-        private IntPtr SafeHandle
-        {
-            get
-            {
-                if (!IsValidHandle)
-                {
-                    throw new ObjectDisposedException(nameof(MediaControllerClient), "Fail to operate MediaControllerClient");
-                }
-
-                return _handle;
-            }
-        }
-
-        /// <summary>
-        /// The constructor of MediaControllerClient class.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        /// <exception cref="UnauthorizedAccessException">Thrown when the access is denied for media controller client</exception>
-        public MediaControllerClient()
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.Create(out _handle), "Create client failed");
-        }
-
-        ~MediaControllerClient()
-        {
-            Dispose(false);
-        }
-
-        public void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        protected virtual void Dispose(bool disposing)
-        {
-            if (!_disposed)
-            {
-                if (disposing)
-                {
-                    // To be used if there are any other disposable objects
-                }
-
-                if (IsValidHandle)
-                {
-                    Native.Destroy(_handle);
-                    _handle = IntPtr.Zero;
-                }
-
-                _disposed = true;
-            }
-        }
-
-        /// <summary>
-        /// ServerUpdated event is raised when server is changed
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<ServerUpdatedEventArgs> ServerUpdated
-        {
-            add
-            {
-                if (_serverUpdated == null)
-                {
-                    RegisterServerUpdatedEvent();
-                }
-
-                _serverUpdated += value;
-
-            }
-
-            remove
-            {
-                _serverUpdated -= value;
-                if (_serverUpdated == null)
-                {
-                    UnregisterServerUpdatedEvent();
-                }
-            }
-        }
-
-        /// <summary>
-        /// PlaybackUpdated event is raised when playback is changed
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<PlaybackUpdatedEventArgs> PlaybackUpdated
-        {
-            add
-            {
-                if (_playbackUpdated == null)
-                {
-                    RegisterPlaybackUpdatedEvent();
-                }
-
-                _playbackUpdated += value;
-
-            }
-
-            remove
-            {
-                _playbackUpdated -= value;
-                if (_playbackUpdated == null)
-                {
-                    UnregisterPlaybackUpdatedEvent();
-                }
-            }
-        }
-
-        /// <summary>
-        /// MetadataUpdated event is raised when metadata is changed
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<MetadataUpdatedEventArgs> MetadataUpdated
-        {
-            add
-            {
-                if (_metadataUpdated == null)
-                {
-                    RegisterMetadataUpdatedEvent();
-                }
-
-                _metadataUpdated += value;
-
-            }
-
-            remove
-            {
-                _metadataUpdated -= value;
-                if (_metadataUpdated == null)
-                {
-                    UnregisterMetadataUpdatedEvent();
-                }
-            }
-        }
-
-        /// <summary>
-        /// ShuffleModeUpdated event is raised when shuffle mode is changed
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<ShuffleModeUpdatedEventArgs> ShuffleModeUpdated
-        {
-            add
-            {
-                if (_shufflemodeUpdated == null)
-                {
-                    RegisterShuffleModeUpdatedEvent();
-                }
-
-                _shufflemodeUpdated += value;
-
-            }
-
-            remove
-            {
-                _shufflemodeUpdated -= value;
-                if (_shufflemodeUpdated == null)
-                {
-                    UnregisterShuffleModeUpdatedEvent();
-                }
-            }
-        }
-
-        /// <summary>
-        /// RepeatModeUpdated event is raised when server is changed
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<RepeatModeUpdatedEventArgs> RepeatModeUpdated
-        {
-            add
-            {
-                if (_repeatmodeUpdated == null)
-                {
-                    RegisterRepeatModeUpdatedEvent();
-                }
-
-                _repeatmodeUpdated += value;
-            }
-
-            remove
-            {
-                _repeatmodeUpdated -= value;
-                if (_repeatmodeUpdated == null)
-                {
-                    UnregisterRepeatModeUpdatedEvent();
-                }
-            }
-        }
-
-        /// <summary>
-        /// CommandReply event is raised when reply for command is recieved
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<CustomCommandReplyEventArgs> CustomCommandReply
-        {
-            add
-            {
-                if (_customcommandReply == null)
-                {
-                    _customcommandReplyCallback = (IntPtr serverName, int result, IntPtr bundle, IntPtr userData) =>
-                    {
-                        SafeBundleHandle safeBundleHandle = new SafeBundleHandle(bundle, true);
-                        Bundle bundleData = new Bundle(safeBundleHandle);
-                        CustomCommandReplyEventArgs eventArgs = new CustomCommandReplyEventArgs(Marshal.PtrToStringAnsi(serverName), result, bundleData);
-                        _customcommandReply?.Invoke(this, eventArgs);
-                    };
-                }
-
-                _customcommandReply += value;
-
-            }
-
-            remove
-            {
-                _customcommandReply -= value;
-                if (_customcommandReply == null)
-                {
-                    _customcommandReplyCallback = null;
-                }
-            }
-        }
-
-        /// <summary>
-        /// gets latest server information </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <returns>The name and state of the latest media controller server application: ServerInformation object</returns>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public ServerInformation GetLatestServer()
-        {
-            IntPtr name = IntPtr.Zero;
-            MediaControllerServerState state = MediaControllerServerState.None;
-
-            try
-            {
-                MediaControllerValidator.ThrowIfError(
-                    Native.GetLatestServer(SafeHandle, out name, out state), "Get Latest server failed");
-                return new ServerInformation(Marshal.PtrToStringAnsi(name), (MediaControllerServerState)state);
-            }
-            finally
-            {
-                LibcSupport.Free(name);
-            }
-        }
-
-        /// <summary>
-        /// gets playback information for specific server </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="serverName"> Server Name  </param>
-        /// <returns>The playback state and playback position of the specific media controller server application:MediaControllerPlayback object</returns>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public MediaControllerPlayback GetPlayback(string serverName)
-        {
-            IntPtr playbackHandle = IntPtr.Zero;
-            MediaControllerPlayback playback = null;
-
-            try
-            {
-                MediaControllerValidator.ThrowIfError(
-                    Native.GetServerPlayback(SafeHandle, serverName, out playbackHandle), "Get Playback handle failed");
-                playback = new MediaControllerPlayback(playbackHandle);
-            }
-            finally
-            {
-                if (playbackHandle != IntPtr.Zero)
-                {
-                    MediaControllerValidator.ThrowIfError(
-                        Native.DestroyPlayback(playbackHandle), "Destroy playback failed");
-                }
-            }
-
-            return playback;
-        }
-
-        /// <summary>
-        /// gets metadata information for specific server </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="serverName"> Server Name  </param>
-        /// <returns>The metadata information of the specific media controller server application:MediaControllerMetadata object</returns>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public MediaControllerMetadata GetMetadata(string serverName)
-        {
-            IntPtr metadataHandle = IntPtr.Zero;
-            MediaControllerMetadata metadata = null;
-
-            try
-            {
-                MediaControllerValidator.ThrowIfError(
-                    Native.GetServerMetadata(SafeHandle, serverName, out metadataHandle), "Get Metadata handle failed");
-                metadata = new MediaControllerMetadata(metadataHandle);
-            }
-            finally
-            {
-                if (metadataHandle != IntPtr.Zero)
-                {
-                    MediaControllerValidator.ThrowIfError(
-                    Native.DestroyMetadata(metadataHandle), "Destroy metadata failed");
-                }
-            }
-
-            return metadata;
-        }
-
-        /// <summary>
-        /// gets shuffle mode for specific server </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="serverName"> Server Name  </param>
-        /// <returns>The shuffle mode of the specific media controller server application:MediaControllerShuffleMode enum</returns>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public MediaControllerShuffleMode GetShuffleMode(string serverName)
-        {
-            MediaControllerShuffleMode shuffleMode = MediaControllerShuffleMode.Off;
-
-            MediaControllerValidator.ThrowIfError(
-                Native.GetServerShuffleMode(SafeHandle, serverName, out shuffleMode), "Get ShuffleMode failed");
-
-            return shuffleMode;
-        }
-
-        /// <summary>
-        /// gets repeat mode for specific server </summary>\
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="serverName"> Server Name  </param>
-        /// <returns>The repeat mode of the specific media controller server application:MediaControllerRepeatMode enum</returns>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public MediaControllerRepeatMode GetRepeatMode(string serverName)
-        {
-            MediaControllerRepeatMode repeatMode = MediaControllerRepeatMode.Off;
-
-            MediaControllerValidator.ThrowIfError(
-                Native.GetServerRepeatMode(SafeHandle, serverName, out repeatMode), "Get RepeatMode failed");
-
-            return repeatMode;
-        }
-
-        /// <summary>
-        /// Send command of playback state to server application </summary>
-        /// <param name="serverName"> Server Name  </param>
-        /// <param name="state"> Playback State  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public void SendPlaybackStateCommand(string serverName, MediaControllerPlaybackState state)
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.SendPlaybackStateCommand(SafeHandle, serverName, state), "Send playback state command failed");
-        }
-
-        /// <summary>
-        /// Send customized command to server application </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="serverName"> Server Name  </param>
-        /// <param name="command"> Command  </param>
-        /// <param name="bundle"> Bundle data  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public void SendCustomCommand(string serverName, string command, Bundle bundle)
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.SendCustomCommand(SafeHandle, serverName, command, bundle.SafeBundleHandle, _customcommandReplyCallback, IntPtr.Zero),
-                "Send custom command failed");
-        }
-
-        /// <summary>
-        /// Subscribe subscription type from specific server application </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="type"> Subscription Type  </param>
-        /// <param name="serverName"> Server Name  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        public void Subscribe(MediaControllerSubscriptionType type, string serverName)
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.Subscribe(SafeHandle, type, serverName), "Subscribe failed");
-        }
-
-        /// <summary>
-        /// Subscribe subscription type from specific server application </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="type"> Subscription Type  </param>
-        /// <param name="serverName"> Server Name  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        public void Unsubscribe(MediaControllerSubscriptionType type, string serverName)
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.Unsubscribe(SafeHandle, type, serverName), "Unsubscribe failed");
-        }
-
-        /// <summary>
-        /// gets activated server list </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <returns>The list of activated media controller server applications: IEnumerable of string</returns>
-        public Task<IEnumerable<string>> GetActivatedServerList()
-        {
-            var task = new TaskCompletionSource<IEnumerable<string>>();
-
-            List<string> collectionList = ForEachActivatedServer(SafeHandle);
-            task.TrySetResult((IEnumerable<string>)collectionList);
-
-            return task.Task;
-        }
-
-        /// <summary>
-        /// gets subscribed server list </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="subscriptionType"> Subscription Type  </param>
-        /// <returns>The list of subscribed media controller server applications: IEnumerable of string</returns>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public Task<IEnumerable<string>> GetSubscribedServerList(MediaControllerSubscriptionType subscriptionType)
-        {
-            var task = new TaskCompletionSource<IEnumerable<string>>();
-
-            List<string> collectionList = ForEachSubscribedServer(SafeHandle, subscriptionType);
-            task.TrySetResult((IEnumerable<string>)collectionList);
-
-            return task.Task;
-        }
-
-        private void RegisterServerUpdatedEvent()
-        {
-            _serverUpdatedCallback = (IntPtr serverName, MediaControllerServerState serverState, IntPtr userData) =>
-            {
-                ServerUpdatedEventArgs eventArgs = new ServerUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), serverState);
-                _serverUpdated?.Invoke(this, eventArgs);
-            };
-            Native.SetServerUpdatedCb(SafeHandle, _serverUpdatedCallback, IntPtr.Zero);
-        }
-
-        private void UnregisterServerUpdatedEvent()
-        {
-            Native.UnsetServerUpdatedCb(SafeHandle);
-        }
-
-        private void RegisterPlaybackUpdatedEvent()
-        {
-            _playbackUpdatedCallback = (IntPtr serverName, IntPtr playback, IntPtr userData) =>
-            {
-                PlaybackUpdatedEventArgs eventArgs = new PlaybackUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), playback);
-                _playbackUpdated?.Invoke(this, eventArgs);
-            };
-            Native.SetPlaybackUpdatedCb(SafeHandle, _playbackUpdatedCallback, IntPtr.Zero);
-        }
-
-        private void UnregisterPlaybackUpdatedEvent()
-        {
-            Native.UnsetPlaybackUpdatedCb(SafeHandle);
-        }
-
-        private void RegisterMetadataUpdatedEvent()
-        {
-            _metadataUpdatedCallback = (IntPtr serverName, IntPtr metadata, IntPtr userData) =>
-            {
-                MetadataUpdatedEventArgs eventArgs = new MetadataUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), metadata);
-                _metadataUpdated?.Invoke(this, eventArgs);
-            };
-            Native.SetMetadataUpdatedCb(SafeHandle, _metadataUpdatedCallback, IntPtr.Zero);
-        }
-
-        private void UnregisterMetadataUpdatedEvent()
-        {
-            Native.UnsetMetadataUpdatedCb(SafeHandle);
-        }
-
-        private void RegisterShuffleModeUpdatedEvent()
-        {
-            _shufflemodeUpdatedCallback = (IntPtr serverName, MediaControllerShuffleMode shuffleMode, IntPtr userData) =>
-            {
-                ShuffleModeUpdatedEventArgs eventArgs = new ShuffleModeUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), shuffleMode);
-                _shufflemodeUpdated?.Invoke(this, eventArgs);
-            };
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetShuffleModeUpdatedCb(SafeHandle, _shufflemodeUpdatedCallback, IntPtr.Zero),
-                "Set ShuffleModeUpdated callback failed");
-        }
-
-        private void UnregisterShuffleModeUpdatedEvent()
-        {
-            Native.UnsetShuffleModeUpdatedCb(SafeHandle);
-        }
-
-        private void RegisterRepeatModeUpdatedEvent()
-        {
-            _repeatmodeUpdatedCallback = (IntPtr serverName, MediaControllerRepeatMode repeatMode, IntPtr userData) =>
-            {
-                RepeatModeUpdatedEventArgs eventArgs = new RepeatModeUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), repeatMode);
-                _repeatmodeUpdated?.Invoke(this, eventArgs);
-            };
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetRepeatModeUpdatedCb(SafeHandle, _repeatmodeUpdatedCallback, IntPtr.Zero),
-                "Set RepeatModeUpdated callback failed");
-        }
-
-        private void UnregisterRepeatModeUpdatedEvent()
-        {
-            Native.UnsetRepeatModeUpdatedCb(SafeHandle);
-        }
-
-        private static List<string> ForEachSubscribedServer(IntPtr handle, MediaControllerSubscriptionType subscriptionType)
-        {
-            List<string> subscribedServerCollections = new List<string>();
-
-            Native.SubscribedServerCallback serverCallback = (IntPtr serverName, IntPtr userData) =>
-            {
-                subscribedServerCollections.Add(Marshal.PtrToStringAnsi(serverName));
-                return true;
-            };
-
-            MediaControllerValidator.ThrowIfError(
-                Native.ForeachSubscribedServer(handle, subscriptionType, serverCallback, IntPtr.Zero),
-                "Foreach Subscribed server failed");
-
-            return subscribedServerCollections;
-        }
-
-        private static List<string> ForEachActivatedServer(IntPtr handle)
-        {
-            List<string> activatedServerCollections = new List<string>();
-
-            Native.ActivatedServerCallback serverCallback = (IntPtr serverName, IntPtr userData) =>
-            {
-                activatedServerCollections.Add(Marshal.PtrToStringAnsi(serverName));
-                return true;
-            };
-
-            MediaControllerValidator.ThrowIfError(
-                Native.ForeachActivatedServer(handle, serverCallback, IntPtr.Zero),
-                "Foreach Activated server failed");
-
-            return activatedServerCollections;
-        }
-    }
-}
-
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs
deleted file mode 100755 (executable)
index dc12318..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-namespace Tizen.Multimedia.MediaController
-{
-    /// <summary>
-    /// Specifies states that a <see cref="ServerInformation"/> can have.
-    /// </summary>
-    public enum MediaControllerServerState
-    {
-        /// <summary>
-        /// Server state is unknown
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        None,
-
-        /// <summary>
-        /// Server is activated
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Activated,
-
-        /// <summary>
-        /// Server is deactivated
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Deactivated,
-    }
-
-    /// <summary>
-    /// Enumeration for playback state
-    /// </summary>
-    public enum MediaControllerPlaybackState
-    {
-        /// <summary>
-        /// Playback state is unknown
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        None,
-
-        /// <summary>
-        /// Playback is playing
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Play,
-
-        /// <summary>
-        /// Playback is paused
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Pause,
-
-        /// <summary>
-        /// Playback is next
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Next,
-
-        /// <summary>
-        /// Playback is prev
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Prev,
-
-        /// <summary>
-        /// Playback is fastforward
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        FastForward,
-
-        /// <summary>
-        /// Playback is rewind
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Rewind,
-    }
-
-    /// <summary>
-    /// Enumeration for shuffle mode
-    /// </summary>
-    public enum MediaControllerShuffleMode
-    {
-        /// <summary>
-        /// Shuffle mode is On
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        On,
-
-        /// <summary>
-        /// Shuffle mode is Off
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Off,
-    }
-
-    /// <summary>
-    /// Enumeration for repeat mode
-    /// </summary>
-    public enum MediaControllerRepeatMode
-    {
-        /// <summary>
-        /// Repeat mode is On
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        On,
-
-        /// <summary>
-        /// Repeat mode is Off
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Off,
-    }
-
-    /// <summary>
-    /// Enumeration for repeat mode
-    /// </summary>
-    public enum MediaControllerSubscriptionType
-    {
-        /// <summary>
-        /// The type of subscription is the state of server
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        ServerState,
-
-        /// <summary>
-        /// The type of subscription is the playback
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Playback,
-
-        /// <summary>
-        /// The type of subscription is the metadata
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Metadata,
-
-        /// <summary>
-        /// The type of subscription is the shuffle mode
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        ShuffleMode,
-
-        /// <summary>
-        /// The type of subscription is the repeat mode
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        RepeatMode,
-    }
-
-    /// <summary>
-    /// Enumeration for metadata attributes
-    /// </summary>
-    internal enum MediaControllerAttributes
-    {
-        /// <summary>
-        /// Attribute is title
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Title,
-
-        /// <summary>
-        /// Attribute is artist
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Artist,
-
-        /// <summary>
-        /// Attribute is album
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Album,
-
-        /// <summary>
-        /// Attribute is author
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Author,
-
-        /// <summary>
-        /// Attribute is genre
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Genre,
-
-        /// <summary>
-        /// Attribute is duration
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Duration,
-
-        /// <summary>
-        /// Attribute is date
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Date,
-
-        /// <summary>
-        /// Attribute is copyright
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Copyright,
-
-        /// <summary>
-        /// Attribute is description
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Description,
-
-        /// <summary>
-        /// Attribute is track number
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        TrackNumber,
-
-        /// <summary>
-        /// Attribute is picture
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Picture,
-    }
-}
-
index 680bedd..7a492a8 100644 (file)
@@ -1,24 +1,24 @@
 /*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 using System;
 using System.IO;
 using Tizen.Internals.Errors;
 
-namespace Tizen.Multimedia.MediaController
+namespace Tizen.Multimedia.Remoting
 {
     internal enum MediaControllerError
     {
@@ -28,12 +28,17 @@ namespace Tizen.Multimedia.MediaController
         InvalidOperation = ErrorCode.InvalidOperation,
         NoSpaceOnDevice = ErrorCode.FileNoSpaceOnDevice,
         PermissionDenied = ErrorCode.PermissionDenied,
-    };
+    }
 
-    internal static class MediaControllerValidator
+    internal static class MediaControllerErrorExtensions
     {
-        internal static void ThrowIfError(MediaControllerError error, string errorMessage)
+        internal static void ThrowIfError(this MediaControllerError error, string errorMessage)
         {
+            if (error == MediaControllerError.None)
+            {
+                return;
+            }
+
             switch (error)
             {
                 case MediaControllerError.InvalidParameter:
@@ -46,12 +51,13 @@ namespace Tizen.Multimedia.MediaController
                     throw new InvalidOperationException(errorMessage);
 
                 case MediaControllerError.NoSpaceOnDevice:
-                    throw new IOException(errorMessage);
+                    throw new IOException($"Not enough storage : {errorMessage}");
 
                 case MediaControllerError.PermissionDenied:
                     throw new UnauthorizedAccessException(errorMessage);
             }
+
+            throw new InvalidOperationException($"Unknown error({error}) : {errorMessage}");
         }
     }
-}
-
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs
deleted file mode 100644 (file)
index 44eac12..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-
-namespace Tizen.Multimedia.MediaController
-{
-    static internal class MediaControllerLog
-    {
-        internal const string LogTag = "Tizen.Multimedia.MediaController";
-    }
-}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerManager.Events.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerManager.Events.cs
new file mode 100644 (file)
index 0000000..4cdd504
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Native = Interop.MediaControllerClient;
+
+namespace Tizen.Multimedia.Remoting
+{
+    public partial class MediaControllerManager
+    {
+        private Native.ServerUpdatedCallback _serverUpdatedCallback;
+        private Native.PlaybackUpdatedCallback _playbackUpdatedCallback;
+        private Native.MetadataUpdatedCallback _metadataUpdatedCallback;
+        private Native.ShuffleModeUpdatedCallback _shufflemodeUpdatedCallback;
+        private Native.RepeatModeUpdatedCallback _repeatmodeUpdatedCallback;
+
+        /// <summary>
+        /// Occurs when a server is started.
+        /// </summary>
+        public event EventHandler<MediaControlServerStartedEventArgs> ServerStarted;
+
+        /// <summary>
+        /// Occurs when a server is stopped.
+        /// </summary>
+        public event EventHandler<MediaControlServerStoppedEventArgs> ServerStopped;
+
+        private void InitializeEvents()
+        {
+            RegisterPlaybackUpdatedEvent();
+            RegisterServerUpdatedEvent();
+            RegisterMetadataUpdatedEvent();
+            RegisterShuffleModeUpdatedEvent();
+            RegisterRepeatModeUpdatedEvent();
+        }
+
+        private void RaiseServerChangedEvent(MediaControllerServerState state, MediaController controller)
+        {
+            if (controller == null)
+            {
+                return;
+            }
+
+            if (state == MediaControllerServerState.Activated)
+            {
+                ServerStarted?.Invoke(this, new MediaControlServerStartedEventArgs(controller));
+            }
+            else
+            {
+                controller.RaiseStoppedEvent();
+                ServerStopped?.Invoke(this, new MediaControlServerStoppedEventArgs(controller.ServerAppId));
+            }
+        }
+
+        private void RegisterServerUpdatedEvent()
+        {
+            _serverUpdatedCallback = (serverName, state, _) =>
+            {
+                RaiseServerChangedEvent(state, HandleServerUpdated(serverName, state));
+            };
+
+            Native.SetServerUpdatedCb(Handle, _serverUpdatedCallback).ThrowIfError("Failed to init server changed event.");
+        }
+
+        private void RegisterPlaybackUpdatedEvent()
+        {
+            _playbackUpdatedCallback = (serverName, playback, _) =>
+            {
+                GetController(serverName)?.RaisePlaybackUpdatedEvent(playback);
+            };
+
+            Native.SetPlaybackUpdatedCb(Handle, _playbackUpdatedCallback).ThrowIfError("Failed to init PlaybackUpdated event.");
+        }
+
+
+        private void RegisterMetadataUpdatedEvent()
+        {
+            _metadataUpdatedCallback = (serverName, metadata, _) =>
+            {
+                GetController(serverName)?.RaiseMetadataUpdatedEvent(metadata);
+            };
+
+            Native.SetMetadataUpdatedCb(Handle, _metadataUpdatedCallback).ThrowIfError("Failed to init MetadataUpdated event.");
+        }
+
+        private void RegisterShuffleModeUpdatedEvent()
+        {
+            _shufflemodeUpdatedCallback = (serverName, shuffleMode, _) =>
+            {
+                GetController(serverName)?.RaiseShuffleModeUpdatedEvent(shuffleMode);
+            };
+
+            Native.SetShuffleModeUpdatedCb(Handle, _shufflemodeUpdatedCallback).
+                ThrowIfError("Failed to init ShuffleModeUpdated event.");
+        }
+
+        private void RegisterRepeatModeUpdatedEvent()
+        {
+            _repeatmodeUpdatedCallback = (serverName, repeatMode, _) =>
+            {
+                GetController(serverName)?.RaiseRepeatModeUpdatedEvent(repeatMode.ToPublic());
+            };
+
+            Native.SetRepeatModeUpdatedCb(Handle, _repeatmodeUpdatedCallback).
+                ThrowIfError("Failed to init RepeatModeUpdated event.");
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerManager.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerManager.cs
new file mode 100644 (file)
index 0000000..a8f6c5a
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using Native = Interop.MediaControllerClient;
+using NativeHandle = Interop.MediaControllerClientHandle;
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Provides a means to retrieve active controllers and observe controllers added and removed.
+    /// </summary>
+    public partial class MediaControllerManager : IDisposable
+    {
+        private NativeHandle _handle;
+
+        private Dictionary<string, MediaController> _activated = new Dictionary<string, MediaController>();
+
+        private ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
+
+        internal NativeHandle Handle
+        {
+            get
+            {
+                if (_disposed)
+                {
+                    throw new ObjectDisposedException(nameof(MediaControllerManager));
+                }
+
+                return _handle;
+            }
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="MediaControllerManager"/> class.
+        /// </summary>
+        /// <privilege>http://tizen.org/privilege/mediacontroller.client</privilege>
+        /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+        /// <exception cref="UnauthorizedAccessException">Caller does not have required privilege.</exception>
+        public MediaControllerManager()
+        {
+            Native.Create(out _handle).ThrowIfError("Failed to create media controller client.");
+
+            InitializeEvents();
+
+            LoadActivatedServers();
+        }
+
+        private bool _disposed;
+
+        /// <summary>
+        /// Releases all resources used by the <see cref="MediaControllerManager"/>.
+        /// </summary>
+        public void Dispose()
+        {
+            Dispose(true);
+        }
+
+        /// <summary>
+        /// Releases the unmanaged resources used by the <see cref="MediaControllerManager"/>.
+        /// </summary>
+        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
+        protected virtual void Dispose(bool disposing)
+        {
+            if (!_disposed)
+            {
+                if (disposing)
+                {
+                    // To be used if there are any other disposable objects
+                }
+                _handle.Dispose();
+
+                _disposed = true;
+            }
+        }
+
+        /// <summary>
+        /// Gets the active controllers.
+        /// </summary>
+        /// <returns>An array of <see cref="MediaController"/>.</returns>
+        public MediaController[] GetActiveControllers()
+        {
+            if (_disposed)
+            {
+                return new MediaController[0];
+            }
+
+            try
+            {
+                _lock.EnterReadLock();
+                return _activated.Values.ToArray();
+            }
+            finally
+            {
+                _lock.ExitReadLock();
+            }
+        }
+
+        #region Controllers-related operations
+
+        #region Unlocking operations
+
+        private MediaController HandleActivation(string serverName)
+        {
+            if (_activated.ContainsKey(serverName))
+            {
+                return null;
+            }
+
+            var controller = new MediaController(this, serverName);
+            _activated.Add(serverName, controller);
+
+            return controller;
+        }
+
+        private MediaController HandleDeactivation(string serverName)
+        {
+            if (_activated.TryGetValue(serverName, out var controller))
+            {
+                _activated.Remove(serverName);
+            }
+
+            return controller;
+        }
+        #endregion
+
+        #region Locking operations
+
+        private MediaController HandleServerUpdated(string serverName, MediaControllerServerState state)
+        {
+            try
+            {
+                _lock.EnterWriteLock();
+
+                if (state == MediaControllerServerState.Activated)
+                {
+                    return HandleActivation(serverName);
+                }
+
+                return HandleDeactivation(serverName);
+            }
+            finally
+            {
+                _lock.ExitWriteLock();
+            }
+        }
+
+        private MediaController GetController(string serverName)
+        {
+            try
+            {
+                _lock.EnterReadLock();
+
+                _activated.TryGetValue(serverName, out var value);
+                return value;
+            }
+            finally
+            {
+                _lock.ExitReadLock();
+            }
+        }
+
+        private void LoadActivatedServers()
+        {
+            try
+            {
+                _lock.EnterWriteLock();
+
+                Native.ActivatedServerCallback serverCallback = (serverName, _) =>
+                {
+                    _activated.Add(serverName, new MediaController(this, serverName));
+                    return true;
+                };
+
+                Native.ForeachActivatedServer(Handle, serverCallback, IntPtr.Zero).
+                    ThrowIfError("Failed to get activated servers.");
+            }
+            finally
+            {
+                _lock.ExitWriteLock();
+            }
+        }
+
+        #endregion
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs
deleted file mode 100755 (executable)
index 1b0968b..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-using Native = Interop.MediaControllerClient;
-
-namespace Tizen.Multimedia.MediaController
-{
-    /// <summary>
-    /// Metadata represents a metadata of media for server application to play
-    /// </summary>
-    public class MediaControllerMetadata
-    {
-        /// <summary>
-        /// The constructor of MediaControllerMetadata class.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public MediaControllerMetadata()
-        {
-            // Do nothing
-        }
-
-        internal MediaControllerMetadata(IntPtr handle)
-        {
-            if (handle == IntPtr.Zero)
-            {
-                throw new InvalidOperationException("MediaControllerMetadata is not valid.");
-            }
-
-            Title = Native.GetMetadata(handle, MediaControllerAttributes.Title);
-            Artist = Native.GetMetadata(handle, MediaControllerAttributes.Artist);
-            Album = Native.GetMetadata(handle, MediaControllerAttributes.Album);
-            Author = Native.GetMetadata(handle, MediaControllerAttributes.Author);
-            Genre = Native.GetMetadata(handle, MediaControllerAttributes.Genre);
-            Duration = Native.GetMetadata(handle, MediaControllerAttributes.Duration);
-            Date = Native.GetMetadata(handle, MediaControllerAttributes.Date);
-            Copyright = Native.GetMetadata(handle, MediaControllerAttributes.Copyright);
-            Description = Native.GetMetadata(handle, MediaControllerAttributes.Description);
-            TrackNumber = Native.GetMetadata(handle, MediaControllerAttributes.TrackNumber);
-            Picture = Native.GetMetadata(handle, MediaControllerAttributes.Picture);
-        }
-
-        /// <summary>
-        /// Set/Get the Title of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Title { get; set; }
-
-        /// <summary>
-        /// Set/Get the Artist of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Artist { get; set; }
-
-        /// <summary>
-        /// Set/Get the Album of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Album { get; set; }
-
-        /// <summary>
-        /// Set/Get the Author of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Author { get; set; }
-
-        /// <summary>
-        /// Set/Get the Genre of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Genre { get; set; }
-
-        /// <summary>
-        /// Set/Get the Duration of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Duration { get; set; }
-
-        /// <summary>
-        /// Set/Get the Date of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Date { get; set; }
-
-        /// <summary>
-        /// Set/Get the Copyright of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Copyright { get; set; }
-
-        /// <summary>
-        /// Set/Get the Description of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Description { get; set; }
-
-        /// <summary>
-        /// Set/Get the Track Number of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string TrackNumber { get; set; }
-
-        /// <summary>
-        /// Set/Get the Picture of media
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Picture { get; set; }
-    }
-}
-
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs
deleted file mode 100755 (executable)
index 52143e5..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-using Native = Interop.MediaControllerClient;
-
-namespace Tizen.Multimedia.MediaController
-{
-    /// <summary>
-    /// Playback represents a playback state and playback position.
-    /// </summary>
-    public class MediaControllerPlayback
-    {
-        /// <summary>
-        /// The constructor of MediaControllerPlayback class.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="state">
-        /// The state of the playback which is playing in MediaConttoller server application
-        /// </param>
-        /// <param name="position">
-        /// The position of the playback which is playing in MediaConttoller server application
-        /// </param>
-        public MediaControllerPlayback(MediaControllerPlaybackState state, ulong position)
-        {
-            State = state;
-            Position = position;
-        }
-
-        internal MediaControllerPlayback(IntPtr handle)
-        {
-            MediaControllerPlaybackState state = MediaControllerPlaybackState.None;
-            ulong position = 0L;
-
-            if (handle == IntPtr.Zero)
-            {
-                throw new InvalidOperationException("MediaControllerPlayback is not valid.");
-            }
-
-            MediaControllerValidator.ThrowIfError(
-                Native.GetPlaybackState(handle, out state), "Get Playback state failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.GetPlaybackPosition(handle, out position), "Get Playback position failed");
-
-            State = state;
-            Position = position;
-        }
-
-        /// <summary>
-        /// Set/Get the State of playback information
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public MediaControllerPlaybackState State { get; }
-
-        /// <summary>
-        /// Set/Get the Position of playback information
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public ulong Position { get; }
-    }
-}
-
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerRepeatMode.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerRepeatMode.cs
new file mode 100644 (file)
index 0000000..5bcd5c8
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Multimedia.Remoting
+{
+    public enum MediaControlRepeatMode
+    {
+        Off,
+        On,
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs
deleted file mode 100755 (executable)
index 9928e53..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-using System.Runtime.InteropServices;
-using Tizen.Applications;
-using Native = Interop.MediaControllerServer;
-
-namespace Tizen.Multimedia.MediaController
-{
-
-    /// <summary>
-    /// The MediaControllerServer class provides APIs required for media-controller-server.
-    /// </summary>
-    /// <privilege>
-    /// http://tizen.org/privilege/mediacontroller.server
-    /// </privilege>
-    /// <remarks>
-    /// The MediaControllerServer APIs provides functions to update media information.
-    /// </remarks>
-    public class MediaControllerServer : IDisposable
-    {
-        internal IntPtr _handle = IntPtr.Zero;
-
-        private bool _disposed = false;
-        private EventHandler<PlaybackStateCommandEventArgs> _playbackCommand;
-        private Native.PlaybackStateCommandRecievedCallback _playbackCommandCallback;
-        private EventHandler<CustomCommandEventArgs> _customCommand;
-        private Native.CustomCommandRecievedCallback _customCommandCallback;
-
-        private bool IsValidHandle
-        {
-            get { return (_handle != IntPtr.Zero); }
-        }
-
-        private IntPtr SafeHandle
-        {
-            get
-            {
-                if (!IsValidHandle)
-                {
-                    throw new ObjectDisposedException(nameof(MediaControllerServer), "Fail to operate MediaControllerServer");
-                }
-
-                return _handle;
-            }
-        }
-
-        /// <summary>
-        /// The constructor of MediaControllerServer class.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        /// <exception cref="UnauthorizedAccessException">Thrown when the access is denied for media controller client</exception>
-        public MediaControllerServer()
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.Create(out _handle), "Create  server failed");
-        }
-
-        ~MediaControllerServer()
-        {
-            Dispose(false);
-        }
-
-        public void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        protected virtual void Dispose(bool disposing)
-        {
-            if (!_disposed)
-            {
-                if (disposing)
-                {
-                    // To be used if there are any other disposable objects
-                }
-
-                if (IsValidHandle)
-                {
-                    Native.Destroy(_handle);
-                    _handle = IntPtr.Zero;
-                }
-
-                _disposed = true;
-            }
-        }
-
-        /// <summary>
-        /// PlaybackStateCommandRecieved event is raised when client send command for playback
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<PlaybackStateCommandEventArgs> PlaybackStateCommand
-        {
-            add
-            {
-                if (_playbackCommand == null)
-                {
-                    RegisterPlaybackCmdRecvEvent();
-                }
-
-                _playbackCommand += value;
-
-            }
-
-            remove
-            {
-                _playbackCommand -= value;
-                if (_playbackCommand == null)
-                {
-                    UnregisterPlaybackCmdRecvEvent();
-                }
-            }
-        }
-
-        /// <summary>
-        /// CustomCommandRecieved event is raised when client send customized command
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<CustomCommandEventArgs> CustomCommand
-        {
-            add
-            {
-                if (_customCommand == null)
-                {
-                    RegisterCustomCommandEvent();
-                }
-
-                _customCommand += value;
-
-            }
-
-            remove
-            {
-                _customCommand -= value;
-                if (_customCommand == null)
-                {
-                    UnregisterCustomCommandEvent();
-                }
-            }
-        }
-
-        /// <summary>
-        /// Update playback state and playback position</summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="playback"> playback state and playback position  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public void UpdatePlayback(MediaControllerPlayback playback)
-        {
-            if (playback == null)
-            {
-                throw new ArgumentNullException("playback is null");
-            }
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetPlaybackState(SafeHandle, playback.State), "Set Playback state failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetPlaybackPosition(SafeHandle, playback.Position), "Set Playback position failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.UpdatePlayback(SafeHandle), "Update Playback failed");
-        }
-
-        /// <summary>
-        /// Update metadata information </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="metadata"> metadata information  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public void UpdateMetadata(MediaControllerMetadata metadata)
-        {
-            if (metadata == null)
-            {
-                throw new ArgumentNullException("metadata is null");
-            }
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Title, metadata.Title), "Set Title failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Artist, metadata.Artist), "Set Artist failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Album, metadata.Album), "Set Album failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Author, metadata.Author), "Set Author failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Genre, metadata.Genre), "Set Genre failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Duration, metadata.Duration), "Set Duration failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Date, metadata.Date), "Set Date failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Copyright, metadata.Copyright), "Set Copyright failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Description, metadata.Description), "Set Description failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.TrackNumber, metadata.TrackNumber), "Set TrackNumber failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.SetMetadata(SafeHandle, MediaControllerAttributes.Picture, metadata.Picture), "Set Picture failed");
-
-            MediaControllerValidator.ThrowIfError(
-                Native.UpdateMetadata(SafeHandle), "UpdateMetadata Metadata failed");
-        }
-
-        /// <summary>
-        /// Update shuffle mode </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="mode"> shuffle mode  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public void UpdateShuffleMode(MediaControllerShuffleMode mode)
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.UpdateShuffleMode(SafeHandle, mode), "Update Shuffle Mode failed");
-        }
-
-        /// <summary>
-        /// Update repeat mode </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="mode"> repeat mode  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public void UpdateRepeatMode(MediaControllerRepeatMode mode)
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.UpdateRepeatMode(SafeHandle, mode), "Update Repeat Mode failed");
-        }
-
-        /// <summary>
-        /// Send reply for command from server to client </summary>
-        /// <since_tizen> 3 </since_tizen>
-        /// <param name="clientName"> client name to recieve reply  </param>
-        /// <param name="result"> result to run command  </param>
-        /// <param name="bundle"> Bundle to send various data  </param>
-        /// <exception cref="ArgumentException">Thrown when an invalid argument is used</exception>
-        /// <exception cref="InvalidOperationException">Thrown when the operation is invalid for the current state</exception>
-        public void SendCustomCommandReply(string clientName, int result, Bundle bundle)
-        {
-            MediaControllerValidator.ThrowIfError(
-                Native.SendCommandReply(SafeHandle, clientName, result, bundle.SafeBundleHandle), "Send reply for command failed");
-        }
-
-        private void RegisterPlaybackCmdRecvEvent()
-        {
-            _playbackCommandCallback = (IntPtr clientName, MediaControllerPlaybackState state, IntPtr userData) =>
-            {
-                PlaybackStateCommandEventArgs eventArgs = new PlaybackStateCommandEventArgs(Marshal.PtrToStringAnsi(clientName), state);
-                _playbackCommand?.Invoke(this, eventArgs);
-            };
-            Native.SetPlaybackStateCmdRecvCb(SafeHandle, _playbackCommandCallback, IntPtr.Zero);
-        }
-
-        private void UnregisterPlaybackCmdRecvEvent()
-        {
-            Native.UnsetPlaybackStateCmdRecvCb(SafeHandle);
-        }
-
-        private void RegisterCustomCommandEvent()
-        {
-            _customCommandCallback = (IntPtr clientName, IntPtr command, IntPtr bundle, IntPtr userData) =>
-            {
-                SafeBundleHandle safeBundleHandle = new SafeBundleHandle(bundle, true);
-                Bundle bundleData = new Bundle(safeBundleHandle);
-                CustomCommandEventArgs eventArgs = new CustomCommandEventArgs(Marshal.PtrToStringAnsi(clientName), Marshal.PtrToStringAnsi(command), bundleData);
-                _customCommand?.Invoke(this, eventArgs);
-        };
-            Native.SetCustomCmdRecvCb(SafeHandle, _customCommandCallback, IntPtr.Zero);
-        }
-
-        private void UnregisterCustomCommandEvent()
-        {
-            Native.UnsetCustomCmdRecvCb(SafeHandle);
-        }
-    }
-}
-
index 51a718c..98cbfed 100755 (executable)
@@ -1,49 +1,41 @@
 /*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 using System;
 
-namespace Tizen.Multimedia.MediaController
+namespace Tizen.Multimedia.Remoting
 {
-
     /// <summary>
-    /// MetadataUpdated event arguments
+    /// Provides data for the <see cref="MediaController.MetadataUpdated"/> event.
     /// </summary>
-    /// <remarks>
-    /// MetadataUpdated event arguments
-    /// </remarks>
     public class MetadataUpdatedEventArgs : EventArgs
     {
-        internal MetadataUpdatedEventArgs(string name, IntPtr handle)
-        {
-            ServerName = name;
-            Metadata = new MediaControllerMetadata(handle);
-        }
-
         /// <summary>
-        /// Get the Server Name.
+        /// Initializes a new instance of the <see cref="MetadataUpdatedEventArgs"/> class.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string ServerName { get; }
+        /// <param name="metadata">The updated <see cref="MediaControlMetadata"/>.</param>
+        public MetadataUpdatedEventArgs(MediaControlMetadata metadata)
+        {
+            Metadata = metadata;
+        }
 
         /// <summary>
-        /// Get the Metadata information.
+        /// Gets the metadata.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public MediaControllerMetadata Metadata { get; }
+        /// <value>The updated <see cref="MediaControlMetadata"/>.</value>
+        public MediaControlMetadata Metadata { get; }
     }
-}
-
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/PlaybackCommandReceivedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackCommandReceivedEventArgs.cs
new file mode 100644 (file)
index 0000000..7d7c3e1
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Provides data for the <see cref="MediaControlServer.PlaybackCommandReceived"/> event.
+    /// </summary>
+    public class PlaybackCommandReceivedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="PlaybackCommandReceivedEventArgs"/> class.
+        /// </summary>
+        /// <param name="clientAppId">The client application id.</param>
+        /// <param name="command">The playback command.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="clientAppId"/> is null.</exception>
+        /// <exception cref="ArgumentException"><paramref name="command"/> is invalid.</exception>
+        public PlaybackCommandReceivedEventArgs(string clientAppId, MediaControlPlaybackCommand command)
+        {
+            if (clientAppId == null)
+            {
+                throw new ArgumentNullException(nameof(clientAppId));
+            }
+
+            ValidationUtil.ValidateEnum(typeof(MediaControlPlaybackCommand), command, nameof(command));
+
+            ClientAppId = clientAppId;
+            Command = command;
+        }
+
+        /// <summary>
+        /// Gets the application id of the client that sent command.
+        /// </summary>
+        /// <value>The client application id.</value>
+        public string ClientAppId { get; }
+
+        /// <summary>
+        /// Gets the command.
+        /// </summary>
+        /// <value>The <see cref="MediaControlPlaybackCommand"/>.</value>
+        public MediaControlPlaybackCommand Command { get; }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs
deleted file mode 100755 (executable)
index 339a90b..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-
-namespace Tizen.Multimedia.MediaController
-{
-
-    /// <summary>
-    /// PlaybackStateCommand event arguments
-    /// </summary>
-    /// <remarks>
-    /// PlaybackStateCommand event arguments
-    /// </remarks>
-    public class PlaybackStateCommandEventArgs : EventArgs
-    {
-        internal PlaybackStateCommandEventArgs(string name, MediaControllerPlaybackState state)
-        {
-            ClientName = name;
-            State = state;
-        }
-
-        /// <summary>
-        /// Get the Client Name.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string ClientName { get; }
-
-        /// <summary>
-        /// Get the State of playback.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public MediaControllerPlaybackState State { get; }
-    }
-}
-
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateUpdatedEventArgs.cs
new file mode 100644 (file)
index 0000000..d4ad662
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Diagnostics;
+using Native = Interop.MediaControllerClient;
+
+namespace Tizen.Multimedia.Remoting
+{
+    /// <summary>
+    /// Provides data for the <see cref="MediaController.PlaybackStateUpdated"/> event.
+    /// </summary>
+    public class PlaybackStateUpdatedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="PlaybackStateUpdatedEventArgs"/> class.
+        /// </summary>
+        /// <param name="state">The playback state.</param>
+        /// <param name="position">The playback position in milliseconds.</param>
+        /// <exception cref="ArgumentException"><paramref name="state"/> is invalid.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="position"/> is less than zero.</exception>
+        public PlaybackStateUpdatedEventArgs(MediaControlPlaybackState state, long position)
+        {
+            ValidationUtil.ValidateEnum(typeof(MediaControlPlaybackState), state, nameof(state));
+
+            if (position < 0)
+            {
+                throw new ArgumentOutOfRangeException(nameof(position), position, "position can't be less than zero.");
+            }
+
+            State = state;
+            Position = position;
+        }
+
+        /// <summary>
+        /// Gets the playback state.
+        /// </summary>
+        public MediaControlPlaybackState State { get; }
+
+        /// <summary>
+        /// Gets the playback position in milliseconds.
+        /// </summary>
+        public long Position { get; }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs
deleted file mode 100755 (executable)
index e6db63d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-
-namespace Tizen.Multimedia.MediaController
-{
-
-    /// <summary>
-    /// PlaybackUpdated event arguments
-    /// </summary>
-    /// <remarks>
-    /// PlaybackUpdated event arguments
-    /// </remarks>
-    public class PlaybackUpdatedEventArgs : EventArgs
-    {
-        internal PlaybackUpdatedEventArgs(string name, IntPtr handle)
-        {
-            ServerName = name;
-            PlaybackInfo = new MediaControllerPlayback(handle);
-        }
-
-        /// <summary>
-        /// Get the Server Name.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string ServerName { get; }
-
-        /// <summary>
-        /// Get the Playback Information.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public MediaControllerPlayback PlaybackInfo { get; }
-    }
-}
-
index e9abebd..f0fecf3 100755 (executable)
@@ -1,49 +1,44 @@
 /*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 using System;
 
-namespace Tizen.Multimedia.MediaController
+namespace Tizen.Multimedia.Remoting
 {
-
     /// <summary>
-    /// RepeatModeUpdated event arguments
+    /// Provides data for the <see cref="MediaController.RepeatModeUpdated"/> event.
     /// </summary>
-    /// <remarks>
-    /// RepeatModeUpdated event arguments
-    /// </remarks>
     public class RepeatModeUpdatedEventArgs : EventArgs
     {
-        internal RepeatModeUpdatedEventArgs(string name, MediaControllerRepeatMode mode)
+        /// <summary>
+        /// Initializes a new instance of the <see cref="RepeatModeUpdatedEventArgs"/> class.
+        /// </summary>
+        /// <param name="mode">A value indicating the updated repeat mode.</param>
+        /// <exception cref="ArgumentException"/><paramref name="mode"/> is invalid.</exception>
+        public RepeatModeUpdatedEventArgs(MediaControlRepeatMode mode)
         {
-            ServerName = name;
+            ValidationUtil.ValidateEnum(typeof(MediaControlRepeatMode), mode, nameof(mode));
+
             RepeatMode = mode;
         }
 
         /// <summary>
-        /// Get the Server Name.
+        /// Gets the updated repeat mode.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string ServerName { get; }
-
-        /// <summary>
-        /// Get the Repeat Mode.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public MediaControllerRepeatMode RepeatMode { get; }
+        /// <value>The <see cref="MediaControlRepeatMode"/>.</value>
+        public MediaControlRepeatMode RepeatMode { get; }
     }
-}
-
+}
\ No newline at end of file
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs b/src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs
deleted file mode 100755 (executable)
index 39684e8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-
-namespace Tizen.Multimedia.MediaController
-{
-    /// <summary>
-    /// ServerInformation represents a name and state of server application.
-    /// </summary>
-    public class ServerInformation
-    {
-        internal ServerInformation(string name, MediaControllerServerState state)
-        {
-            Name = name;
-            State = state;
-        }
-
-        /// <summary>
-        /// Get the Name of server
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string Name { get; }
-
-        /// <summary>
-        /// Get the State of server
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public MediaControllerServerState State { get; }
-    }
-}
-
diff --git a/src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs
deleted file mode 100755 (executable)
index 1fa8319..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-using System;
-
-namespace Tizen.Multimedia.MediaController
-{
-
-    /// <summary>
-    /// ServerUpdated event arguments
-    /// </summary>
-    /// <remarks>
-    /// ServerUpdated event arguments
-    /// </remarks>
-    public class ServerUpdatedEventArgs : EventArgs
-    {
-        internal ServerUpdatedEventArgs(string name, MediaControllerServerState state)
-        {
-            ServerInfo = new ServerInformation(name, state);
-        }
-
-        /// <summary>
-        /// Get the Server Information.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public ServerInformation ServerInfo { get; }
-    }
-}
-
index 6d5a5c3..7905803 100755 (executable)
@@ -1,49 +1,41 @@
 /*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the License);
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an AS IS BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 using System;
 
-namespace Tizen.Multimedia.MediaController
+namespace Tizen.Multimedia.Remoting
 {
-
     /// <summary>
-    /// ShuffleModeUpdated event arguments
+    /// Provides data for the <see cref="MediaController.ShuffleModeUpdated"/> event.
     /// </summary>
-    /// <remarks>
-    /// ShuffleModeUpdated event arguments
-    /// </remarks>
     public class ShuffleModeUpdatedEventArgs : EventArgs
     {
-        internal ShuffleModeUpdatedEventArgs(string name, MediaControllerShuffleMode mode)
-        {
-            ServerName = name;
-            ShuffleMode = mode;
-        }
-
         /// <summary>
-        /// Get the Server Name.
+        /// Initializes a new instance of the <see cref="ShuffleModeUpdatedEventArgs"/> class.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public string ServerName { get; }
+        /// <param name="enabled">A value indicating whether the shuffle mode is enabled.</param>
+        public ShuffleModeUpdatedEventArgs(bool enabled)
+        {
+            Enabled = enabled;
+        }
 
         /// <summary>
-        /// Get the Shuffle Mode.
+        /// Gets a value indicating whether the shuffle mode is enabled.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public MediaControllerShuffleMode ShuffleMode { get; }
+        /// <value>true if the shuffle mode is enabled; otherwise, false.</value>
+        public bool Enabled { get; }
     }
-}
-
+}
\ No newline at end of file