From: hsgwon Date: Mon, 16 Sep 2019 07:11:02 +0000 (+0900) Subject: [MediaController] Add new APIs for subtitle, 360 mode, display mode/rotation (#997) X-Git-Tag: submit/tizen/20190916.162103~1^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4dda76b8ea62766ae369adf42486f00caaf781e4;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [MediaController] Add new APIs for subtitle, 360 mode, display mode/rotation (#997) * [MediaController] Add new APIs for subtitle, 360 mode, display mode, display rotation --- diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerClient.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerClient.cs index 9489e6207..8bd2e1822 100644 --- a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerClient.cs +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerClient.cs @@ -23,6 +23,12 @@ internal static partial class Interop { internal static partial class MediaControllerClient { + #region Callback delegate + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ActivatedServerCallback(string serverName, IntPtr userData); + + + // Updated callbacks [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void ServerUpdatedCallback(string serverName, MediaControllerNativeServerState serverState, IntPtr userData); @@ -35,17 +41,40 @@ internal static partial class Interop IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RepeatModeUpdatedCallback(string serverName, MediaControllerNativeRepeatMode repeatMode, IntPtr userData); + internal delegate void RepeatModeUpdatedCallback(string serverName, MediaControllerNativeRepeatMode repeatMode, + IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool ActivatedServerCallback(string serverName, IntPtr userData); + internal delegate void DisplayModeUpdatedCallback(string serverName, MediaControlNativeDisplayMode isEnabned, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DisplayRotationUpdatedCallback(string serverName, MediaControlNativeDisplayRotation isEnabned, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BoolAttributeUpdatedCallback(string serverName, bool isEnabled, IntPtr userData); + + + // Capability updated callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackCapabilityUpdatedCallback(string serverName, IntPtr capaHandle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CategoryAttributeCapabilityUpdatedCallback(string serverName, uint updatedItem, + IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SimpleCapabilityUpdatedCallback(string serverName, MediaControlNativeCapabilityCategory category, + MediaControlCapabilitySupport support, IntPtr userData); + + + // Command callbacks [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void CommandCompletedCallback(string serverName, string requestId, MediaControllerError result, IntPtr bundleHandle, IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void CustomCommandReceivedCallback(string serverName, string requestId, string customEvent, IntPtr bundleHandle, IntPtr userData); + #endregion Callback delegate [DllImport(Libraries.MediaController, EntryPoint = "mc_client_create")] @@ -54,6 +83,68 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy")] internal static extern MediaControllerError Destroy(IntPtr handle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_playback")] + internal static extern MediaControllerError DestroyPlayback(IntPtr playback); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server")] + internal static extern MediaControllerError ForeachActivatedServer(MediaControllerClientHandle handle, + ActivatedServerCallback callback, IntPtr userData); + + + #region Get information + // Playback information + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_playback_info")] + internal static extern MediaControllerError GetServerPlaybackHandle(MediaControllerClientHandle handle, + string serverName, out IntPtr playback); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_state")] + internal static extern MediaControllerError GetPlaybackState(IntPtr playbackHandle, out MediaControllerNativePlaybackState state); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_position")] + internal static extern MediaControllerError GetPlaybackPosition(IntPtr playbackHandle, out ulong position); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_age_rating")] + internal static extern MediaControllerError GetAgeRating(IntPtr playbackHandle, out int rating); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_content_type")] + internal static extern MediaControllerError GetPlaybackContentType(IntPtr playbackHandle, + out MediaControlContentType type); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_latest_server_info")] + internal static extern MediaControllerError GetLatestServer(MediaControllerClientHandle handle, + out IntPtr serverName, out MediaControllerNativeServerState serverState); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_shuffle_mode")] + internal static extern MediaControllerError GetServerShuffleMode(MediaControllerClientHandle handle, + string serverName, out MediaControllerNativeShuffleMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_repeat_mode")] + internal static extern MediaControllerError GetServerRepeatMode(MediaControllerClientHandle handle, + string serverName, out MediaControllerNativeRepeatMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_icon")] + internal static extern MediaControllerError GetServerIcon(MediaControllerClientHandle clientHandle, + string serverName, out string uri); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_subtitle_enabled")] + internal static extern MediaControllerError IsSubtitleEnabled(MediaControllerClientHandle clientHandle, + string serverName, out bool isEnabled); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_360_mode_enabled")] + internal static extern MediaControllerError IsMode360Enabled(MediaControllerClientHandle clientHandle, + string serverName, out bool isEnabled); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_display_mode")] + internal static extern MediaControllerError GetDisplayMode(MediaControllerClientHandle clientHandle, + string serverName, out MediaControlNativeDisplayMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_display_rotation")] + internal static extern MediaControllerError GetDisplayRotation(MediaControllerClientHandle clientHandle, + string serverName, out MediaControlNativeDisplayRotation mode); + #endregion Get information + + + #region Updated callback [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_server_updated_cb")] internal static extern MediaControllerError SetServerUpdatedCb(MediaControllerClientHandle handle, ServerUpdatedCallback callback, IntPtr userData = default(IntPtr)); @@ -82,57 +173,95 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_repeat_mode_updated_cb")] internal static extern MediaControllerError UnsetRepeatModeUpdatedCb(MediaControllerClientHandle handle); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_cmd_reply_received_cb")] - internal static extern MediaControllerError SetCommandCompletedCb(MediaControllerClientHandle handle, - CommandCompletedCallback callback, IntPtr userData = default(IntPtr)); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_subtitle_updated_cb")] + internal static extern MediaControllerError SetSubtitleUpdatedCb(MediaControllerClientHandle handle, + BoolAttributeUpdatedCallback callback, IntPtr userData = default(IntPtr)); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_cmd_reply_received_cb")] - internal static extern MediaControllerError UnsetCommandCompletedCb(MediaControllerClientHandle handle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_360_mode_updated_cb")] + internal static extern MediaControllerError SetMode360UpdatedCb(MediaControllerClientHandle handle, + BoolAttributeUpdatedCallback callback, IntPtr userData = default(IntPtr)); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_custom_event_received_cb")] - internal static extern MediaControllerError SetCustomEventCb(MediaControllerClientHandle handle, - CustomCommandReceivedCallback callback, IntPtr userData = default(IntPtr)); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_display_mode_updated_cb")] + internal static extern MediaControllerError SetDisplayModeUpdatedCb(MediaControllerClientHandle handle, + DisplayModeUpdatedCallback callback, IntPtr userData = default(IntPtr)); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_custom_event_received_cb")] - internal static extern MediaControllerError UnsetCustomEventCb(MediaControllerClientHandle handle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_display_rotation_updated_cb")] + internal static extern MediaControllerError SetDisplayRotationUpdatedCb(MediaControllerClientHandle handle, + DisplayRotationUpdatedCallback callback, IntPtr userData = default(IntPtr)); + #endregion Updated callback - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_state")] - internal static extern MediaControllerError GetPlaybackState(IntPtr playback, out MediaControllerNativePlaybackState state); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_position")] - internal static extern MediaControllerError GetPlaybackPosition(IntPtr playback, out ulong position); + #region Capability + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_playback_ability")] + internal static extern MediaControllerError GetPlaybackCapabilityHandle(MediaControllerClientHandle clientHandle, + string serverName, out IntPtr capaHandle); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_playback")] - internal static extern MediaControllerError DestroyPlayback(IntPtr playback); + [DllImport(Libraries.MediaController, EntryPoint = "mc_playback_action_is_supported")] + internal static extern MediaControllerError GetPlaybackCapability(IntPtr capaHandle, + MediaControllerNativePlaybackAction action, out MediaControlCapabilitySupport support); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_latest_server_info")] - internal static extern MediaControllerError GetLatestServer(MediaControllerClientHandle handle, - out IntPtr serverName, out MediaControllerNativeServerState serverState); + [DllImport(Libraries.MediaController, EntryPoint = "mc_playback_ability_destroy")] + internal static extern MediaControllerError DestroyCapability(IntPtr capaHandle); - [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_playback_ability_clone")] + internal static extern MediaControllerError CloneCapability(IntPtr capaSrcHandle, out IntPtr capaDstHandle); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_shuffle_mode")] - internal static extern MediaControllerError GetServerShuffleMode(MediaControllerClientHandle handle, - string serverName, out MediaControllerNativeShuffleMode mode); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_display_mode_ability")] + internal static extern MediaControllerError GetDisplayModeCapability(MediaControllerClientHandle clientHandle, + string serverName, out uint support); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_repeat_mode")] - internal static extern MediaControllerError GetServerRepeatMode(MediaControllerClientHandle handle, - string serverName, out MediaControllerNativeRepeatMode mode); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_display_rotation_ability")] + internal static extern MediaControllerError GetDisplayRotationCapability(MediaControllerClientHandle clientHandle, + string serverName, out uint support); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_playback_state_command")] - internal static extern MediaControllerError SendPlaybackStateCommand(MediaControllerClientHandle handle, - string serverName, MediaControllerNativePlaybackAction command); + // Common + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_ability_support")] + internal static extern MediaControllerError GetSimpleCapability(MediaControllerClientHandle clientHandle, + string serverName, MediaControlNativeCapabilityCategory category, out MediaControlCapabilitySupport type); + #endregion Capability - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_custom_cmd")] - internal static extern MediaControllerError SendCustomCommandBundle(MediaControllerClientHandle handle, - string serverName, string command, SafeBundleHandle bundleHandle, out string requestId); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_custom_cmd")] - internal static extern MediaControllerError SendCustomCommand(MediaControllerClientHandle handle, - string serverName, string command, IntPtr bundleHandle, out string requestId); + #region Capability updated callback + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_playback_ability_updated_cb")] + internal static extern MediaControllerError SetPlaybackCapabilityUpdatedCb(MediaControllerClientHandle clientHandle, + PlaybackCapabilityUpdatedCallback callback, IntPtr userData = default(IntPtr)); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_playback_ability_updated_cb")] + internal static extern MediaControllerError UnsetPlaybackCapabilityUpdatedCb(MediaControllerClientHandle clientHandle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_display_mode_ability_updated_cb")] + internal static extern MediaControllerError SetDisplayModeCapabilityUpdatedCb(MediaControllerClientHandle clientHandle, + CategoryAttributeCapabilityUpdatedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_display_rotation_ability_updated_cb")] + internal static extern MediaControllerError SetDisplayRotationCapabilityUpdatedCb(MediaControllerClientHandle clientHandle, + CategoryAttributeCapabilityUpdatedCallback callback, IntPtr userData = default(IntPtr)); + + // Common + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_ability_support_updated_cb")] + internal static extern MediaControllerError SetCategoryCapabilityUpdatedCb(MediaControllerClientHandle clientHandle, + SimpleCapabilityUpdatedCallback callback, IntPtr userData = default(IntPtr)); + #endregion Capability updated callback + + + #region Search + [DllImport(Libraries.MediaController, EntryPoint = "mc_search_create")] + internal static extern MediaControllerError CreateSearchHandle(out IntPtr searchHandle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_search_set_condition")] + internal static extern MediaControllerError SetSearchCondition(IntPtr searchHandle, + MediaControlContentType type, MediaControlSearchCategory category, string keyword, IntPtr bundle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_search_set_condition")] + internal static extern MediaControllerError SetSearchConditionBundle(IntPtr searchHandle, + MediaControlContentType type, MediaControlSearchCategory category, string keyword, SafeBundleHandle bundle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_search_destroy")] + internal static extern MediaControllerError DestroySearchHandle(IntPtr searchHandle); + #endregion Search + + + #region Command [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_playback_action_cmd")] internal static extern MediaControllerError SendPlaybackActionCommand(MediaControllerClientHandle handle, string serverName, MediaControllerNativePlaybackAction action, out string requestId); @@ -162,92 +291,54 @@ internal static partial class Interop internal static extern MediaControllerError SendSearchCommand(MediaControllerClientHandle handle, string serverName, IntPtr searchHandle, out string requestId); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_event_reply")] - internal static extern MediaControllerError SendCustomEventReply(MediaControllerClientHandle handle, - string serverName, string requestId, int result, IntPtr bundleHandle); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_event_reply")] - internal static extern MediaControllerError SendCustomEventReplyBundle(MediaControllerClientHandle handle, - string serverName, string requestId, int result, SafeBundleHandle bundleHandle); - - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server")] - internal static extern MediaControllerError ForeachActivatedServer(MediaControllerClientHandle handle, - ActivatedServerCallback callback, IntPtr userData); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_subtitle_cmd")] + internal static extern MediaControllerError SendSubtitleModeCommand(MediaControllerClientHandle handle, + string serverName, bool isEnabled, out string requestId); - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_age_rating")] - internal static extern MediaControllerError GetAgeRating(IntPtr playbackHandle, out int rating); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_360_mode_cmd")] + internal static extern MediaControllerError SendMode360Command(MediaControllerClientHandle handle, + string serverName, bool isEnabled, out string requestId); - #region Capability - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void PlaybackCapabilityUpdatedCallback(string serverName, IntPtr capaHandle, - IntPtr userData = default(IntPtr)); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_display_mode_cmd")] + internal static extern MediaControllerError SendDisplayModeCommand(MediaControllerClientHandle handle, + string serverName, MediaControlNativeDisplayMode mode, out string requestId); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void ShuffleCapabilityUpdatedCallback(string serverName, MediaControlCapabilitySupport support, - IntPtr userData = default(IntPtr)); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RepeatCapabilityUpdatedCallback(string serverName, MediaControlCapabilitySupport support, - IntPtr userData = default(IntPtr)); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_display_rotation_cmd")] + internal static extern MediaControllerError SendDisplayRotationCommand(MediaControllerClientHandle handle, + string serverName, MediaControlNativeDisplayRotation mode, out string requestId); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void SimpleCapabilityCallback(string serverName, MediaControlCapabilityCategory category, - MediaControlCapabilitySupport support, IntPtr userData = default(IntPtr)); - - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_content_type")] - internal static extern MediaControllerError GetPlaybackContentType(IntPtr playbackHandle, - out MediaControlContentType type); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_icon")] - internal static extern MediaControllerError GetServerIcon(MediaControllerClientHandle clientHandle, - string serverName, out string uri); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_playback_ability")] - internal static extern MediaControllerError GetPlaybackCapabilityHandle(MediaControllerClientHandle clientHandle, - string serverName, out IntPtr capaHandle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_playback_ability_updated_cb")] - internal static extern MediaControllerError SetPlaybackCapabilityUpdatedCb(MediaControllerClientHandle clientHandle, - PlaybackCapabilityUpdatedCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_playback_ability_updated_cb")] - internal static extern MediaControllerError UnsetPlaybackCapabilityUpdatedCb(MediaControllerClientHandle clientHandle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_ability_support_updated_cb")] - internal static extern MediaControllerError SetSimpleCapabilityUpdatedCb(MediaControllerClientHandle clientHandle, - SimpleCapabilityCallback callback, IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_ability_support")] - internal static extern MediaControllerError GetSimpleCapability(MediaControllerClientHandle clientHandle, - string serverName, MediaControlCapabilityCategory category, out MediaControlCapabilitySupport type); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_custom_cmd")] + internal static extern MediaControllerError SendCustomCommandBundle(MediaControllerClientHandle handle, + string serverName, string command, SafeBundleHandle bundleHandle, out string requestId); - [DllImport(Libraries.MediaController, EntryPoint = "mc_playback_ability_clone")] - internal static extern MediaControllerError CloneCapability(IntPtr capaSrcHandle, out IntPtr capaDstHandle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_custom_cmd")] + internal static extern MediaControllerError SendCustomCommand(MediaControllerClientHandle handle, + string serverName, string command, IntPtr bundleHandle, out string requestId); - [DllImport(Libraries.MediaController, EntryPoint = "mc_playback_ability_destroy")] - internal static extern MediaControllerError DestroyCapability(IntPtr capaHandle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_cmd_reply_received_cb")] + internal static extern MediaControllerError SetCommandCompletedCb(MediaControllerClientHandle handle, + CommandCompletedCallback callback, IntPtr userData = default(IntPtr)); - [DllImport(Libraries.MediaController, EntryPoint = "mc_playback_action_is_supported")] - internal static extern MediaControllerError IsCapabilitySupported(IntPtr capaHandle, - MediaControllerNativePlaybackAction action, out MediaControlCapabilitySupport support); - #endregion Capability + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_cmd_reply_received_cb")] + internal static extern MediaControllerError UnsetCommandCompletedCb(MediaControllerClientHandle handle); + #endregion Command - #region Search - [DllImport(Libraries.MediaController, EntryPoint = "mc_search_create")] - internal static extern MediaControllerError CreateSearchHandle(out IntPtr searchHandle); - [DllImport(Libraries.MediaController, EntryPoint = "mc_search_set_condition")] - internal static extern MediaControllerError SetSearchCondition(IntPtr searchHandle, - MediaControlContentType type, MediaControlSearchCategory category, string keyword, IntPtr bundle); + #region Event + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_custom_event_received_cb")] + internal static extern MediaControllerError SetCustomEventCb(MediaControllerClientHandle handle, + CustomCommandReceivedCallback callback, IntPtr userData = default(IntPtr)); - [DllImport(Libraries.MediaController, EntryPoint = "mc_search_set_condition")] - internal static extern MediaControllerError SetSearchConditionBundle(IntPtr searchHandle, - MediaControlContentType type, MediaControlSearchCategory category, string keyword, SafeBundleHandle bundle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_custom_event_received_cb")] + internal static extern MediaControllerError UnsetCustomEventCb(MediaControllerClientHandle handle); - [DllImport(Libraries.MediaController, EntryPoint = "mc_search_destroy")] - internal static extern MediaControllerError DestroySearchHandle(IntPtr searchHandle); - #endregion Search + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_event_reply")] + internal static extern MediaControllerError SendCustomEventReply(MediaControllerClientHandle handle, + string serverName, string requestId, int result, IntPtr bundleHandle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_event_reply")] + internal static extern MediaControllerError SendCustomEventReplyBundle(MediaControllerClientHandle handle, + string serverName, string requestId, int result, SafeBundleHandle bundleHandle); + #endregion Event } internal class MediaControllerClientHandle : SafeHandle diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs index 63c905d6c..50b76827a 100644 --- a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs @@ -23,6 +23,12 @@ internal static partial class Interop { internal static partial class MediaControllerServer { + #region Callback delegate + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ActivatedClientCallback(string clientName, IntPtr userData); + + + // Received callbacks [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void PlaybackStateCommandReceivedCallback(string clientName, MediaControllerNativePlaybackAction nativeAction, IntPtr userData); @@ -42,22 +48,30 @@ internal static partial class Interop [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void ShuffleModeCommandReceivedCallback(string clientName, - string requestId, MediaControllerNativeShuffleMode shuffleMode, IntPtr userData); + string requestId, MediaControllerNativeShuffleMode mode, IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void RepeatModeCommandReceivedCallback(string clientName, - string requestId, MediaControllerNativeRepeatMode repeatMode, IntPtr userData); + string requestId, MediaControllerNativeRepeatMode mode, IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void CustomCommandReceivedCallback(string clientName, - string requestId, string customCommand, IntPtr bundleHandle, IntPtr userData); + internal delegate void DisplayModeCommandReceivedCallback(string clientName, + string requestId, MediaControlNativeDisplayMode mode, IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool PlaylistCallback(IntPtr handle, IntPtr userData); + internal delegate void DisplayRotationCommandReceivedCallback(string clientName, + string requestId, MediaControlNativeDisplayRotation rotation, IntPtr userData); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool ActivatedClientCallback(string clientName, IntPtr userData); + internal delegate void SimpleCommandReceivedCallback(string clientName, + string requestId, bool isEnabled, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CustomCommandReceivedCallback(string clientName, + string requestId, string customCommand, IntPtr bundleHandle, IntPtr userData); + + // Command callbacks [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void CommandCompletedCallback(string clientName, string requestId, MediaControllerError result, IntPtr bundleHandle, IntPtr userData = default(IntPtr)); @@ -66,9 +80,12 @@ internal static partial class Interop internal delegate void SearchCommandReceivedCallback(string clientName, string requestId, IntPtr searchHandle, IntPtr userData = default(IntPtr)); + + // Search callback [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate bool SearchItemCallback(MediaControlContentType type, MediaControlSearchCategory category, string keyword, IntPtr bundleHandle, IntPtr userData = default(IntPtr)); + #endregion Callback delegate [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create")] @@ -77,6 +94,12 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_server_destroy")] internal static extern MediaControllerError Destroy(IntPtr handle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_foreach_client")] + internal static extern MediaControllerError ForeachActivatedClient(IntPtr handle, ActivatedClientCallback callback, + IntPtr userData = default(IntPtr)); + + + #region Set information [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state")] internal static extern MediaControllerError SetPlaybackState(IntPtr handle, MediaControllerNativePlaybackState state); @@ -101,6 +124,24 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_repeat_mode")] internal static extern MediaControllerError UpdateRepeatMode(IntPtr handle, MediaControllerNativeRepeatMode mode); + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_content_age_rating")] + internal static extern MediaControllerError SetAgeRating(IntPtr handle, int rating); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_subtitle_enabled")] + internal static extern MediaControllerError UpdateSubtitleMode(IntPtr handle, bool isEnabled); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_360_mode_enabled")] + internal static extern MediaControllerError UpdateMode360(IntPtr handle, bool isEnabled); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_display_mode")] + internal static extern MediaControllerError UpdateDisplayMode(IntPtr handle, MediaControlNativeDisplayMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_display_rotation")] + internal static extern MediaControllerError UpdateDisplayRotaton(IntPtr handle, MediaControlNativeDisplayRotation rotation); + #endregion Set information + + + #region Received callback [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_action_cmd_received_cb")] internal static extern MediaControllerError SetPlaybackActionCommandReceivedCb(IntPtr handle, PlaybackActionCommandReceivedCallback callback, IntPtr userData = default(IntPtr)); @@ -136,6 +177,22 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_repeat_mode_cmd_received_cb")] internal static extern MediaControllerError UnsetRepeatModeCommandReceivedCb(IntPtr handle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_subtitle_cmd_received_cb")] + internal static extern MediaControllerError SetSubtitleModeCommandReceivedCb(IntPtr handle, + SimpleCommandReceivedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_360_mode_cmd_received_cb")] + internal static extern MediaControllerError SetMode360CommandReceivedCb(IntPtr handle, + SimpleCommandReceivedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_display_mode_cmd_received_cb")] + internal static extern MediaControllerError SetDisplayModeCommandReceivedCb(IntPtr handle, + DisplayModeCommandReceivedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_display_rotation_cmd_received_cb")] + internal static extern MediaControllerError SetDisplayRotationCommandReceivedCb(IntPtr handle, + DisplayRotationCommandReceivedCallback callback, IntPtr userData = default(IntPtr)); + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_custom_cmd_received_cb")] internal static extern MediaControllerError SetCustomCommandReceivedCb(IntPtr handle, CustomCommandReceivedCallback callback, IntPtr userData = default(IntPtr)); @@ -149,15 +206,10 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_search_cmd_received_cb")] internal static extern MediaControllerError UnsetSearchCommandReceivedCb(IntPtr handle); + #endregion Received callback - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_cmd_reply")] - internal static extern MediaControllerError SendCommandReplyBundle(IntPtr handle, - string appId, string requestID, int result, SafeBundleHandle bundleHandle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_cmd_reply")] - internal static extern MediaControllerError SendCommandReply(IntPtr handle, - string appId, string requestID, int result, IntPtr bundleHandle); + #region Database [DllImport(Libraries.MediaController, EntryPoint = "mc_db_connect")] internal static extern MediaControllerError ConnectDb(out IntPtr dbHandle); @@ -166,7 +218,10 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_db_check_server_table_exist")] internal static extern MediaControllerError CheckServerExist(IntPtr dbHandle, string appId, out bool value); + #endregion Database + + #region Playlist [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create_playlist")] internal static extern MediaControllerError CreatePlaylist(IntPtr handle, string name, out IntPtr playlist); @@ -185,28 +240,7 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playlist_done")] internal static extern MediaControllerError SavePlaylist(IntPtr handle, IntPtr playlist); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_foreach_client")] - internal static extern MediaControllerError ForeachActivatedClient(IntPtr handle, ActivatedClientCallback callback, - IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_custom_event")] - internal static extern MediaControllerError SendCustomEvent(IntPtr handle, string appId, string customEvent, - IntPtr bundle, out string requestId); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_custom_event")] - internal static extern MediaControllerError SendCustomEventBundle(IntPtr handle, string appId, string customEvent, - SafeBundleHandle bundle, out string requestId); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_event_reply_received_cb")] - internal static extern MediaControllerError SetEventReceivedCb(IntPtr handle, CommandCompletedCallback callback, - IntPtr userData = default(IntPtr)); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_event_reply_received_cb")] - internal static extern MediaControllerError UnsetEventReceivedCb(IntPtr handle); - - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_content_age_rating")] - internal static extern MediaControllerError SetAgeRating(IntPtr handle, int rating); + #endregion Playlist #region Capability @@ -224,11 +258,20 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playback_ability")] internal static extern MediaControllerError SaveAndNotifyPlaybackCapabilityUpdated(IntPtr serverHandle); + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_display_mode_ability")] + internal static extern MediaControllerError SetDisplayModeCapability(IntPtr serverHandle, + uint modes, MediaControlCapabilitySupport support); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_display_rotation_ability")] + internal static extern MediaControllerError SetDisplayRotationCapability(IntPtr serverHandle, + uint rotations, MediaControlCapabilitySupport support); + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_ability_support")] internal static extern MediaControllerError SetSimpleCapability(IntPtr serverHandle, - MediaControlCapabilityCategory category, MediaControlCapabilitySupport support); + MediaControlNativeCapabilityCategory category, MediaControlCapabilitySupport support); #endregion Capability + #region Search [DllImport(Libraries.MediaController, EntryPoint = "mc_search_foreach_condition")] internal static extern MediaControllerError ForeachSearchCondition(IntPtr serverHandle, @@ -241,5 +284,34 @@ internal static partial class Interop internal static extern MediaControllerError DestroySearchHandle(IntPtr searchHandle); #endregion Search + + + #region Command + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_cmd_reply")] + internal static extern MediaControllerError SendCommandReplyBundle(IntPtr handle, + string appId, string requestID, int result, SafeBundleHandle bundleHandle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_cmd_reply")] + internal static extern MediaControllerError SendCommandReply(IntPtr handle, + string appId, string requestID, int result, IntPtr bundleHandle); + #endregion Command + + + #region Event + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_custom_event")] + internal static extern MediaControllerError SendCustomEvent(IntPtr handle, string appId, string customEvent, + IntPtr bundle, out string requestId); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_custom_event")] + internal static extern MediaControllerError SendCustomEventBundle(IntPtr handle, string appId, string customEvent, + SafeBundleHandle bundle, out string requestId); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_event_reply_received_cb")] + internal static extern MediaControllerError SetEventReceivedCb(IntPtr handle, CommandCompletedCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_event_reply_received_cb")] + internal static extern MediaControllerError UnsetEventReceivedCb(IntPtr handle); + #endregion Event } } diff --git a/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeCapabilityUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeCapabilityUpdatedEventArgs.cs new file mode 100644 index 000000000..9470bf1c5 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeCapabilityUpdatedEventArgs.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019 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.Collections.ObjectModel; + +namespace Tizen.Multimedia.Remoting +{ + /// + /// Provides data for the event. + /// + /// 6 + public class DisplayModeCapabilityUpdatedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// The supported list of display mode capabilities. + /// 6 + internal DisplayModeCapabilityUpdatedEventArgs(IList mode) + { + DisplayMode = new ReadOnlyCollection(mode); + } + + /// + /// Gets the supported list of display mode capabilities. + /// + /// 6 + public ReadOnlyCollection DisplayMode { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeCommandReceivedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeCommandReceivedEventArgs.cs new file mode 100644 index 000000000..9bc1fa945 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeCommandReceivedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Provides data for the event. + /// + /// 6 + public class DisplayModeCommandReceivedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// The display mode command. + /// is null. + /// 6 + internal DisplayModeCommandReceivedEventArgs(DisplayModeCommand command) + { + Command = command ?? throw new ArgumentNullException(nameof(command)); + } + + /// + /// Gets the . + /// + /// 6 + public DisplayModeCommand Command { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeUpdatedEventArgs.cs new file mode 100644 index 000000000..83daca925 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/DisplayModeUpdatedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Provides data for the event. + /// + /// 6 + public class DisplayModeUpdatedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// A value indicating the updated display mode. + /// 6 + internal DisplayModeUpdatedEventArgs(MediaControlDisplayMode mode) + { + DisplayMode = mode; + } + + /// + /// Gets the updated display mode. + /// + /// The . + /// 6 + public MediaControlDisplayMode DisplayMode { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationCapabilityUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationCapabilityUpdatedEventArgs.cs new file mode 100644 index 000000000..0daf0d1ff --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationCapabilityUpdatedEventArgs.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019 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.Collections.ObjectModel; + +namespace Tizen.Multimedia.Remoting +{ + /// + /// Provides data for the event. + /// + /// 6 + public class DisplayRotationCapabilityUpdatedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// The list of supported display rotation capabilities. + /// 6 + internal DisplayRotationCapabilityUpdatedEventArgs(IList rotation) + { + DisplayRotation = new ReadOnlyCollection(rotation); + } + + /// + /// Gets the supported list of display rotation capabilities. + /// + /// 6 + public ReadOnlyCollection DisplayRotation { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationCommandReceivedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationCommandReceivedEventArgs.cs new file mode 100644 index 000000000..3543289f0 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationCommandReceivedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Provides data for the event. + /// + /// 6 + public class DisplayRotationCommandReceivedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// The display rotation command. + /// is null. + /// 6 + internal DisplayRotationCommandReceivedEventArgs(DisplayRotationCommand command) + { + Command = command ?? throw new ArgumentNullException(nameof(command)); + } + + /// + /// Gets the . + /// + /// 6 + public DisplayRotationCommand Command { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationUpdatedEventArgs.cs new file mode 100644 index 000000000..0e94c5b38 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/DisplayRotationUpdatedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Provides data for the event. + /// + /// 6 + public class DisplayRotationUpdatedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// A value indicating the updated display rotation. + /// 6 + internal DisplayRotationUpdatedEventArgs(Rotation rotation) + { + Rotation = rotation; + } + + /// + /// Gets the updated display rotation. + /// + /// The . + /// 6 + public Rotation Rotation { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/InternalEnums.cs b/src/Tizen.Multimedia.Remoting/MediaController/InternalEnums.cs index 9b3d0ad13..df5aa6b01 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/InternalEnums.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/InternalEnums.cs @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +using System; namespace Tizen.Multimedia.Remoting { @@ -82,7 +83,7 @@ namespace Tizen.Multimedia.Remoting Resolution } - internal enum MediaControlCapabilityCategory + internal enum MediaControlNativeCapabilityCategory { Shuffle, Repeat, @@ -93,4 +94,24 @@ namespace Tizen.Multimedia.Remoting Subtitle, Mode360 } + + [Flags] + internal enum MediaControlNativeDisplayMode + { + LetterBox = 1, + OriginSize = 2, + FullScreen = 4, + CroppedFull = 8, + All = LetterBox | OriginSize | FullScreen | CroppedFull + } + + [Flags] + internal enum MediaControlNativeDisplayRotation + { + Rotate0 = 1, + Rotate90 = 2, + Rotate180 = 4, + Rotate270 = 8, + All = Rotate0 | Rotate90 | Rotate180 | Rotate270 + } } \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlCommand.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlCommand.cs index 82730a3ff..1f0e07bd9 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlCommand.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlCommand.cs @@ -356,6 +356,136 @@ namespace Tizen.Multimedia.Remoting } } + /// + /// Provides a means to to send subtitle mode command. + /// + /// 6 + public sealed class SubtitleModeCommand : Command + { + /// + /// Initializes a new instance of the class. + /// + /// A value indicating whether subtitle mode is enabled. + /// 6 + public SubtitleModeCommand(bool isEnabled) + { + IsEnabled = isEnabled; + } + + /// + /// Gets a value indicating whether subtitle mode is enabled or not. + /// + /// 6 + public bool IsEnabled { get; } + + internal override string Request(NativeClientHandle clientHandle) + { + NativeClient.SendSubtitleModeCommand(clientHandle, ReceiverId, IsEnabled, out string requestId). + ThrowIfError("Failed to send subtitle mode command."); + + return requestId; + } + } + + /// + /// Provides a means to to send 360 mode command. + /// + /// 6 + public sealed class Mode360Command : Command + { + /// + /// Initializes a new instance of the class. + /// + /// A value indicating whether 360 mode is enabled or not. + /// 6 + public Mode360Command(bool isEnabled) + { + IsEnabled = isEnabled; + } + + /// + /// Gets a value indicating whether 360 mode is enabled or not. + /// + /// 6 + public bool IsEnabled { get; } + + internal override string Request(NativeClientHandle clientHandle) + { + NativeClient.SendMode360Command(clientHandle, ReceiverId, IsEnabled, out string requestId). + ThrowIfError("Failed to send 360 mode command."); + + return requestId; + } + } + + /// + /// Provides a means to to send display mode command. + /// + /// 6 + public sealed class DisplayModeCommand : Command + { + /// + /// Initializes a new instance of the class. + /// + /// The . + /// is not valid. + /// 6 + public DisplayModeCommand(MediaControlDisplayMode mode) + { + ValidationUtil.ValidateEnum(typeof(MediaControlDisplayMode), mode, nameof(mode)); + + Mode = mode; + } + + /// + /// Gets the display mode. + /// + /// 6 + public MediaControlDisplayMode Mode { get; } + + internal override string Request(NativeClientHandle clientHandle) + { + NativeClient.SendDisplayModeCommand(clientHandle, ReceiverId, Mode.ToNative(), out string requestId). + ThrowIfError("Failed to send display mode command."); + + return requestId; + } + } + + /// + /// Provides a means to to send display rotation command. + /// + /// 6 + public sealed class DisplayRotationCommand : Command + { + /// + /// Initializes a new instance of the class. + /// + /// The . + /// is not valid. + /// 6 + public DisplayRotationCommand(Rotation rotation) + { + ValidationUtil.ValidateEnum(typeof(Rotation), rotation, nameof(rotation)); + + Rotation = rotation; + } + + /// + /// Gets the display rotation. + /// + /// 6 + public Rotation Rotation { get; } + + internal override string Request(NativeClientHandle clientHandle) + { + NativeClient.SendDisplayRotationCommand(clientHandle, ReceiverId, Rotation.ToNative(), out string requestId). + ThrowIfError("Failed to send display rotation command."); + + return requestId; + } + } + /// /// Provides a means to to send custom commands. /// diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlEnums.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlEnums.cs index 7a3bd624f..1d84f55b6 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlEnums.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlEnums.cs @@ -15,6 +15,7 @@ */ using System; +using System.Collections.Generic; using System.Diagnostics; namespace Tizen.Multimedia.Remoting @@ -248,6 +249,33 @@ namespace Tizen.Multimedia.Remoting Tpo } + /// + /// Specifies the display mode. + /// + /// 6 + public enum MediaControlDisplayMode + { + /// + /// Letter box + /// + LetterBox, + + /// + /// Original size + /// + OriginSize, + + /// + /// Full screen + /// + FullScreen, + + /// + /// Cropped full screen + /// + CroppedFull + } + internal static class EnumExtensions { internal static MediaControlPlaybackState ToPublic(this MediaControllerNativePlaybackState nativeState) @@ -336,5 +364,125 @@ namespace Tizen.Multimedia.Remoting return mode == MediaControlRepeatMode.Off ? MediaControllerNativeRepeatMode.On : (mode == MediaControlRepeatMode.On ? MediaControllerNativeRepeatMode.Off : MediaControllerNativeRepeatMode.OneMedia); } + + internal static MediaControlNativeDisplayMode ToNative(this MediaControlDisplayMode mode) + { + Debug.Assert(Enum.IsDefined(typeof(MediaControlDisplayMode), mode)); + + MediaControlNativeDisplayMode nativeMode = MediaControlNativeDisplayMode.LetterBox; + switch (mode) + { + case MediaControlDisplayMode.LetterBox: + nativeMode = MediaControlNativeDisplayMode.LetterBox; + break; + case MediaControlDisplayMode.OriginSize: + nativeMode = MediaControlNativeDisplayMode.OriginSize; + break; + case MediaControlDisplayMode.FullScreen: + nativeMode = MediaControlNativeDisplayMode.FullScreen; + break; + case MediaControlDisplayMode.CroppedFull: + nativeMode = MediaControlNativeDisplayMode.CroppedFull; + break; + } + return nativeMode; + } + + internal static MediaControlDisplayMode ToPublic(this MediaControlNativeDisplayMode mode) + { + Debug.Assert(Enum.IsDefined(typeof(MediaControlNativeDisplayMode), mode)); + MediaControlDisplayMode nativeMode = MediaControlDisplayMode.LetterBox; + switch (mode) + { + case MediaControlNativeDisplayMode.LetterBox: + nativeMode = MediaControlDisplayMode.LetterBox; + break; + case MediaControlNativeDisplayMode.OriginSize: + nativeMode = MediaControlDisplayMode.OriginSize; + break; + case MediaControlNativeDisplayMode.FullScreen: + nativeMode = MediaControlDisplayMode.FullScreen; + break; + case MediaControlNativeDisplayMode.CroppedFull: + nativeMode = MediaControlDisplayMode.CroppedFull; + break; + } + return nativeMode; + } + + internal static IList ToPublicList(this MediaControlNativeDisplayMode modes) + { + var supportedModes = new List(); + + foreach (MediaControlNativeDisplayMode mode in Enum.GetValues(typeof(MediaControlNativeDisplayMode))) + { + if (modes.HasFlag(mode)) + { + supportedModes.Add(mode.ToPublic()); + } + } + + return supportedModes.AsReadOnly(); + } + + internal static MediaControlNativeDisplayRotation ToNative(this Rotation mode) + { + Debug.Assert(Enum.IsDefined(typeof(Rotation), mode)); + + MediaControlNativeDisplayRotation nativeMode = MediaControlNativeDisplayRotation.Rotate0; + switch (mode) + { + case Rotation.Rotate0: + nativeMode = MediaControlNativeDisplayRotation.Rotate0; + break; + case Rotation.Rotate90: + nativeMode = MediaControlNativeDisplayRotation.Rotate90; + break; + case Rotation.Rotate180: + nativeMode = MediaControlNativeDisplayRotation.Rotate180; + break; + case Rotation.Rotate270: + nativeMode = MediaControlNativeDisplayRotation.Rotate270; + break; + } + return nativeMode; + } + + internal static Rotation ToPublic(this MediaControlNativeDisplayRotation mode) + { + Debug.Assert(Enum.IsDefined(typeof(MediaControlNativeDisplayRotation), mode)); + Rotation nativeMode = Rotation.Rotate0; + switch (mode) + { + case MediaControlNativeDisplayRotation.Rotate0: + nativeMode = Rotation.Rotate0; + break; + case MediaControlNativeDisplayRotation.Rotate90: + nativeMode = Rotation.Rotate90; + break; + case MediaControlNativeDisplayRotation.Rotate180: + nativeMode = Rotation.Rotate180; + break; + case MediaControlNativeDisplayRotation.Rotate270: + nativeMode = Rotation.Rotate270; + break; + } + return nativeMode; + } + + internal static IList ToPublicList(this MediaControlNativeDisplayRotation modes) + { + var supportedRotations = new List(); + + foreach (MediaControlNativeDisplayRotation mode in Enum.GetValues(typeof(MediaControlNativeDisplayRotation))) + { + if (modes.HasFlag(mode)) + { + supportedRotations.Add(mode.ToPublic()); + } + } + + return supportedRotations.AsReadOnly(); + } } } \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaylist.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaylist.cs index 4a52e82cf..45d218bc7 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaylist.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlPlaylist.cs @@ -245,7 +245,7 @@ namespace Tizen.Multimedia.Remoting } /// - /// Update the playlist by lastest info. + /// Update the playlist by latest info. /// /// 5 public void Update() diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.Events.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.Events.cs index 3320b7dae..466fc1cf0 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.Events.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.Events.cs @@ -29,10 +29,16 @@ namespace Tizen.Multimedia.Remoting private static Native.PlaylistCommandReceivedCallback _playlistCommandCallback; private static Native.ShuffleModeCommandReceivedCallback _shuffleModeCommandCallback; private static Native.RepeatModeCommandReceivedCallback _repeatModeCommandCallback; + private static Native.SimpleCommandReceivedCallback _subtitleModeCommandCallback; + private static Native.SimpleCommandReceivedCallback _mode360CommandCallback; + private static Native.DisplayModeCommandReceivedCallback _displayModeCommandCallback; + private static Native.DisplayRotationCommandReceivedCallback _displayRotationCommandCallback; + private static Native.CustomCommandReceivedCallback _customCommandCallback; private static Native.SearchCommandReceivedCallback _searchCommandCallback; private static Native.CommandCompletedCallback _commandCompletedCallback; + /// /// Occurs when a client sends playback command. /// @@ -70,6 +76,30 @@ namespace Tizen.Multimedia.Remoting /// 5 public static event EventHandler RepeatModeCommandReceived; + /// + /// Occurs when a client sends subtitle mode command. + /// + /// 6 + public static event EventHandler SubtitleModeCommandReceived; + + /// + /// Occurs when a client sends mode 360 command. + /// + /// 6 + public static event EventHandler Mode360CommandReceived; + + /// + /// Occurs when a client sends display mode command. + /// + /// 6 + public static event EventHandler DisplayModeCommandReceived; + + /// + /// Occurs when a client sends display rotation command. + /// + /// 6 + public static event EventHandler DisplayRotationCommandReceived; + /// /// Occurs when a client sends custom command. /// @@ -163,6 +193,58 @@ namespace Tizen.Multimedia.Remoting ThrowIfError("Failed to init RepeatModeCommandReceived event."); } + private static void RegisterSubtitleModeCommandReceivedEvent() + { + _subtitleModeCommandCallback = (clientName, requestId, isEnabled, _) => + { + var command = new SubtitleModeCommand(isEnabled); + command.SetResponseInformation(clientName, requestId); + + SubtitleModeCommandReceived?.Invoke(null, new SubtitleModeCommandReceivedEventArgs(command)); + }; + Native.SetSubtitleModeCommandReceivedCb(Handle, _subtitleModeCommandCallback). + ThrowIfError("Failed to init SubtitleModeCommandReceived event."); + } + + private static void RegisterMode360CommandReceivedEvent() + { + _mode360CommandCallback = (clientName, requestId, isEnabled, _) => + { + var command = new Mode360Command(isEnabled); + command.SetResponseInformation(clientName, requestId); + + Mode360CommandReceived?.Invoke(null, new Mode360CommandReceivedEventArgs(command)); + }; + Native.SetMode360CommandReceivedCb(Handle, _mode360CommandCallback). + ThrowIfError("Failed to init Mode360CommandReceived event."); + } + + private static void RegisterDisplayModeCommandReceivedEvent() + { + _displayModeCommandCallback = (clientName, requestId, mode, _) => + { + var command = new DisplayModeCommand(mode.ToPublic()); + command.SetResponseInformation(clientName, requestId); + + DisplayModeCommandReceived?.Invoke(null, new DisplayModeCommandReceivedEventArgs(command)); + }; + Native.SetDisplayModeCommandReceivedCb(Handle, _displayModeCommandCallback). + ThrowIfError("Failed to init DisplayModeCommandReceived event."); + } + + private static void RegisterDisplayRotationCommandReceivedEvent() + { + _displayRotationCommandCallback = (clientName, requestId, rotation, _) => + { + var command = new DisplayRotationCommand(rotation.ToPublic()); + command.SetResponseInformation(clientName, requestId); + + DisplayRotationCommandReceived?.Invoke(null, new DisplayRotationCommandReceivedEventArgs(command)); + }; + Native.SetDisplayRotationCommandReceivedCb(Handle, _displayRotationCommandCallback). + ThrowIfError("Failed to init DisplayRotationCommandReceived event."); + } + private static void RegisterCustomCommandReceivedEvent() { _customCommandCallback = (clientName, requestId, customCommand, bundleHandle, _) => diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs index 907ef0310..4b788b80c 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs @@ -112,6 +112,10 @@ namespace Tizen.Multimedia.Remoting RegisterPlaylistCommandReceivedEvent(); RegisterShuffleModeCommandReceivedEvent(); RegisterRepeatModeCommandReceivedEvent(); + RegisterSubtitleModeCommandReceivedEvent(); + RegisterMode360CommandReceivedEvent(); + RegisterDisplayModeCommandReceivedEvent(); + RegisterDisplayRotationCommandReceivedEvent(); RegisterCustomCommandReceivedEvent(); RegisterCommandCompletedEvent(); RegisterSearchCommandReceivedEvent(); @@ -169,6 +173,34 @@ namespace Tizen.Multimedia.Remoting _isRunning = false; } + /// + /// Gets the active clients. + /// + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// the activated client ids. + /// 5 + public static IEnumerable GetActivatedClients() + { + var clientIds = new List(); + + Native.ActivatedClientCallback activatedClientCallback = (name, _) => + { + clientIds.Add(name); + return true; + }; + + Native.ForeachActivatedClient(Handle, activatedClientCallback). + ThrowIfError("Failed to get activated client."); + + return clientIds.AsReadOnly(); + } + + + #region Set information /// /// Updates playback state and playback position. /// The playback state. @@ -275,31 +307,6 @@ namespace Tizen.Multimedia.Remoting Native.UpdateRepeatMode(Handle, mode.ToNative()).ThrowIfError("Failed to set repeat mode."); } - /// - /// Sets the index of current playing media. - /// - /// The index of current playing media. - /// is null. - /// - /// The server is not running .
- /// -or-
- /// An internal error occurs. - ///
- /// 5 - [Obsolete("Please do not use! This will be deprecated. Please use SetInfoOfCurrentPlayingMedia instead.")] - public static void SetIndexOfCurrentPlayingMedia(string index) - { - if (index == null) - { - throw new ArgumentNullException(nameof(index)); - } - - Native.SetIndexOfCurrentPlayingMedia(Handle, index) - .ThrowIfError("Failed to set the index of current playing media"); - - Native.UpdatePlayback(Handle).ThrowIfError("Failed to set playback."); - } - /// /// Sets the playlist name and index of current playing media. /// @@ -332,175 +339,160 @@ namespace Tizen.Multimedia.Remoting } /// - /// Delete playlist. + /// Sets the age rating of latest played media. /// - /// The name of playlist. - /// is null. + /// + /// The Age rating of latest played media. The valid range is 0 to 19, inclusive. + /// Especially, 0 means that media is suitable for all ages. + /// + /// The specified is not valid. /// /// The server is not running .
/// -or-
/// An internal error occurs. ///
/// 5 - public static void RemovePlaylist(MediaControlPlaylist playlist) + public static void SetAgeRating(int ageRating) { - if (playlist == null) + if (ageRating < 0 || ageRating > 19) { - throw new ArgumentNullException(nameof(playlist)); + throw new ArgumentOutOfRangeException(nameof(ageRating)); } - Native.DeletePlaylist(Handle, playlist.Handle); - playlist.Dispose(); + Native.SetAgeRating(Handle, ageRating).ThrowIfError("Failed to set age rating."); + + Native.UpdatePlayback(Handle).ThrowIfError("Failed to set playback."); } - // Saves the playlist to the persistent storage. - internal static void SavePlaylist(IntPtr playlistHandle) + /// + /// Sets the subtitle mode. + /// + /// A value indicating whether the subtitle mode is enabled. + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// 6 + public static void SetSubtitleMode(bool isEnabled) { - Native.SavePlaylist(Handle, playlistHandle).ThrowIfError("Failed to save playlist"); + Native.UpdateSubtitleMode(Handle, isEnabled).ThrowIfError("Failed to set subtitle mode."); } - // Gets the playlist handle by name. - internal static IntPtr GetPlaylistHandle(string name) + /// + /// Sets the 360 mode. + /// + /// A value indicating whether the 360 mode is enabled. + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// 6 + public static void SetMode360(bool isEnabled) { - NativePlaylist.GetPlaylistHandle(_serverName, name, out IntPtr playlistHandle). - ThrowIfError("Failed to get playlist handle by name"); - - return playlistHandle; + Native.UpdateMode360(Handle, isEnabled).ThrowIfError("Failed to set 360 mode."); } /// - /// Gets the active clients. + /// Sets the display mode. /// + /// A value indicating the . /// /// The server is not running .
/// -or-
/// An internal error occurs. ///
- /// the activated client ids. - /// 5 - public static IEnumerable GetActivatedClients() + /// 6 + public static void SetDisplayMode(MediaControlDisplayMode mode) { - var clientIds = new List(); - - Native.ActivatedClientCallback activatedClientCallback = (name, _) => - { - clientIds.Add(name); - return true; - }; - - Native.ForeachActivatedClient(Handle, activatedClientCallback). - ThrowIfError("Failed to get activated client."); - - return clientIds.AsReadOnly(); + Native.UpdateDisplayMode(Handle, mode.ToNative()).ThrowIfError("Failed to set display mode."); } /// - /// Requests commands to the client. + /// Sets the display rotation. /// - /// - /// The client can request the command to execute ,
- /// and then, the server receive the result of each request(command). - ///
- /// A class. - /// The client Id to send command. - /// represents the extra data from client and it can be null. - /// - /// or is null. - /// + /// A value indicating the . /// - /// The server has already been stopped.
+ /// The server is not running .
/// -or-
/// An internal error occurs. ///
- /// 5 - public static async Task RequestAsync(Command command, string clientId) + /// 6 + public static void SetDisplayRotation(Rotation rotation) { - if (command == null) - { - throw new ArgumentNullException(nameof(command)); - } - if (clientId == null) - { - throw new ArgumentNullException(nameof(clientId)); - } - - command.SetRequestInformation(clientId); - - var tcs = new TaskCompletionSource(); - string reqeustId = null; - Bundle bundle = null; - - EventHandler eventHandler = (s, e) => - { - if (e.RequestId == reqeustId) - { - bundle = e.Bundle; - tcs.TrySetResult(e.Result); - } - }; - - try - { - CommandCompleted += eventHandler; - - reqeustId = command.Request(Handle); - - (await tcs.Task).ThrowIfError("Failed to request event."); - - return bundle; - } - finally - { - CommandCompleted -= eventHandler; - } + Native.UpdateDisplayRotaton(Handle, rotation.ToNative()).ThrowIfError("Failed to set display rotation."); } /// - /// Sends the result of each command. + /// Sets the index of current playing media. /// - /// The command that return to client. - /// The result of . - /// The extra data. - /// is null. + /// The index of current playing media. + /// is null. /// /// The server is not running .
/// -or-
/// An internal error occurs. ///
/// 5 - public static void Response(Command command, int result, Bundle bundle) + [Obsolete("Please do not use! This will be deprecated. Please use SetInfoOfCurrentPlayingMedia instead.")] + public static void SetIndexOfCurrentPlayingMedia(string index) { - if (command == null) + if (index == null) { - throw new ArgumentNullException(nameof(command)); + throw new ArgumentNullException(nameof(index)); } - command.Response(Handle, result, bundle); + Native.SetIndexOfCurrentPlayingMedia(Handle, index) + .ThrowIfError("Failed to set the index of current playing media"); + + Native.UpdatePlayback(Handle).ThrowIfError("Failed to set playback."); } + #endregion Set information + + #region Playlist /// - /// Sends the result of each command. + /// Delete playlist. /// - /// The command that return to client. - /// The result of . - /// is null. + /// Currently, only server can remove the playlist. + /// The name of playlist. + /// is null. /// /// The server is not running .
/// -or-
/// An internal error occurs. ///
/// 5 - public static void Response(Command command, int result) + public static void RemovePlaylist(MediaControlPlaylist playlist) { - if (command == null) + if (playlist == null) { - throw new ArgumentNullException(nameof(command)); + throw new ArgumentNullException(nameof(playlist)); } - command.Response(Handle, result, null); + Native.DeletePlaylist(Handle, playlist.Handle); + playlist.Dispose(); + } + + // Saves the playlist to the persistent storage. + internal static void SavePlaylist(IntPtr playlistHandle) + { + Native.SavePlaylist(Handle, playlistHandle).ThrowIfError("Failed to save playlist"); } - #region Capabilities + // Gets the playlist handle by name. + internal static IntPtr GetPlaylistHandle(string name) + { + NativePlaylist.GetPlaylistHandle(_serverName, name, out IntPtr playlistHandle). + ThrowIfError("Failed to get playlist handle by name"); + + return playlistHandle; + } + #endregion Playlist + + + #region Capability /// /// Sets the content type of latest played media. /// @@ -605,12 +597,12 @@ namespace Tizen.Multimedia.Remoting { ValidationUtil.ValidateEnum(typeof(MediaControlCapabilitySupport), support, nameof(support)); - Native.SetSimpleCapability(Handle, MediaControlCapabilityCategory.Shuffle, support). + Native.SetSimpleCapability(Handle, MediaControlNativeCapabilityCategory.Shuffle, support). ThrowIfError("Failed to set shuffle mode capability."); } /// - /// Sets the content type of latest played media. + /// Sets the indicating repeat mode is supported or not. /// /// A value indicating whether the is supported or not. /// @@ -624,35 +616,224 @@ namespace Tizen.Multimedia.Remoting { ValidationUtil.ValidateEnum(typeof(MediaControlCapabilitySupport), support, nameof(support)); - Native.SetSimpleCapability(Handle, MediaControlCapabilityCategory.Repeat, support). + Native.SetSimpleCapability(Handle, MediaControlNativeCapabilityCategory.Repeat, support). ThrowIfError("Failed to set repeat mode capability."); } - #endregion Capabilities /// - /// Sets the age rating of latest played media. + /// Sets the supported list of . /// - /// - /// The Age rating of latest played media. The valid range is 0 to 19, inclusive. - /// Especially, 0 means that media is suitable for all ages. - /// - /// The specified is not valid. + /// + /// is not allowed in display mode capability. + /// The default value of each is not supported. + /// + /// The supported list of . + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// is invalid. + /// 6 + public static void SetDisplayModeCapabilities(IDictionary capabilities) + { + foreach (var pair in capabilities) + { + SetDisplayModeCapability(pair.Key, pair.Value); + } + } + + /// + /// Sets the is supported or not. + /// + /// + /// is not allowed in display mode capability.
+ /// The default value of each is not supported. + ///
+ /// The . + /// A value indicating whether the is supported or not. /// /// The server is not running .
/// -or-
/// An internal error occurs. ///
+ /// or is invalid. + /// 6 + public static void SetDisplayModeCapability(MediaControlDisplayMode mode, MediaControlCapabilitySupport support) + { + ValidationUtil.ValidateEnum(typeof(MediaControlDisplayMode), mode, nameof(mode)); + ValidationUtil.ValidateEnum(typeof(MediaControlCapabilitySupport), support, nameof(support)); + + if (support == MediaControlCapabilitySupport.NotDecided) + { + throw new ArgumentException($"NotDecided is not allowed in {mode} capability."); + } + + Native.SetDisplayModeCapability(Handle, (uint)mode.ToNative(), support). + ThrowIfError("Failed to set display mode capability."); + } + + /// + /// Sets the supported list of . + /// + /// + /// is not allowed in display rotation capability.
+ /// The default value of each is not supported. + ///
+ /// The supported list of . + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// is invalid. + /// 6 + public static void SetDisplayRotationCapabilities(IDictionary capabilities) + { + foreach (var pair in capabilities) + { + SetDisplayRotationCapability(pair.Key, pair.Value); + } + } + + /// + /// Sets the is supported or not. + /// + /// + /// is not allowed in display rotation capability.
+ /// The default value of each is not supported. + ///
+ /// The . + /// A value indicating whether the is supported or not.. + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// or is invalid. + /// 6 + public static void SetDisplayRotationCapability(Rotation rotation, MediaControlCapabilitySupport support) + { + ValidationUtil.ValidateEnum(typeof(Rotation), rotation, nameof(rotation)); + ValidationUtil.ValidateEnum(typeof(MediaControlCapabilitySupport), support, nameof(support)); + + if (support == MediaControlCapabilitySupport.NotDecided) + { + throw new ArgumentException($"NotDecided is not allowed in {rotation} capability."); + } + + Native.SetDisplayRotationCapability(Handle, (uint)rotation.ToNative(), support). + ThrowIfError("Failed to set display rotation capability."); + } + #endregion Capability + + + #region Command + /// + /// Requests commands to the client. + /// + /// + /// The client can request the command to execute ,
+ /// and then, the server receive the result of each request(command). + ///
+ /// A class. + /// The client Id to send command. + /// represents the extra data from client and it can be null. + /// + /// or is null. + /// + /// + /// The server has already been stopped.
+ /// -or-
+ /// An internal error occurs. + ///
/// 5 - public static void SetAgeRating(int ageRating) + public static async Task RequestAsync(Command command, string clientId) { - if (ageRating < 0 || ageRating > 19) + if (command == null) { - throw new ArgumentOutOfRangeException(nameof(ageRating)); + throw new ArgumentNullException(nameof(command)); + } + if (clientId == null) + { + throw new ArgumentNullException(nameof(clientId)); } - Native.SetAgeRating(Handle, ageRating).ThrowIfError("Failed to set age rating."); + command.SetRequestInformation(clientId); - Native.UpdatePlayback(Handle).ThrowIfError("Failed to set playback."); + var tcs = new TaskCompletionSource(); + string reqeustId = null; + Bundle bundle = null; + + EventHandler eventHandler = (s, e) => + { + if (e.RequestId == reqeustId) + { + bundle = e.Bundle; + tcs.TrySetResult(e.Result); + } + }; + + try + { + CommandCompleted += eventHandler; + + reqeustId = command.Request(Handle); + + (await tcs.Task).ThrowIfError("Failed to request event."); + + return bundle; + } + finally + { + CommandCompleted -= eventHandler; + } + } + + /// + /// Sends the result of each command. + /// + /// The command that return to client. + /// The result of . + /// The extra data. + /// is null. + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// 5 + public static void Response(Command command, int result, Bundle bundle) + { + if (command == null) + { + throw new ArgumentNullException(nameof(command)); + } + + command.Response(Handle, result, bundle); + } + + /// + /// Sends the result of each command. + /// + /// The command that return to client. + /// The result of . + /// is null. + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// 5 + public static void Response(Command command, int result) + { + if (command == null) + { + throw new ArgumentNullException(nameof(command)); + } + + command.Response(Handle, result, null); } + #endregion Command } } \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaController.Events.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaController.Events.cs index 109818cba..757bea06b 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaController.Events.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaController.Events.cs @@ -15,6 +15,7 @@ */ using System; +using System.Linq; using System.Collections.Generic; using Tizen.Applications; using Native = Interop.MediaControllerClient; @@ -39,6 +40,7 @@ namespace Tizen.Multimedia.Remoting ServerStopped?.Invoke(this, EventArgs.Empty); } + #region Updated event /// /// Occurs when the playback state is updated. /// @@ -79,6 +81,17 @@ namespace Tizen.Multimedia.Remoting } } + /// + /// Occurs when the playlist is updated. + /// + /// 5 + public event EventHandler PlaylistUpdated; + + internal void RaisePlaylistUpdatedEvent(MediaControlPlaylistMode mode, string name, IntPtr playlistHandle) + { + PlaylistUpdated?.Invoke(this, new PlaylistUpdatedEventArgs(mode, name, new MediaControlPlaylist(playlistHandle))); + } + /// /// Occurs when the metadata is updated. /// @@ -138,37 +151,48 @@ namespace Tizen.Multimedia.Remoting } /// - /// Occurs when the playlist is updated. + /// Occurs when the subtitle mode is updated. /// - /// 5 - public event EventHandler PlaylistUpdated; + /// 6 + public event EventHandler SubtitleModeUpdated; + internal void RaiseSubtitleModeUpdatedEvent(bool isEnabled) + { + SubtitleModeUpdated?.Invoke(this, new SubtitleModeUpdatedEventArgs(isEnabled)); + } - internal void RaisePlaylistUpdatedEvent(MediaControlPlaylistMode mode, string name, IntPtr playlistHandle) + /// + /// Occurs when the 360 mode is updated. + /// + /// 6 + public event EventHandler Mode360Updated; + internal void RaiseMode360UpdatedEvent(bool isEnabled) { - PlaylistUpdated?.Invoke(this, new PlaylistUpdatedEventArgs(mode, name, new MediaControlPlaylist(playlistHandle))); + Mode360Updated?.Invoke(this, new Mode360UpdatedEventArgs(isEnabled)); } /// - /// Occurs when the command is completed. + /// Occurs when the display mode is updated. /// - /// - /// User can match the command and this event using field. - /// - /// 5 - internal event EventHandler CommandCompleted; + /// 6 + public event EventHandler DisplayModeUpdated; + internal void RaiseDisplayModeUpdatedEvent(MediaControlNativeDisplayMode mode) + { + DisplayModeUpdated?.Invoke(this, new DisplayModeUpdatedEventArgs(mode.ToPublic())); + } - internal void RaiseCommandCompletedEvent(string requestId, MediaControllerError result, IntPtr bundleHandle) + /// + /// Occurs when the display rotation is updated. + /// + /// 6 + public event EventHandler DisplayRotationUpdated; + internal void RaiseDisplayRotationUpdatedEvent(MediaControlNativeDisplayRotation rotation) { - if (bundleHandle != IntPtr.Zero) - { - CommandCompleted?.Invoke(this, new CommandCompletedEventArgs(requestId, result, new Bundle(new SafeBundleHandle(bundleHandle, true)))); - } - else - { - CommandCompleted?.Invoke(this, new CommandCompletedEventArgs(requestId, result)); - } + DisplayRotationUpdated?.Invoke(this, new DisplayRotationUpdatedEventArgs(rotation.ToPublic())); } + #endregion + + #region Capability updated event /// /// Occurs when the playback capabilities are updated. /// @@ -182,7 +206,7 @@ namespace Tizen.Multimedia.Remoting { foreach (MediaControllerNativePlaybackAction action in Enum.GetValues(typeof(MediaControllerNativePlaybackAction))) { - Native.IsCapabilitySupported(playbackCapaHandle, action, out MediaControlCapabilitySupport support); + Native.GetPlaybackCapability(playbackCapaHandle, action, out MediaControlCapabilitySupport support); capabilities.Add(action.ToPublic(), support); } @@ -234,6 +258,52 @@ namespace Tizen.Multimedia.Remoting ShuffleModeCapabilityUpdated?.Invoke(this, new ShuffleModeCapabilityUpdatedEventArgs(support)); } + /// + /// Occurs when the display mode capabilities are updated. + /// + /// 6 + public event EventHandler DisplayModeCapabilityUpdated; + + internal void RaiseDisplayModeCapabilityUpdatedEvent(MediaControlNativeDisplayMode modes) + { + DisplayModeCapabilityUpdated?.Invoke(this, new DisplayModeCapabilityUpdatedEventArgs(modes.ToPublicList())); + } + + /// + /// Occurs when the display rotation capabilities are updated. + /// + /// 6 + public event EventHandler DisplayRotationCapabilityUpdated; + + internal void RaiseDisplayRotationCapabilityUpdatedEvent(MediaControlNativeDisplayRotation rotations) + { + DisplayRotationCapabilityUpdated?.Invoke(this, new DisplayRotationCapabilityUpdatedEventArgs(rotations.ToPublicList())); + } + #endregion + + + #region Command + /// + /// Occurs when the command is completed. + /// + /// + /// User can match the command and this event using field. + /// + /// 5 + internal event EventHandler CommandCompleted; + + internal void RaiseCommandCompletedEvent(string requestId, MediaControllerError result, IntPtr bundleHandle) + { + if (bundleHandle != IntPtr.Zero) + { + CommandCompleted?.Invoke(this, new CommandCompletedEventArgs(requestId, result, new Bundle(new SafeBundleHandle(bundleHandle, true)))); + } + else + { + CommandCompleted?.Invoke(this, new CommandCompletedEventArgs(requestId, result)); + } + } + /// /// Occurs when a server sends custom event. /// @@ -244,5 +314,6 @@ namespace Tizen.Multimedia.Remoting { CustomCommandReceived?.Invoke(this, new CustomCommandReceivedEventArgs(command)); } + #endregion } } \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs index cf4da2a89..2f3e6d826 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs @@ -68,6 +68,8 @@ namespace Tizen.Multimedia.Remoting } } + + #region Get information /// /// Returns the playback state set by the server. /// @@ -77,7 +79,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. ///
- /// The has already been disposed of. + /// The has already been disposed. /// /// 4 public MediaControlPlaybackState GetPlaybackState() @@ -88,7 +90,7 @@ namespace Tizen.Multimedia.Remoting try { - Native.GetServerPlayback(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); + Native.GetServerPlaybackHandle(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); Native.GetPlaybackState(playbackHandle, out var playbackCode).ThrowIfError("Failed to get state."); @@ -112,7 +114,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// /// 4 public long GetPlaybackPosition() @@ -123,7 +125,7 @@ namespace Tizen.Multimedia.Remoting try { - Native.GetServerPlayback(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); + Native.GetServerPlaybackHandle(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); Native.GetPlaybackPosition(playbackHandle, out var position).ThrowIfError("Failed to get position."); @@ -147,7 +149,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// /// 4 public MediaControlMetadata GetMetadata() @@ -181,7 +183,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// 5 public IEnumerable GetPlaylists() { @@ -225,7 +227,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// 5 public MediaControlPlaylist GetPlaylistOfCurrentPlayingMedia() { @@ -236,7 +238,7 @@ namespace Tizen.Multimedia.Remoting // Get the playlist name of current playing media. try { - Native.GetServerPlayback(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); + Native.GetServerPlaybackHandle(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); var (name, index) = NativePlaylist.GetPlaylistInfo(playbackHandle); @@ -260,7 +262,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// 5 public string GetIndexOfCurrentPlayingMedia() { @@ -270,7 +272,7 @@ namespace Tizen.Multimedia.Remoting try { - Native.GetServerPlayback(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); + Native.GetServerPlaybackHandle(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); var (name, index) = NativePlaylist.GetPlaylistInfo(playbackHandle); return index; @@ -293,7 +295,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// /// 4 public bool IsShuffleModeEnabled() @@ -315,7 +317,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// /// 4 public MediaControlRepeatMode GetRepeatMode() @@ -329,223 +331,188 @@ namespace Tizen.Multimedia.Remoting } /// - /// Requests command to the server. + /// Gets the content type of current playing media. /// - /// - /// The client can request the server to execute or or - /// or ,
- /// and then, the client receive the result of each request(command). - ///
- /// A class. - /// represents the extra data from server and it can be null. - /// is null. + /// The . /// /// The server has already been stopped.
/// -or-
/// An internal error occurs. ///
- /// The has already been disposed of. + /// The has already been disposed. /// 5 - public async Task RequestAsync(Command command) + public MediaControlContentType GetContentTypeOfCurrentPlayingMedia() { - if (command == null) - { - throw new ArgumentNullException(nameof(command)); - } - ThrowIfStopped(); - command.SetRequestInformation(ServerAppId); - - var tcs = new TaskCompletionSource(); - string reqeustId = null; - Bundle bundle = null; - - EventHandler eventHandler = (s, e) => - { - if (e.RequestId == reqeustId) - { - bundle = e.Bundle; - tcs.TrySetResult(e.Result); - } - }; + IntPtr playbackHandle = IntPtr.Zero; try { - CommandCompleted += eventHandler; - - reqeustId = command.Request(Manager.Handle); + Native.GetServerPlaybackHandle(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); - (await tcs.Task).ThrowIfError("Failed to request command"); + Native.GetPlaybackContentType(playbackHandle, out MediaControlContentType type). + ThrowIfError("Failed to get playback content type"); - return bundle; + return type; } finally { - CommandCompleted -= eventHandler; + if (playbackHandle != IntPtr.Zero) + { + Native.DestroyPlayback(playbackHandle); + } } } /// - /// Sends the result of each command. + /// Gets the icon path. /// - /// The command that return to client. - /// The result of . - /// The extra data. - /// is null. + /// The icon path. /// - /// The server is not running .
+ /// The server has already been stopped.
/// -or-
/// An internal error occurs. ///
+ /// The has already been disposed. /// 5 - public void Response(Command command, int result, Bundle bundle) + public string GetIconPath() { - if (command == null) - { - throw new ArgumentNullException(nameof(command)); - } + ThrowIfStopped(); - command.Response(Manager.Handle, result, bundle); + Native.GetServerIcon(Manager.Handle, ServerAppId, out string uri). + ThrowIfError("Failed to get icon path."); + + return uri; } /// - /// Sends the result of each command. + /// Gets the age rating of current playing media. /// - /// The command that return to client. - /// The result of . - /// is null. + /// The Age rating of current playing media. The range is 0 to 19, inclusive. /// - /// The server is not running .
+ /// The server has already been stopped.
/// -or-
/// An internal error occurs. ///
+ /// The has already been disposed. /// 5 - public void Response(Command command, int result) + public int GetAgeRatingOfCurrentPlayingMedia() { - if (command == null) + ThrowIfStopped(); + + IntPtr playbackHandle = IntPtr.Zero; + + try { - throw new ArgumentNullException(nameof(command)); - } + Native.GetServerPlaybackHandle(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); - command.Response(Manager.Handle, result, null); + Native.GetAgeRating(playbackHandle, out int ageRating).ThrowIfError("Failed to get age rating."); + + return ageRating; + } + finally + { + if (playbackHandle != IntPtr.Zero) + { + Native.DestroyPlayback(playbackHandle); + } + } } /// - /// Sends playback command to the server. + /// Gets whether the subtitle mode is enabled or not. /// - /// A playback command. + /// A value indicating whether the subtitle mode is enabled or not. + /// true if the subtitle mode is enabled; otherwise, false. /// /// The server has already been stopped.
/// -or-
/// An internal error occurs. ///
- /// is not valid. - /// The has already been disposed of. - /// - /// 4 - [Obsolete("Please do not use! This will be deprecated. Please use Request instead.")] - public void SendPlaybackCommand(MediaControlPlaybackCommand command) + /// The has already been disposed. + /// 6 + public bool IsSubtitleModeEnabled() { ThrowIfStopped(); - ValidationUtil.ValidateEnum(typeof(MediaControlPlaybackCommand), command, nameof(command)); + Native.IsSubtitleEnabled(Manager.Handle, ServerAppId, out var isEnabled). + ThrowIfError("Failed to get subtitle mode state."); - Native.SendPlaybackActionCommandWithoutReqId(Manager.Handle, ServerAppId, command.ToNative()). - ThrowIfError("Failed to send command."); + return isEnabled; } - #region Capabilities /// - /// Gets the content type of current playing media. + /// Gets whether the 360 mode is enabled or not. /// - /// The . + /// A value indicating whether the 360 mode is enabled or not. + /// true if the 360 mode is enabled; otherwise, false. /// /// The server has already been stopped.
/// -or-
/// An internal error occurs. ///
- /// The has already been disposed of. - /// 5 - public MediaControlContentType GetContentTypeOfCurrentPlayingMedia() + /// The has already been disposed. + /// 6 + public bool IsMode360Enabled() { ThrowIfStopped(); - IntPtr playbackHandle = IntPtr.Zero; - - try - { - Native.GetServerPlayback(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); - - Native.GetPlaybackContentType(playbackHandle, out MediaControlContentType type). - ThrowIfError("Failed to get playback content type"); + Native.IsMode360Enabled(Manager.Handle, ServerAppId, out var isEnabled). + ThrowIfError("Failed to get 360 mode state."); - return type; - } - finally - { - if (playbackHandle != IntPtr.Zero) - { - Native.DestroyPlayback(playbackHandle); - } - } + return isEnabled; } /// - /// Gets the icon path. + /// Gets the current display mode. /// - /// The icon path. + /// The . /// /// The server has already been stopped.
/// -or-
/// An internal error occurs. ///
- /// The has already been disposed of. - /// 5 - public string GetIconPath() + /// + /// The has already been disposed. + /// + /// 6 + public MediaControlDisplayMode GetDisplayMode() { ThrowIfStopped(); - Native.GetServerIcon(Manager.Handle, ServerAppId, out string uri). - ThrowIfError("Failed to get icon path."); + Native.GetDisplayMode(Manager.Handle, ServerAppId, out var mode). + ThrowIfError("Failed to get display mode state."); - return uri; + return mode.ToPublic(); } /// - /// Gets the age rating of current playing media. + /// Gets the current display rotation. /// - /// The Age rating of current playing media. The range is 0 to 19, inclusive. + /// The . /// /// The server has already been stopped.
/// -or-
/// An internal error occurs. ///
- /// The has already been disposed of. - /// 5 - public int GetAgeRatingOfCurrentPlayingMedia() + /// + /// The has already been disposed. + /// + /// 6 + public Rotation GetDisplayRotation() { ThrowIfStopped(); - IntPtr playbackHandle = IntPtr.Zero; - - try - { - Native.GetServerPlayback(Manager.Handle, ServerAppId, out playbackHandle).ThrowIfError("Failed to get playback."); + Native.GetDisplayRotation(Manager.Handle, ServerAppId, out var rotation). + ThrowIfError("Failed to get display rotation state."); - Native.GetAgeRating(playbackHandle, out int ageRating).ThrowIfError("Failed to get age rating."); - - return ageRating; - } - finally - { - if (playbackHandle != IntPtr.Zero) - { - Native.DestroyPlayback(playbackHandle); - } - } + return rotation.ToPublic(); } + #endregion Get information + + #region Capability /// /// Gets the value whether is supported or not. /// @@ -557,7 +524,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// 5 public Dictionary GetPlaybackCapabilities() { @@ -574,7 +541,7 @@ namespace Tizen.Multimedia.Remoting foreach (MediaControllerNativePlaybackAction action in Enum.GetValues(typeof(MediaControllerNativePlaybackAction))) { - Native.IsCapabilitySupported(playbackCapaHandle, action, out MediaControlCapabilitySupport support); + Native.GetPlaybackCapability(playbackCapaHandle, action, out MediaControlCapabilitySupport support); playbackCapabilities.Add(action.ToPublic(), support); } @@ -600,7 +567,7 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// 5 public MediaControlCapabilitySupport GetPlaybackCapability(MediaControlPlaybackCommand action) { @@ -615,7 +582,7 @@ namespace Tizen.Multimedia.Remoting Native.GetPlaybackCapabilityHandle(Manager.Handle, ServerAppId, out playbackCapaHandle). ThrowIfError("Failed to get playback capability handle."); - Native.IsCapabilitySupported(playbackCapaHandle, action.ToNative(), out MediaControlCapabilitySupport support); + Native.GetPlaybackCapability(playbackCapaHandle, action.ToNative(), out MediaControlCapabilitySupport support); return support; } @@ -637,31 +604,16 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// 5 public MediaControlCapabilitySupport GetShuffleModeCapability() { ThrowIfStopped(); - IntPtr playbackCapaHandle = IntPtr.Zero; - - try - { - Native.GetPlaybackCapabilityHandle(Manager.Handle, ServerAppId, out playbackCapaHandle). - ThrowIfError("Failed to get playback capability handle."); - - Native.GetSimpleCapability(Manager.Handle, ServerAppId, MediaControlCapabilityCategory.Shuffle, out MediaControlCapabilitySupport support). - ThrowIfError("Failed to get shuffle mode capability"); + Native.GetSimpleCapability(Manager.Handle, ServerAppId, MediaControlNativeCapabilityCategory.Shuffle, out MediaControlCapabilitySupport support). + ThrowIfError("Failed to get shuffle mode capability"); - return support; - } - finally - { - if (playbackCapaHandle != IntPtr.Zero) - { - Native.DestroyCapability(playbackCapaHandle); - } - } + return support; } /// @@ -673,32 +625,195 @@ namespace Tizen.Multimedia.Remoting /// -or-
/// An internal error occurs. /// - /// The has already been disposed of. + /// The has already been disposed. /// 5 public MediaControlCapabilitySupport GetRepeatModeCapability() { ThrowIfStopped(); - IntPtr playbackCapaHandle = IntPtr.Zero; + Native.GetSimpleCapability(Manager.Handle, ServerAppId, MediaControlNativeCapabilityCategory.Repeat, out MediaControlCapabilitySupport support). + ThrowIfError("Failed to get repeat mode capability"); + + return support; + } + + /// + /// Gets the value whether the repeat mode is supported or not. + /// + /// + /// If there's no supported display mode by server, it will return null. + /// otherwise, it will return the supported list of . + /// + /// + /// The server has already been stopped.
+ /// -or-
+ /// An internal error occurs. + ///
+ /// The has already been disposed. + /// 6 + public IEnumerable GetDisplayModeCapability() + { + ThrowIfStopped(); + + Native.GetDisplayModeCapability(Manager.Handle, ServerAppId, out uint support). + ThrowIfError("Failed to get display mode capability"); + + return support != 0 ? ((MediaControlNativeDisplayMode)support).ToPublicList() : null; + } + + /// + /// Gets the value whether the display mode is supported or not. + /// + /// + /// If there's no supported display rotation by server, it will return null. + /// otherwise, it will return the supported list of . + /// + /// + /// The server has already been stopped.
+ /// -or-
+ /// An internal error occurs. + ///
+ /// The has already been disposed. + /// 6 + public IEnumerable GetDisplayRotationapability() + { + ThrowIfStopped(); + + Native.GetDisplayRotationCapability(Manager.Handle, ServerAppId, out uint support). + ThrowIfError("Failed to get display mode capability"); + + return support != 0 ? ((MediaControlNativeDisplayRotation)support).ToPublicList() : null; + } + #endregion Capability + + + #region Command + /// + /// Requests command to the server. + /// + /// + /// The client can request the server to execute or or + /// or ,
+ /// and then, the client receive the result of each request(command). + ///
+ /// A class. + /// represents the extra data from server and it can be null. + /// is null. + /// + /// The server has already been stopped.
+ /// -or-
+ /// An internal error occurs. + ///
+ /// The has already been disposed. + /// 5 + public async Task RequestAsync(Command command) + { + if (command == null) + { + throw new ArgumentNullException(nameof(command)); + } + + ThrowIfStopped(); + + command.SetRequestInformation(ServerAppId); + + var tcs = new TaskCompletionSource(); + string reqeustId = null; + Bundle bundle = null; + + EventHandler eventHandler = (s, e) => + { + if (e.RequestId == reqeustId) + { + bundle = e.Bundle; + tcs.TrySetResult(e.Result); + } + }; try { - Native.GetPlaybackCapabilityHandle(Manager.Handle, ServerAppId, out playbackCapaHandle). - ThrowIfError("Failed to get playback capability handle."); + CommandCompleted += eventHandler; - Native.GetSimpleCapability(Manager.Handle, ServerAppId, MediaControlCapabilityCategory.Repeat, out MediaControlCapabilitySupport support). - ThrowIfError("Failed to get repeat mode capability"); + reqeustId = command.Request(Manager.Handle); - return support; + (await tcs.Task).ThrowIfError("Failed to request command"); + + return bundle; } finally { - if (playbackCapaHandle != IntPtr.Zero) - { - Native.DestroyCapability(playbackCapaHandle); - } + CommandCompleted -= eventHandler; + } + } + + /// + /// Sends the result of each command. + /// + /// The command that return to client. + /// The result of . + /// The extra data. + /// is null. + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// 5 + public void Response(Command command, int result, Bundle bundle) + { + if (command == null) + { + throw new ArgumentNullException(nameof(command)); + } + + command.Response(Manager.Handle, result, bundle); + } + + /// + /// Sends the result of each command. + /// + /// The command that return to client. + /// The result of . + /// is null. + /// + /// The server is not running .
+ /// -or-
+ /// An internal error occurs. + ///
+ /// 5 + public void Response(Command command, int result) + { + if (command == null) + { + throw new ArgumentNullException(nameof(command)); } + + command.Response(Manager.Handle, result, null); + } + + /// + /// Sends playback command to the server. + /// + /// A playback command. + /// + /// The server has already been stopped.
+ /// -or-
+ /// An internal error occurs. + ///
+ /// is not valid. + /// The has already been disposed. + /// + /// 4 + [Obsolete("Please do not use! This will be deprecated. Please use Request instead.")] + public void SendPlaybackCommand(MediaControlPlaybackCommand command) + { + ThrowIfStopped(); + + ValidationUtil.ValidateEnum(typeof(MediaControlPlaybackCommand), command, nameof(command)); + + Native.SendPlaybackActionCommandWithoutReqId(Manager.Handle, ServerAppId, command.ToNative()). + ThrowIfError("Failed to send command."); } - #endregion Capabilities + #endregion Command } } \ 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 index d0c31fd5b..0ce336454 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerManager.Events.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerManager.Events.cs @@ -23,17 +23,29 @@ namespace Tizen.Multimedia.Remoting { public partial class MediaControllerManager { + // Updated event private Native.ServerUpdatedCallback _serverUpdatedCallback; private Native.PlaybackUpdatedCallback _playbackUpdatedCallback; + private NativePlaylist.PlaylistUpdatedCallback _playlistUpdatedCallback; + private NativePlaylist.MetadataUpdatedCallback _metadataUpdatedCallback; private Native.ShuffleModeUpdatedCallback _shufflemodeUpdatedCallback; private Native.RepeatModeUpdatedCallback _repeatmodeUpdatedCallback; - private Native.CommandCompletedCallback _commandCompletedCallback; - private NativePlaylist.MetadataUpdatedCallback _metadataUpdatedCallback; - private NativePlaylist.PlaylistUpdatedCallback _playlistUpdatedCallback; + private Native.BoolAttributeUpdatedCallback _subtitleModeUpdatedCallback; + private Native.BoolAttributeUpdatedCallback _mode360UpdatedCallback; + private Native.DisplayModeUpdatedCallback _displayModeUpdatedCallback; + private Native.DisplayRotationUpdatedCallback _displayRotationUpdatedCallback; + + // Capability updated event private Native.PlaybackCapabilityUpdatedCallback _playbackCapabilityUpdatedCallback; - private Native.SimpleCapabilityCallback _simpleCapabilityUpdatedCallback; + private Native.SimpleCapabilityUpdatedCallback _categoryCapabilityUpdatedCallback; + private Native.CategoryAttributeCapabilityUpdatedCallback _displayModeCapabilityUpdatedCallback; + private Native.CategoryAttributeCapabilityUpdatedCallback _displayRotationCapabilityUpdatedCallback; + + // Command + private Native.CommandCompletedCallback _commandCompletedCallback; private Native.CustomCommandReceivedCallback _customCommandReceivedCallback; + /// /// Occurs when a server is started. /// @@ -54,10 +66,18 @@ namespace Tizen.Multimedia.Remoting RegisterShuffleModeUpdatedEvent(); RegisterRepeatModeUpdatedEvent(); RegisterPlaylistUpdatedEvent(); - RegisterCommandCompletedEvent(); + RegisterSubtitleModeUpdateEvent(); + RegisterMode360UpdateEvent(); + RegisterDisplayModeUpdateEvent(); + RegisterDisplayRotationUpdateEvent(); + RegisterPlaybackCapabilitiesEvent(); + RegisterDisplayModeCapabilityUpdatedEvent(); + RegisterDisplayRotationCapabilityUpdatedEvent(); + RegisterSimpleCapabilityUpdatedEvent(); + + RegisterCommandCompletedEvent(); RegisterCustomCommandReceivedEvent(); - RegisterSimpleCapabilityEvent(); } private void RaiseServerChangedEvent(MediaControllerNativeServerState state, MediaController controller) @@ -78,6 +98,8 @@ namespace Tizen.Multimedia.Remoting } } + + #region Updated event private void RegisterServerUpdatedEvent() { _serverUpdatedCallback = (serverName, state, _) => @@ -85,7 +107,8 @@ namespace Tizen.Multimedia.Remoting RaiseServerChangedEvent(state, HandleServerUpdated(serverName, state)); }; - Native.SetServerUpdatedCb(Handle, _serverUpdatedCallback).ThrowIfError("Failed to init server changed event."); + Native.SetServerUpdatedCb(Handle, _serverUpdatedCallback). + ThrowIfError("Failed to register server changed event."); } private void RegisterPlaybackUpdatedEvent() @@ -95,9 +118,20 @@ namespace Tizen.Multimedia.Remoting GetController(serverName)?.RaisePlaybackUpdatedEvent(playbackHandle); }; - Native.SetPlaybackUpdatedCb(Handle, _playbackUpdatedCallback).ThrowIfError("Failed to init PlaybackUpdated event."); + Native.SetPlaybackUpdatedCb(Handle, _playbackUpdatedCallback). + ThrowIfError("Failed to register PlaybackUpdated event."); } + private void RegisterPlaylistUpdatedEvent() + { + _playlistUpdatedCallback = (serverName, playlistMode, name, playlistHandle, _) => + { + GetController(serverName)?.RaisePlaylistUpdatedEvent(playlistMode, name, playlistHandle); + }; + + NativePlaylist.SetPlaylistModeUpdatedCb(Handle, _playlistUpdatedCallback). + ThrowIfError("Failed to register PlaylistUpdated event."); + } private void RegisterMetadataUpdatedEvent() { @@ -106,7 +140,8 @@ namespace Tizen.Multimedia.Remoting GetController(serverName)?.RaiseMetadataUpdatedEvent(metadata); }; - NativePlaylist.SetMetadataUpdatedCb(Handle, _metadataUpdatedCallback).ThrowIfError("Failed to init MetadataUpdated event."); + NativePlaylist.SetMetadataUpdatedCb(Handle, _metadataUpdatedCallback). + ThrowIfError("Failed to register MetadataUpdated event."); } private void RegisterShuffleModeUpdatedEvent() @@ -117,7 +152,7 @@ namespace Tizen.Multimedia.Remoting }; Native.SetShuffleModeUpdatedCb(Handle, _shufflemodeUpdatedCallback). - ThrowIfError("Failed to init ShuffleModeUpdated event."); + ThrowIfError("Failed to register ShuffleModeUpdated event."); } private void RegisterRepeatModeUpdatedEvent() @@ -128,42 +163,67 @@ namespace Tizen.Multimedia.Remoting }; Native.SetRepeatModeUpdatedCb(Handle, _repeatmodeUpdatedCallback). - ThrowIfError("Failed to init RepeatModeUpdated event."); + ThrowIfError("Failed to register RepeatModeUpdated event."); } - private void RegisterPlaylistUpdatedEvent() + private void RegisterSubtitleModeUpdateEvent() { - _playlistUpdatedCallback = (serverName, playlistMode, name, playlistHandle, _) => + _subtitleModeUpdatedCallback = (serverName, isEnabled, _) => { - GetController(serverName)?.RaisePlaylistUpdatedEvent(playlistMode, name, playlistHandle); + GetController(serverName)?.RaiseSubtitleModeUpdatedEvent(isEnabled); }; - NativePlaylist.SetPlaylistModeUpdatedCb(Handle, _playlistUpdatedCallback). - ThrowIfError("Failed to init PlaylistUpdated event."); + Native.SetSubtitleUpdatedCb(Handle, _subtitleModeUpdatedCallback). + ThrowIfError("Failed to register SubtitleModeUpdated event."); } - private void RegisterCommandCompletedEvent() + private void RegisterMode360UpdateEvent() { - _commandCompletedCallback = (serverName, requestId, result, bundleHandle, _) => + _mode360UpdatedCallback = (serverName, isEnabled, _) => { - // SafeHandles cannot be marshaled from unmanaged to managed. - // So we use IntPtr type for 'bundleHandle' in native callback. - GetController(serverName)?.RaiseCommandCompletedEvent(requestId, result, bundleHandle); + GetController(serverName)?.RaiseMode360UpdatedEvent(isEnabled); }; - Native.SetCommandCompletedCb(Handle, _commandCompletedCallback). - ThrowIfError("Failed to init CommandCompleted event."); + Native.SetMode360UpdatedCb(Handle, _mode360UpdatedCallback). + ThrowIfError("Failed to register Mode360Updated event."); } - private void RegisterPlaybackCapabilitiesEvent() + private void RegisterDisplayModeUpdateEvent() { - _playbackCapabilityUpdatedCallback = (serverName, playbackCapaHandle, _) => + _displayModeUpdatedCallback = (serverName, mode, _) => { - GetController(serverName)?.RaisePlaybackCapabilityUpdatedEvent(playbackCapaHandle); + GetController(serverName)?.RaiseDisplayModeUpdatedEvent(mode); }; - Native.SetPlaybackCapabilityUpdatedCb(Handle, _playbackCapabilityUpdatedCallback). - ThrowIfError("Failed to init PlaybackCapabilityUpdated event."); + Native.SetDisplayModeUpdatedCb(Handle, _displayModeUpdatedCallback). + ThrowIfError("Failed to register DisplayModeUpdated event."); + } + + private void RegisterDisplayRotationUpdateEvent() + { + _displayRotationUpdatedCallback = (serverName, rotation, _) => + { + GetController(serverName)?.RaiseDisplayRotationUpdatedEvent(rotation); + }; + + Native.SetDisplayRotationUpdatedCb(Handle, _displayRotationUpdatedCallback). + ThrowIfError("Failed to register DisplayRotationUpdated event."); + } + #endregion + + + #region Command + private void RegisterCommandCompletedEvent() + { + _commandCompletedCallback = (serverName, requestId, result, bundleHandle, _) => + { + // SafeHandles cannot be marshaled from unmanaged to managed. + // So we use IntPtr type for 'bundleHandle' in native callback. + GetController(serverName)?.RaiseCommandCompletedEvent(requestId, result, bundleHandle); + }; + + Native.SetCommandCompletedCb(Handle, _commandCompletedCallback). + ThrowIfError("Failed to register CommandCompleted event."); } private void RegisterCustomCommandReceivedEvent() @@ -186,26 +246,65 @@ namespace Tizen.Multimedia.Remoting }; Native.SetCustomEventCb(Handle, _customCommandReceivedCallback). - ThrowIfError("Failed to init CustomCommandReceived event."); + ThrowIfError("Failed to register CustomCommandReceived event."); + } + #endregion + + + #region Capability updated event + private void RegisterPlaybackCapabilitiesEvent() + { + _playbackCapabilityUpdatedCallback = (serverName, playbackCapaHandle, _) => + { + GetController(serverName)?.RaisePlaybackCapabilityUpdatedEvent(playbackCapaHandle); + }; + + Native.SetPlaybackCapabilityUpdatedCb(Handle, _playbackCapabilityUpdatedCallback). + ThrowIfError("Failed to register PlaybackCapabilityUpdated event."); + } + + private void RegisterDisplayModeCapabilityUpdatedEvent() + { + _displayModeCapabilityUpdatedCallback = (serverName, modes, _) => + { + GetController(serverName)?.RaiseDisplayModeCapabilityUpdatedEvent( + (MediaControlNativeDisplayMode)modes); + }; + + Native.SetDisplayModeCapabilityUpdatedCb(Handle, _displayModeCapabilityUpdatedCallback). + ThrowIfError("Failed to register DisplayModeCapabilityUpdated event."); + } + + private void RegisterDisplayRotationCapabilityUpdatedEvent() + { + _displayRotationCapabilityUpdatedCallback = (serverName, rotations, _) => + { + GetController(serverName)?.RaiseDisplayRotationCapabilityUpdatedEvent( + (MediaControlNativeDisplayRotation)rotations); + }; + + Native.SetDisplayRotationCapabilityUpdatedCb(Handle, _displayRotationCapabilityUpdatedCallback). + ThrowIfError("Failed to register DisplayRotationCapabilityUpdated event."); } - private void RegisterSimpleCapabilityEvent() + private void RegisterSimpleCapabilityUpdatedEvent() { - _simpleCapabilityUpdatedCallback = (serverName, category, support, _) => + _categoryCapabilityUpdatedCallback = (serverName, category, support, _) => { switch (category) { - case MediaControlCapabilityCategory.Repeat: + case MediaControlNativeCapabilityCategory.Repeat: GetController(serverName)?.RaiseRepeatModeCapabilityUpdatedEvent(support); break; - case MediaControlCapabilityCategory.Shuffle: + case MediaControlNativeCapabilityCategory.Shuffle: GetController(serverName)?.RaiseShuffleModeCapabilityUpdatedEvent(support); break; } }; - Native.SetSimpleCapabilityUpdatedCb(Handle, _simpleCapabilityUpdatedCallback). - ThrowIfError("Failed to init capability updated event."); + Native.SetCategoryCapabilityUpdatedCb(Handle, _categoryCapabilityUpdatedCallback). + ThrowIfError("Failed to register capability updated event."); } + #endregion } } \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/Mode360CommandReceivedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/Mode360CommandReceivedEventArgs.cs new file mode 100644 index 000000000..f4091806a --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/Mode360CommandReceivedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Provides data for the event. + /// + /// 6 + public class Mode360CommandReceivedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// The 360 mode command. + /// is null. + /// 6 + internal Mode360CommandReceivedEventArgs(Mode360Command command) + { + Command = command ?? throw new ArgumentNullException(nameof(command)); + } + + /// + /// Gets the . + /// + /// 6 + public Mode360Command Command { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/Mode360UpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/Mode360UpdatedEventArgs.cs new file mode 100644 index 000000000..0f000b9fb --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/Mode360UpdatedEventArgs.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Provides data for the event. + /// + /// 6 + public class Mode360UpdatedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// A value indicating the updated 360 mode. + /// 6 + internal Mode360UpdatedEventArgs(bool isEnabled) + { + IsEnabled = isEnabled; + } + + /// + /// Gets the value indicating whether 360 mode is enabled or not. + /// + /// 6 + public bool IsEnabled { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeCapabilityUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeCapabilityUpdatedEventArgs.cs index 12cc0c329..a465e28c4 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeCapabilityUpdatedEventArgs.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeCapabilityUpdatedEventArgs.cs @@ -30,7 +30,7 @@ namespace Tizen.Multimedia.Remoting /// Initializes a new instance of the class. ///
/// The repeat mode capabilities. - /// is not vaild. + /// is not valid. /// 5 public RepeatModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport support) { diff --git a/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeCommandReceivedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeCommandReceivedEventArgs.cs index a63f9e087..17c35f733 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeCommandReceivedEventArgs.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeCommandReceivedEventArgs.cs @@ -27,7 +27,7 @@ namespace Tizen.Multimedia.Remoting /// /// Initializes a new instance of the class. /// - /// The playback position command. + /// The repeat mode command. /// is null. /// 5 public RepeatModeCommandReceivedEventArgs(RepeatModeCommand command) diff --git a/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeCapabilityUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeCapabilityUpdatedEventArgs.cs index 5be145618..3b74fdb96 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeCapabilityUpdatedEventArgs.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeCapabilityUpdatedEventArgs.cs @@ -30,7 +30,7 @@ namespace Tizen.Multimedia.Remoting /// Initializes a new instance of the class. /// /// The shuffle mode capabilities. - /// is not vaild. + /// is not valid. /// 5 public ShuffleModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport support) { diff --git a/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeCommandReceivedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeCommandReceivedEventArgs.cs index 666cd1fec..043b2987a 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeCommandReceivedEventArgs.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeCommandReceivedEventArgs.cs @@ -27,7 +27,7 @@ namespace Tizen.Multimedia.Remoting /// /// Initializes a new instance of the class. /// - /// The playback position command. + /// The shuffle mode command. /// is null. /// 5 public ShuffleModeCommandReceivedEventArgs(ShuffleModeCommand command) diff --git a/src/Tizen.Multimedia.Remoting/MediaController/SubtitleModeCommandReceivedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/SubtitleModeCommandReceivedEventArgs.cs new file mode 100644 index 000000000..c45c0009f --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/SubtitleModeCommandReceivedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Provides data for the event. + /// + /// 6 + public class SubtitleModeCommandReceivedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// The subtitle command. + /// is null. + /// 6 + internal SubtitleModeCommandReceivedEventArgs(SubtitleModeCommand command) + { + Command = command ?? throw new ArgumentNullException(nameof(command)); + } + + /// + /// Gets the . + /// + /// 6 + public SubtitleModeCommand Command { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/SubtitleModeUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/SubtitleModeUpdatedEventArgs.cs new file mode 100644 index 000000000..debcc8286 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/SubtitleModeUpdatedEventArgs.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Provides data for the event. + /// + /// 6 + public class SubtitleModeUpdatedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// A value indicating the updated subtitle mode. + /// 6 + internal SubtitleModeUpdatedEventArgs(bool isEnabled) + { + IsEnabled = isEnabled; + } + + /// + /// Gets the value indicating whether subtitle is enabled or not. + /// + /// 6 + public bool IsEnabled { get; } + } +} \ No newline at end of file