/// <param name="receiverId">The receiver Id that receives command.</param>
internal void SetRequestInformation(string receiverId)
{
- ReceiverId = receiverId;
+ ReceiverId = receiverId ?? throw new ArgumentNullException(nameof(receiverId));
}
/// <summary>
/// <param name="requestId">The request Id for each command.</param>
internal void SetResponseInformation(string receiverId, string requestId)
{
- ReceiverId = receiverId;
- _requestId = requestId;
+ ReceiverId = receiverId ?? throw new ArgumentNullException(nameof(receiverId)); ;
+ _requestId = requestId ?? throw new ArgumentNullException(nameof(requestId)); ;
}
/// <summary>
/// Delete playlist.
/// </summary>
/// <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/>
/// <since_tizen> 5 </since_tizen>
public static void RemovePlaylist(MediaControlPlaylist playlist)
{
+ if (playlist == null)
+ {
+ throw new ArgumentNullException(nameof(playlist));
+ }
+
Native.DeletePlaylist(Handle, playlist.Handle);
playlist.Dispose();
}
/// <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/>
/// <since_tizen> 5 </since_tizen>
public static async Task<Bundle> RequestAsync(Command command, string clientId)
{
+ if (command == null)
+ {
+ throw new ArgumentNullException(nameof(command));
+ }
+ if (clientId == null)
+ {
+ throw new ArgumentNullException(nameof(clientId));
+ }
+
command.SetRequestInformation(clientId);
var tcs = new TaskCompletionSource<MediaControllerError>();
/// <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/>
/// <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>
/// <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/>
/// <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);
}
/// </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/>
/// <since_tizen> 5 </since_tizen>
public async Task<Bundle> RequestAsync(Command command)
{
+ if (command == null)
+ {
+ throw new ArgumentNullException(nameof(command));
+ }
+
ThrowIfStopped();
command.SetRequestInformation(ServerAppId);
/// <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/>
/// <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>
/// <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/>
/// <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>
/// <param name="action">A playback command.</param>
/// <returns>A <see cref="MediaControlCapabilitySupport"/>.</returns>
+ /// <exception cref="ArgumentException"><paramref name="action"/> is not valid.</exception>
/// <exception cref="InvalidOperationException">
/// The server has already been stopped.<br/>
/// -or-<br/>
{
ThrowIfStopped();
+ ValidationUtil.ValidateEnum(typeof(MediaControlPlaybackCommand), action, nameof(action));
+
IntPtr playbackCapaHandle = IntPtr.Zero;
try