* [MediaController] Add new APIs for subtitle, 360 mode, display mode, display rotation
{
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);
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")]
[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));
[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);
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
{
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);
[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));
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")]
[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);
[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));
[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));
[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);
[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);
[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
[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,
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
}
}
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaController.DisplayModeCapabilityUpdated"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class DisplayModeCapabilityUpdatedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DisplayModeCapabilityUpdatedEventArgs"/> class.
+ /// </summary>
+ /// <param name="mode">The supported list of display mode capabilities.</param>
+ /// <since_tizen> 6 </since_tizen>
+ internal DisplayModeCapabilityUpdatedEventArgs(IList<MediaControlDisplayMode> mode)
+ {
+ DisplayMode = new ReadOnlyCollection<MediaControlDisplayMode>(mode);
+ }
+
+ /// <summary>
+ /// Gets the supported list of display mode capabilities.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public ReadOnlyCollection<MediaControlDisplayMode> DisplayMode { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaControlServer.DisplayModeCommandReceived"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class DisplayModeCommandReceivedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DisplayModeCommandReceivedEventArgs"/> class.
+ /// </summary>
+ /// <param name="command">The display mode command.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ internal DisplayModeCommandReceivedEventArgs(DisplayModeCommand command)
+ {
+ Command = command ?? throw new ArgumentNullException(nameof(command));
+ }
+
+ /// <summary>
+ /// Gets the <see cref="DisplayModeCommand"/>.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public DisplayModeCommand Command { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaController.DisplayModeUpdated"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class DisplayModeUpdatedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DisplayModeUpdatedEventArgs"/> class.
+ /// </summary>
+ /// <param name="mode">A value indicating the updated display mode.</param>
+ /// <since_tizen> 6 </since_tizen>
+ internal DisplayModeUpdatedEventArgs(MediaControlDisplayMode mode)
+ {
+ DisplayMode = mode;
+ }
+
+ /// <summary>
+ /// Gets the updated display mode.
+ /// </summary>
+ /// <value>The <see cref="MediaControlDisplayMode"/>.</value>
+ /// <since_tizen> 6 </since_tizen>
+ public MediaControlDisplayMode DisplayMode { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaController.DisplayRotationCapabilityUpdated"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class DisplayRotationCapabilityUpdatedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DisplayRotationCapabilityUpdatedEventArgs"/> class.
+ /// </summary>
+ /// <param name="rotation">The list of supported display rotation capabilities.</param>
+ /// <since_tizen> 6 </since_tizen>
+ internal DisplayRotationCapabilityUpdatedEventArgs(IList<Rotation> rotation)
+ {
+ DisplayRotation = new ReadOnlyCollection<Rotation>(rotation);
+ }
+
+ /// <summary>
+ /// Gets the supported list of display rotation capabilities.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public ReadOnlyCollection<Rotation> DisplayRotation { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaControlServer.DisplayRotationCommandReceived"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class DisplayRotationCommandReceivedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DisplayRotationCommandReceivedEventArgs"/> class.
+ /// </summary>
+ /// <param name="command">The display rotation command.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ internal DisplayRotationCommandReceivedEventArgs(DisplayRotationCommand command)
+ {
+ Command = command ?? throw new ArgumentNullException(nameof(command));
+ }
+
+ /// <summary>
+ /// Gets the <see cref="DisplayRotationCommand"/>.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public DisplayRotationCommand Command { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaController.DisplayRotationUpdated"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class DisplayRotationUpdatedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DisplayRotationUpdatedEventArgs"/> class.
+ /// </summary>
+ /// <param name="rotation">A value indicating the updated display rotation.</param>
+ /// <since_tizen> 6 </since_tizen>
+ internal DisplayRotationUpdatedEventArgs(Rotation rotation)
+ {
+ Rotation = rotation;
+ }
+
+ /// <summary>
+ /// Gets the updated display rotation.
+ /// </summary>
+ /// <value>The <see cref="Rotation"/>.</value>
+ /// <since_tizen> 6 </since_tizen>
+ public Rotation Rotation { get; }
+ }
+}
\ No newline at end of file
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+using System;
namespace Tizen.Multimedia.Remoting
{
Resolution
}
- internal enum MediaControlCapabilityCategory
+ internal enum MediaControlNativeCapabilityCategory
{
Shuffle,
Repeat,
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
}
/// <summary>
+ /// Provides a means to to send subtitle mode command.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public sealed class SubtitleModeCommand : Command
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SubtitleModeCommand"/> class.
+ /// </summary>
+ /// <param name="isEnabled">A value indicating whether subtitle mode is enabled.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public SubtitleModeCommand(bool isEnabled)
+ {
+ IsEnabled = isEnabled;
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether subtitle mode is enabled or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ 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;
+ }
+ }
+
+ /// <summary>
+ /// Provides a means to to send 360 mode command.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public sealed class Mode360Command : Command
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Mode360Command"/> class.
+ /// </summary>
+ /// <param name="isEnabled">A value indicating whether 360 mode is enabled or not.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public Mode360Command(bool isEnabled)
+ {
+ IsEnabled = isEnabled;
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether 360 mode is enabled or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ 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;
+ }
+ }
+
+ /// <summary>
+ /// Provides a means to to send display mode command.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public sealed class DisplayModeCommand : Command
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DisplayModeCommand"/> class.
+ /// </summary>
+ /// <param name="mode">The <see cref="MediaControlDisplayMode"/>.</param>
+ /// <exception cref="ArgumentException"><paramref name="mode"/> is not valid.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public DisplayModeCommand(MediaControlDisplayMode mode)
+ {
+ ValidationUtil.ValidateEnum(typeof(MediaControlDisplayMode), mode, nameof(mode));
+
+ Mode = mode;
+ }
+
+ /// <summary>
+ /// Gets the display mode.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ 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;
+ }
+ }
+
+ /// <summary>
+ /// Provides a means to to send display rotation command.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public sealed class DisplayRotationCommand : Command
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DisplayRotationCommand"/> class.
+ /// </summary>
+ /// <param name="rotation">The <see cref="Rotation"/>.</param>
+ /// <exception cref="ArgumentException"><paramref name="rotation"/> is not valid.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public DisplayRotationCommand(Rotation rotation)
+ {
+ ValidationUtil.ValidateEnum(typeof(Rotation), rotation, nameof(rotation));
+
+ Rotation = rotation;
+ }
+
+ /// <summary>
+ /// Gets the display rotation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ 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;
+ }
+ }
+
+ /// <summary>
/// Provides a means to to send custom commands.
/// </summary>
/// <remarks>This command can be used by both client and server to send predefined command or data.</remarks>
*/
using System;
+using System.Collections.Generic;
using System.Diagnostics;
namespace Tizen.Multimedia.Remoting
Tpo
}
+ /// <summary>
+ /// Specifies the display mode.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public enum MediaControlDisplayMode
+ {
+ /// <summary>
+ /// Letter box
+ /// </summary>
+ LetterBox,
+
+ /// <summary>
+ /// Original size
+ /// </summary>
+ OriginSize,
+
+ /// <summary>
+ /// Full screen
+ /// </summary>
+ FullScreen,
+
+ /// <summary>
+ /// Cropped full screen
+ /// </summary>
+ CroppedFull
+ }
+
internal static class EnumExtensions
{
internal static MediaControlPlaybackState ToPublic(this MediaControllerNativePlaybackState nativeState)
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<MediaControlDisplayMode> ToPublicList(this MediaControlNativeDisplayMode modes)
+ {
+ var supportedModes = new List<MediaControlDisplayMode>();
+
+ 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<Rotation> ToPublicList(this MediaControlNativeDisplayRotation modes)
+ {
+ var supportedRotations = new List<Rotation>();
+
+ 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
}
/// <summary>
- /// Update the playlist by lastest info.
+ /// Update the playlist by latest info.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public void Update()
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;
+
/// <summary>
/// Occurs when a client sends playback command.
/// </summary>
public static event EventHandler<RepeatModeCommandReceivedEventArgs> RepeatModeCommandReceived;
/// <summary>
+ /// Occurs when a client sends subtitle mode command.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public static event EventHandler<SubtitleModeCommandReceivedEventArgs> SubtitleModeCommandReceived;
+
+ /// <summary>
+ /// Occurs when a client sends mode 360 command.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public static event EventHandler<Mode360CommandReceivedEventArgs> Mode360CommandReceived;
+
+ /// <summary>
+ /// Occurs when a client sends display mode command.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public static event EventHandler<DisplayModeCommandReceivedEventArgs> DisplayModeCommandReceived;
+
+ /// <summary>
+ /// Occurs when a client sends display rotation command.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public static event EventHandler<DisplayRotationCommandReceivedEventArgs> DisplayRotationCommandReceived;
+
+ /// <summary>
/// Occurs when a client sends custom command.
/// </summary>
/// <since_tizen> 5 </since_tizen>
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, _) =>
RegisterPlaylistCommandReceivedEvent();
RegisterShuffleModeCommandReceivedEvent();
RegisterRepeatModeCommandReceivedEvent();
+ RegisterSubtitleModeCommandReceivedEvent();
+ RegisterMode360CommandReceivedEvent();
+ RegisterDisplayModeCommandReceivedEvent();
+ RegisterDisplayRotationCommandReceivedEvent();
RegisterCustomCommandReceivedEvent();
RegisterCommandCompletedEvent();
RegisterSearchCommandReceivedEvent();
}
/// <summary>
+ /// Gets the active clients.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <returns>the activated client ids.</returns>
+ /// <since_tizen> 5 </since_tizen>
+ public static IEnumerable<string> GetActivatedClients()
+ {
+ var clientIds = new List<string>();
+
+ 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
+ /// <summary>
/// Updates playback state and playback position.</summary>
/// <param name="state">The playback state.</param>
/// <param name="position">The playback position in milliseconds.</param>
}
/// <summary>
- /// Sets the index of current playing media.
- /// </summary>
- /// <param name="index">The index of current playing media.</param>
- /// <exception cref="ArgumentNullException"><paramref name="index"/> is null.</exception>
- /// <exception cref="InvalidOperationException">
- /// The server is not running .<br/>
- /// -or-<br/>
- /// An internal error occurs.
- /// </exception>
- /// <since_tizen> 5 </since_tizen>
- [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.");
- }
-
- /// <summary>
/// Sets the playlist name and index of current playing media.
/// </summary>
/// <param name="playlistName">The playlist name of current playing media.</param>
}
/// <summary>
- /// Delete playlist.
+ /// Sets the age rating of latest played media.
/// </summary>
- /// <param name="playlist">The name of playlist.</param>
- /// <exception cref="ArgumentNullException"><paramref name="playlist"/> is null.</exception>
+ /// <param name="ageRating">
+ /// 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.
+ /// </param>
+ /// <exception cref="ArgumentOutOfRangeException">The specified <paramref name="ageRating"/> is not valid.</exception>
/// <exception cref="InvalidOperationException">
/// The server is not running .<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
/// <since_tizen> 5 </since_tizen>
- 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)
+ /// <summary>
+ /// Sets the subtitle mode.
+ /// </summary>
+ /// <param name="isEnabled">A value indicating whether the subtitle mode is enabled.</param>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ 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)
+ /// <summary>
+ /// Sets the 360 mode.
+ /// </summary>
+ /// <param name="isEnabled">A value indicating whether the 360 mode is enabled.</param>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ 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.");
}
/// <summary>
- /// Gets the active clients.
+ /// Sets the display mode.
/// </summary>
+ /// <param name="mode">A value indicating the <see cref="MediaControlDisplayMode"/>.</param>
/// <exception cref="InvalidOperationException">
/// The server is not running .<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <returns>the activated client ids.</returns>
- /// <since_tizen> 5 </since_tizen>
- public static IEnumerable<string> GetActivatedClients()
+ /// <since_tizen> 6 </since_tizen>
+ public static void SetDisplayMode(MediaControlDisplayMode mode)
{
- var clientIds = new List<string>();
-
- 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.");
}
/// <summary>
- /// Requests commands to the client.
+ /// Sets the display rotation.
/// </summary>
- /// <remarks>
- /// The client can request the command to execute <see cref="Command"/>, <br/>
- /// and then, the server receive the result of each request(command).
- /// </remarks>
- /// <param name="command">A <see cref="Command"/> class.</param>
- /// <param name="clientId">The client Id to send command.</param>
- /// <returns><see cref="Bundle"/> represents the extra data from client and it can be null.</returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="command"/> or <paramref name="clientId"/> is null.
- /// </exception>
+ /// <param name="rotation">A value indicating the <see cref="Rotation"/>.</param>
/// <exception cref="InvalidOperationException">
- /// The server has already been stopped.<br/>
+ /// The server is not running .<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <since_tizen> 5 </since_tizen>
- public static async Task<Bundle> RequestAsync(Command command, string clientId)
+ /// <since_tizen> 6 </since_tizen>
+ 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<MediaControllerError>();
- string reqeustId = null;
- Bundle bundle = null;
-
- EventHandler<CommandCompletedEventArgs> 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.");
}
/// <summary>
- /// Sends the result of each command.
+ /// Sets the index of current playing media.
/// </summary>
- /// <param name="command">The command that return to client.</param>
- /// <param name="result">The result of <paramref name="command"/>.</param>
- /// <param name="bundle">The extra data.</param>
- /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <param name="index">The index of current playing media.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="index"/> is null.</exception>
/// <exception cref="InvalidOperationException">
/// The server is not running .<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
/// <since_tizen> 5 </since_tizen>
- 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
/// <summary>
- /// Sends the result of each command.
+ /// Delete playlist.
/// </summary>
- /// <param name="command">The command that return to client.</param>
- /// <param name="result">The result of <paramref name="command"/>.</param>
- /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <remarks>Currently, only server can remove the playlist.</remarks>
+ /// <param name="playlist">The name of playlist.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="playlist"/> is null.</exception>
/// <exception cref="InvalidOperationException">
/// The server is not running .<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
/// <since_tizen> 5 </since_tizen>
- 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
/// <summary>
/// Sets the content type of latest played media.
/// </summary>
{
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.");
}
/// <summary>
- /// Sets the content type of latest played media.
+ /// Sets the <see cref="MediaControlCapabilitySupport"/> indicating repeat mode is supported or not.
/// </summary>
/// <param name="support">A value indicating whether the <see cref="MediaControlRepeatMode"/> is supported or not.</param>
/// <exception cref="InvalidOperationException">
{
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
/// <summary>
- /// Sets the age rating of latest played media.
+ /// Sets the supported list of <see cref="MediaControlDisplayMode"/>.
/// </summary>
- /// <param name="ageRating">
- /// 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.
- /// </param>
- /// <exception cref="ArgumentOutOfRangeException">The specified <paramref name="ageRating"/> is not valid.</exception>
+ /// <remarks>
+ /// <see cref="MediaControlCapabilitySupport.NotDecided"/> is not allowed in display mode capability.
+ /// The default value of each <see cref="MediaControlDisplayMode"/> is not supported.
+ /// </remarks>
+ /// <param name="capabilities">The supported list of <see cref="MediaControlDisplayMode"/>.</param>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <exception cref="ArgumentException"><paramref name="capabilities"/> is invalid.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public static void SetDisplayModeCapabilities(IDictionary<MediaControlDisplayMode, MediaControlCapabilitySupport> capabilities)
+ {
+ foreach (var pair in capabilities)
+ {
+ SetDisplayModeCapability(pair.Key, pair.Value);
+ }
+ }
+
+ /// <summary>
+ /// Sets the <paramref name="mode"/> is supported or not.
+ /// </summary>
+ /// <remarks>
+ /// <see cref="MediaControlCapabilitySupport.NotDecided"/> is not allowed in display mode capability.<br/>
+ /// The default value of each <see cref="MediaControlDisplayMode"/> is not supported.
+ /// </remarks>
+ /// <param name="mode">The <see cref="MediaControlDisplayMode"/>.</param>
+ /// <param name="support">A value indicating whether the <paramref name="mode"/> is supported or not.</param>
/// <exception cref="InvalidOperationException">
/// The server is not running .<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
+ /// <exception cref="ArgumentException"><paramref name="mode"/> or <paramref name="support"/> is invalid.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ 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.");
+ }
+
+ /// <summary>
+ /// Sets the supported list of <see cref="Rotation"/>.
+ /// </summary>
+ /// <remarks>
+ /// <see cref="MediaControlCapabilitySupport.NotDecided"/> is not allowed in display rotation capability.<br/>
+ /// The default value of each <see cref="Rotation"/> is not supported.
+ /// </remarks>
+ /// <param name="capabilities">The supported list of <see cref="Rotation"/>.</param>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <exception cref="ArgumentException"><paramref name="capabilities"/> is invalid.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public static void SetDisplayRotationCapabilities(IDictionary<Rotation, MediaControlCapabilitySupport> capabilities)
+ {
+ foreach (var pair in capabilities)
+ {
+ SetDisplayRotationCapability(pair.Key, pair.Value);
+ }
+ }
+
+ /// <summary>
+ /// Sets the <paramref name="rotation"/> is supported or not.
+ /// </summary>
+ /// <remarks>
+ /// <see cref="MediaControlCapabilitySupport.NotDecided"/> is not allowed in display rotation capability.<br/>
+ /// The default value of each <see cref="Rotation"/> is not supported.
+ /// </remarks>
+ /// <param name="rotation">The <see cref="Rotation"/>.</param>
+ /// <param name="support">A value indicating whether the <paramref name="rotation"/> is supported or not..</param>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <exception cref="ArgumentException"><paramref name="rotation"/> or <paramref name="support"/> is invalid.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ 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
+ /// <summary>
+ /// Requests commands to the client.
+ /// </summary>
+ /// <remarks>
+ /// The client can request the command to execute <see cref="Command"/>, <br/>
+ /// and then, the server receive the result of each request(command).
+ /// </remarks>
+ /// <param name="command">A <see cref="Command"/> class.</param>
+ /// <param name="clientId">The client Id to send command.</param>
+ /// <returns><see cref="Bundle"/> represents the extra data from client and it can be null.</returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="command"/> or <paramref name="clientId"/> is null.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// The server has already been stopped.<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
/// <since_tizen> 5 </since_tizen>
- public static void SetAgeRating(int ageRating)
+ public static async Task<Bundle> 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<MediaControllerError>();
+ string reqeustId = null;
+ Bundle bundle = null;
+
+ EventHandler<CommandCompletedEventArgs> 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;
+ }
+ }
+
+ /// <summary>
+ /// Sends the result of each command.
+ /// </summary>
+ /// <param name="command">The command that return to client.</param>
+ /// <param name="result">The result of <paramref name="command"/>.</param>
+ /// <param name="bundle">The extra data.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <since_tizen> 5 </since_tizen>
+ public static void Response(Command command, int result, Bundle bundle)
+ {
+ if (command == null)
+ {
+ throw new ArgumentNullException(nameof(command));
+ }
+
+ command.Response(Handle, result, bundle);
+ }
+
+ /// <summary>
+ /// Sends the result of each command.
+ /// </summary>
+ /// <param name="command">The command that return to client.</param>
+ /// <param name="result">The result of <paramref name="command"/>.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <since_tizen> 5 </since_tizen>
+ 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
*/
using System;
+using System.Linq;
using System.Collections.Generic;
using Tizen.Applications;
using Native = Interop.MediaControllerClient;
ServerStopped?.Invoke(this, EventArgs.Empty);
}
+ #region Updated event
/// <summary>
/// Occurs when the playback state is updated.
/// </summary>
}
/// <summary>
+ /// Occurs when the playlist is updated.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ public event EventHandler<PlaylistUpdatedEventArgs> PlaylistUpdated;
+
+ internal void RaisePlaylistUpdatedEvent(MediaControlPlaylistMode mode, string name, IntPtr playlistHandle)
+ {
+ PlaylistUpdated?.Invoke(this, new PlaylistUpdatedEventArgs(mode, name, new MediaControlPlaylist(playlistHandle)));
+ }
+
+ /// <summary>
/// Occurs when the metadata is updated.
/// </summary>
/// <since_tizen> 4 </since_tizen>
}
/// <summary>
- /// Occurs when the playlist is updated.
+ /// Occurs when the subtitle mode is updated.
/// </summary>
- /// <since_tizen> 5 </since_tizen>
- public event EventHandler<PlaylistUpdatedEventArgs> PlaylistUpdated;
+ /// <since_tizen> 6 </since_tizen>
+ public event EventHandler<SubtitleModeUpdatedEventArgs> SubtitleModeUpdated;
+ internal void RaiseSubtitleModeUpdatedEvent(bool isEnabled)
+ {
+ SubtitleModeUpdated?.Invoke(this, new SubtitleModeUpdatedEventArgs(isEnabled));
+ }
- internal void RaisePlaylistUpdatedEvent(MediaControlPlaylistMode mode, string name, IntPtr playlistHandle)
+ /// <summary>
+ /// Occurs when the 360 mode is updated.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public event EventHandler<Mode360UpdatedEventArgs> Mode360Updated;
+ internal void RaiseMode360UpdatedEvent(bool isEnabled)
{
- PlaylistUpdated?.Invoke(this, new PlaylistUpdatedEventArgs(mode, name, new MediaControlPlaylist(playlistHandle)));
+ Mode360Updated?.Invoke(this, new Mode360UpdatedEventArgs(isEnabled));
}
/// <summary>
- /// Occurs when the command is completed.
+ /// Occurs when the display mode is updated.
/// </summary>
- /// <remarks>
- /// User can match the command and this event using <see cref="CommandCompletedEventArgs.RequestId"/> field.
- /// </remarks>
- /// <since_tizen> 5 </since_tizen>
- internal event EventHandler<CommandCompletedEventArgs> CommandCompleted;
+ /// <since_tizen> 6 </since_tizen>
+ public event EventHandler<DisplayModeUpdatedEventArgs> DisplayModeUpdated;
+ internal void RaiseDisplayModeUpdatedEvent(MediaControlNativeDisplayMode mode)
+ {
+ DisplayModeUpdated?.Invoke(this, new DisplayModeUpdatedEventArgs(mode.ToPublic()));
+ }
- internal void RaiseCommandCompletedEvent(string requestId, MediaControllerError result, IntPtr bundleHandle)
+ /// <summary>
+ /// Occurs when the display rotation is updated.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public event EventHandler<DisplayRotationUpdatedEventArgs> 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
/// <summary>
/// Occurs when the playback capabilities are updated.
/// </summary>
{
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);
}
}
/// <summary>
+ /// Occurs when the display mode capabilities are updated.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public event EventHandler<DisplayModeCapabilityUpdatedEventArgs> DisplayModeCapabilityUpdated;
+
+ internal void RaiseDisplayModeCapabilityUpdatedEvent(MediaControlNativeDisplayMode modes)
+ {
+ DisplayModeCapabilityUpdated?.Invoke(this, new DisplayModeCapabilityUpdatedEventArgs(modes.ToPublicList()));
+ }
+
+ /// <summary>
+ /// Occurs when the display rotation capabilities are updated.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public event EventHandler<DisplayRotationCapabilityUpdatedEventArgs> DisplayRotationCapabilityUpdated;
+
+ internal void RaiseDisplayRotationCapabilityUpdatedEvent(MediaControlNativeDisplayRotation rotations)
+ {
+ DisplayRotationCapabilityUpdated?.Invoke(this, new DisplayRotationCapabilityUpdatedEventArgs(rotations.ToPublicList()));
+ }
+ #endregion
+
+
+ #region Command
+ /// <summary>
+ /// Occurs when the command is completed.
+ /// </summary>
+ /// <remarks>
+ /// User can match the command and this event using <see cref="CommandCompletedEventArgs.RequestId"/> field.
+ /// </remarks>
+ /// <since_tizen> 5 </since_tizen>
+ internal event EventHandler<CommandCompletedEventArgs> 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));
+ }
+ }
+
+ /// <summary>
/// Occurs when a server sends custom event.
/// </summary>
/// <since_tizen> 5 </since_tizen>
{
CustomCommandReceived?.Invoke(this, new CustomCommandReceivedEventArgs(command));
}
+ #endregion
}
}
\ No newline at end of file
}
}
+
+ #region Get information
/// <summary>
/// Returns the playback state set by the server.
/// </summary>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <seealso cref="MediaControlServer.SetPlaybackState(MediaControlPlaybackState, long)"/>
/// <since_tizen> 4 </since_tizen>
public MediaControlPlaybackState GetPlaybackState()
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.");
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <seealso cref="MediaControlServer.SetPlaybackState(MediaControlPlaybackState, long)"/>
/// <since_tizen> 4 </since_tizen>
public long GetPlaybackPosition()
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.");
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <seealso cref="MediaControlServer.SetMetadata(MediaControlMetadata)"/>
/// <since_tizen> 4 </since_tizen>
public MediaControlMetadata GetMetadata()
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
public IEnumerable<MediaControlPlaylist> GetPlaylists()
{
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
public MediaControlPlaylist GetPlaylistOfCurrentPlayingMedia()
{
// 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);
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
public string GetIndexOfCurrentPlayingMedia()
{
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;
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <seealso cref="MediaControlServer.SetShuffleModeEnabled(bool)"/>
/// <since_tizen> 4 </since_tizen>
public bool IsShuffleModeEnabled()
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <seealso cref="MediaControlServer.SetRepeatMode(MediaControlRepeatMode)"/>
/// <since_tizen> 4 </since_tizen>
public MediaControlRepeatMode GetRepeatMode()
}
/// <summary>
- /// Requests command to the server.
+ /// Gets the content type of current playing media.
/// </summary>
- /// <remarks>
- /// The client can request the server to execute <see cref="PlaybackCommand"/> or <see cref="ShuffleModeCommand"/> or
- /// <see cref="RepeatModeCommand"/> or <see cref="CustomCommand"/>, <br/>
- /// and then, the client receive the result of each request(command).
- /// </remarks>
- /// <param name="command">A <see cref="Command"/> class.</param>
- /// <returns><see cref="Bundle"/> represents the extra data from server and it can be null.</returns>
- /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <returns>The <see cref="MediaControlContentType"/>.</returns>
/// <exception cref="InvalidOperationException">
/// The server has already been stopped.<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
- public async Task<Bundle> RequestAsync(Command command)
+ public MediaControlContentType GetContentTypeOfCurrentPlayingMedia()
{
- if (command == null)
- {
- throw new ArgumentNullException(nameof(command));
- }
-
ThrowIfStopped();
- command.SetRequestInformation(ServerAppId);
-
- var tcs = new TaskCompletionSource<MediaControllerError>();
- string reqeustId = null;
- Bundle bundle = null;
-
- EventHandler<CommandCompletedEventArgs> 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);
+ }
}
}
/// <summary>
- /// Sends the result of each command.
+ /// Gets the icon path.
/// </summary>
- /// <param name="command">The command that return to client.</param>
- /// <param name="result">The result of <paramref name="command"/>.</param>
- /// <param name="bundle">The extra data.</param>
- /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <returns>The icon path.</returns>
/// <exception cref="InvalidOperationException">
- /// The server is not running .<br/>
+ /// The server has already been stopped.<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
- 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;
}
/// <summary>
- /// Sends the result of each command.
+ /// Gets the age rating of current playing media.
/// </summary>
- /// <param name="command">The command that return to client.</param>
- /// <param name="result">The result of <paramref name="command"/>.</param>
- /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <returns>The Age rating of current playing media. The range is 0 to 19, inclusive.</returns>
/// <exception cref="InvalidOperationException">
- /// The server is not running .<br/>
+ /// The server has already been stopped.<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
- 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);
+ }
+ }
}
/// <summary>
- /// Sends playback command to the server.
+ /// Gets whether the subtitle mode is enabled or not.
/// </summary>
- /// <param name="command">A playback command.</param>
+ /// <returns>A value indicating whether the subtitle mode is enabled or not.</returns>
+ /// <value>true if the subtitle mode is enabled; otherwise, false.</value>
/// <exception cref="InvalidOperationException">
/// The server has already been stopped.<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ArgumentException"><paramref name="command"/> is not valid.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
- /// <seealso cref="MediaControlServer.PlaybackCommandReceived"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated. Please use Request instead.")]
- public void SendPlaybackCommand(MediaControlPlaybackCommand command)
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ 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
/// <summary>
- /// Gets the content type of current playing media.
+ /// Gets whether the 360 mode is enabled or not.
/// </summary>
- /// <returns>The <see cref="MediaControlContentType"/>.</returns>
+ /// <returns>A value indicating whether the 360 mode is enabled or not.</returns>
+ /// <value>true if the 360 mode is enabled; otherwise, false.</value>
/// <exception cref="InvalidOperationException">
/// The server has already been stopped.<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
- /// <since_tizen> 5 </since_tizen>
- public MediaControlContentType GetContentTypeOfCurrentPlayingMedia()
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ 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;
}
/// <summary>
- /// Gets the icon path.
+ /// Gets the current display mode.
/// </summary>
- /// <returns>The icon path.</returns>
+ /// <returns>The <see cref="MediaControlDisplayMode"/>.</returns>
/// <exception cref="InvalidOperationException">
/// The server has already been stopped.<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
- /// <since_tizen> 5 </since_tizen>
- public string GetIconPath()
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="MediaControllerManager"/> has already been disposed.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ 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();
}
/// <summary>
- /// Gets the age rating of current playing media.
+ /// Gets the current display rotation.
/// </summary>
- /// <returns>The Age rating of current playing media. The range is 0 to 19, inclusive.</returns>
+ /// <returns>The <see cref="Rotation"/>.</returns>
/// <exception cref="InvalidOperationException">
/// The server has already been stopped.<br/>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
- /// <since_tizen> 5 </since_tizen>
- public int GetAgeRatingOfCurrentPlayingMedia()
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="MediaControllerManager"/> has already been disposed.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ 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
/// <summary>
/// Gets the value whether <see cref="MediaControlPlaybackCommand"/> is supported or not.
/// </summary>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
public Dictionary<MediaControlPlaybackCommand, MediaControlCapabilitySupport> GetPlaybackCapabilities()
{
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);
}
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
public MediaControlCapabilitySupport GetPlaybackCapability(MediaControlPlaybackCommand action)
{
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;
}
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
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;
}
/// <summary>
/// -or-<br/>
/// An internal error occurs.
/// </exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
/// <since_tizen> 5 </since_tizen>
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;
+ }
+
+ /// <summary>
+ /// Gets the value whether the repeat mode is supported or not.
+ /// </summary>
+ /// <returns>
+ /// If there's no supported display mode by server, it will return null.
+ /// otherwise, it will return the supported list of <see cref="MediaControlDisplayMode"/>.
+ /// </returns>
+ /// <exception cref="InvalidOperationException">
+ /// The server has already been stopped.<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public IEnumerable<MediaControlDisplayMode> GetDisplayModeCapability()
+ {
+ ThrowIfStopped();
+
+ Native.GetDisplayModeCapability(Manager.Handle, ServerAppId, out uint support).
+ ThrowIfError("Failed to get display mode capability");
+
+ return support != 0 ? ((MediaControlNativeDisplayMode)support).ToPublicList() : null;
+ }
+
+ /// <summary>
+ /// Gets the value whether the display mode is supported or not.
+ /// </summary>
+ /// <returns>
+ /// If there's no supported display rotation by server, it will return null.
+ /// otherwise, it will return the supported list of <see cref="Rotation"/>.
+ /// </returns>
+ /// <exception cref="InvalidOperationException">
+ /// The server has already been stopped.<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public IEnumerable<Rotation> 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
+ /// <summary>
+ /// Requests command to the server.
+ /// </summary>
+ /// <remarks>
+ /// The client can request the server to execute <see cref="PlaybackCommand"/> or <see cref="ShuffleModeCommand"/> or
+ /// <see cref="RepeatModeCommand"/> or <see cref="CustomCommand"/>, <br/>
+ /// and then, the client receive the result of each request(command).
+ /// </remarks>
+ /// <param name="command">A <see cref="Command"/> class.</param>
+ /// <returns><see cref="Bundle"/> represents the extra data from server and it can be null.</returns>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The server has already been stopped.<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
+ /// <since_tizen> 5 </since_tizen>
+ public async Task<Bundle> RequestAsync(Command command)
+ {
+ if (command == null)
+ {
+ throw new ArgumentNullException(nameof(command));
+ }
+
+ ThrowIfStopped();
+
+ command.SetRequestInformation(ServerAppId);
+
+ var tcs = new TaskCompletionSource<MediaControllerError>();
+ string reqeustId = null;
+ Bundle bundle = null;
+
+ EventHandler<CommandCompletedEventArgs> 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;
+ }
+ }
+
+ /// <summary>
+ /// Sends the result of each command.
+ /// </summary>
+ /// <param name="command">The command that return to client.</param>
+ /// <param name="result">The result of <paramref name="command"/>.</param>
+ /// <param name="bundle">The extra data.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <since_tizen> 5 </since_tizen>
+ public void Response(Command command, int result, Bundle bundle)
+ {
+ if (command == null)
+ {
+ throw new ArgumentNullException(nameof(command));
+ }
+
+ command.Response(Manager.Handle, result, bundle);
+ }
+
+ /// <summary>
+ /// Sends the result of each command.
+ /// </summary>
+ /// <param name="command">The command that return to client.</param>
+ /// <param name="result">The result of <paramref name="command"/>.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The server is not running .<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <since_tizen> 5 </since_tizen>
+ public void Response(Command command, int result)
+ {
+ if (command == null)
+ {
+ throw new ArgumentNullException(nameof(command));
}
+
+ command.Response(Manager.Handle, result, null);
+ }
+
+ /// <summary>
+ /// Sends playback command to the server.
+ /// </summary>
+ /// <param name="command">A playback command.</param>
+ /// <exception cref="InvalidOperationException">
+ /// The server has already been stopped.<br/>
+ /// -or-<br/>
+ /// An internal error occurs.
+ /// </exception>
+ /// <exception cref="ArgumentException"><paramref name="command"/> is not valid.</exception>
+ /// <exception cref="ObjectDisposedException">The <see cref="MediaControllerManager"/> has already been disposed.</exception>
+ /// <seealso cref="MediaControlServer.PlaybackCommandReceived"/>
+ /// <since_tizen> 4 </since_tizen>
+ [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
{
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;
+
/// <summary>
/// Occurs when a server is started.
/// </summary>
RegisterShuffleModeUpdatedEvent();
RegisterRepeatModeUpdatedEvent();
RegisterPlaylistUpdatedEvent();
- RegisterCommandCompletedEvent();
+ RegisterSubtitleModeUpdateEvent();
+ RegisterMode360UpdateEvent();
+ RegisterDisplayModeUpdateEvent();
+ RegisterDisplayRotationUpdateEvent();
+
RegisterPlaybackCapabilitiesEvent();
+ RegisterDisplayModeCapabilityUpdatedEvent();
+ RegisterDisplayRotationCapabilityUpdatedEvent();
+ RegisterSimpleCapabilityUpdatedEvent();
+
+ RegisterCommandCompletedEvent();
RegisterCustomCommandReceivedEvent();
- RegisterSimpleCapabilityEvent();
}
private void RaiseServerChangedEvent(MediaControllerNativeServerState state, MediaController controller)
}
}
+
+ #region Updated event
private void RegisterServerUpdatedEvent()
{
_serverUpdatedCallback = (serverName, state, _) =>
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()
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()
{
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()
};
Native.SetShuffleModeUpdatedCb(Handle, _shufflemodeUpdatedCallback).
- ThrowIfError("Failed to init ShuffleModeUpdated event.");
+ ThrowIfError("Failed to register ShuffleModeUpdated event.");
}
private void RegisterRepeatModeUpdatedEvent()
};
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()
};
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
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaControlServer.Mode360CommandReceived"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class Mode360CommandReceivedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Mode360CommandReceivedEventArgs"/> class.
+ /// </summary>
+ /// <param name="command">The 360 mode command.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ internal Mode360CommandReceivedEventArgs(Mode360Command command)
+ {
+ Command = command ?? throw new ArgumentNullException(nameof(command));
+ }
+
+ /// <summary>
+ /// Gets the <see cref="Mode360Command"/>.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public Mode360Command Command { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaController.Mode360Updated"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class Mode360UpdatedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Mode360UpdatedEventArgs"/> class.
+ /// </summary>
+ /// <param name="isEnabled">A value indicating the updated 360 mode.</param>
+ /// <since_tizen> 6 </since_tizen>
+ internal Mode360UpdatedEventArgs(bool isEnabled)
+ {
+ IsEnabled = isEnabled;
+ }
+
+ /// <summary>
+ /// Gets the value indicating whether 360 mode is enabled or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public bool IsEnabled { get; }
+ }
+}
\ No newline at end of file
/// Initializes a new instance of the <see cref="RepeatModeCapabilityUpdatedEventArgs"/> class.
/// </summary>
/// <param name="support">The repeat mode capabilities.</param>
- /// <exception cref="ArgumentException"><paramref name="support"/> is not vaild.</exception>
+ /// <exception cref="ArgumentException"><paramref name="support"/> is not valid.</exception>
/// <since_tizen> 5 </since_tizen>
public RepeatModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport support)
{
/// <summary>
/// Initializes a new instance of the <see cref="RepeatModeCommandReceivedEventArgs"/> class.
/// </summary>
- /// <param name="command">The playback position command.</param>
+ /// <param name="command">The repeat mode command.</param>
/// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
/// <since_tizen> 5 </since_tizen>
public RepeatModeCommandReceivedEventArgs(RepeatModeCommand command)
/// Initializes a new instance of the <see cref="ShuffleModeCapabilityUpdatedEventArgs"/> class.
/// </summary>
/// <param name="support">The shuffle mode capabilities.</param>
- /// <exception cref="ArgumentException"><paramref name="support"/> is not vaild.</exception>
+ /// <exception cref="ArgumentException"><paramref name="support"/> is not valid.</exception>
/// <since_tizen> 5 </since_tizen>
public ShuffleModeCapabilityUpdatedEventArgs(MediaControlCapabilitySupport support)
{
/// <summary>
/// Initializes a new instance of the <see cref="ShuffleModeCommandReceivedEventArgs"/> class.
/// </summary>
- /// <param name="command">The playback position command.</param>
+ /// <param name="command">The shuffle mode command.</param>
/// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
/// <since_tizen> 5 </since_tizen>
public ShuffleModeCommandReceivedEventArgs(ShuffleModeCommand command)
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaControlServer.SubtitleModeCommandReceived"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class SubtitleModeCommandReceivedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SubtitleModeCommandReceivedEventArgs"/> class.
+ /// </summary>
+ /// <param name="command">The subtitle command.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="command"/> is null.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ internal SubtitleModeCommandReceivedEventArgs(SubtitleModeCommand command)
+ {
+ Command = command ?? throw new ArgumentNullException(nameof(command));
+ }
+
+ /// <summary>
+ /// Gets the <see cref="SubtitleModeCommand"/>.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public SubtitleModeCommand Command { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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
+{
+ /// <summary>
+ /// Provides data for the <see cref="MediaController.SubtitleModeUpdated"/> event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public class SubtitleModeUpdatedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SubtitleModeUpdatedEventArgs"/> class.
+ /// </summary>
+ /// <param name="isEnabled">A value indicating the updated subtitle mode.</param>
+ /// <since_tizen> 6 </since_tizen>
+ internal SubtitleModeUpdatedEventArgs(bool isEnabled)
+ {
+ IsEnabled = isEnabled;
+ }
+
+ /// <summary>
+ /// Gets the value indicating whether subtitle is enabled or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public bool IsEnabled { get; }
+ }
+}
\ No newline at end of file