/// <summary> /// Creates the connection and ready for receiving data from a mirroring source. /// </summary> /// <param name="sourceIp">The source ip address to connect.</param> /// <remarks> /// The state must be <see cref="ScreenMirroringState.Prepared"/> state by /// <see cref="Prepare(Display, ScreenMirroringResolutions)"/>. /// </remarks> /// <returns>A task that represents the asynchronous operation.</returns> /// <privilege>http://tizen.org/privilege/internet</privilege> /// <exception cref="ArgumentNullException"><paramref name="sourceIp"/> is null.</exception> /// <exception cref="InvalidOperationException"> /// The current state is not in the valid.<br/> /// -or-<br/> /// An internal error occurs. /// </exception> /// <exception cref="ArgumentException"><paramref name="sourceIp"/> is a zero-length string, contains only white space.</exception> /// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception> /// <exception cref="UnauthorizedAccessException">Caller does not have required permission.</exception> /// <since_tizen> 4 </since_tizen> public Task ConnectAsync(string sourceIp) { if (sourceIp == null) { throw new ArgumentNullException(nameof(sourceIp)); } if (string.IsNullOrWhiteSpace(sourceIp)) { throw new ArgumentException($"{nameof(sourceIp)} is a zero-length string.", nameof(sourceIp)); } ValidateState(ScreenMirroringState.Prepared); Native.SetIpAndPort(Handle, sourceIp, Port.ToString()).ThrowIfError("Failed to set ip."); return(RunAsync(Native.Connect, "Failed to connect.")); }
/// <summary> /// Creates the connection and ready for receiving data from a mirroring source with the given <paramref name="port"/>. /// </summary> /// <param name="sourceIp">The source ip address to connect.</param> /// <param name="port">The port number to connect. The max value is 65535.</param> /// <remarks> /// The state must be <see cref="ScreenMirroringState.Prepared"/> state by /// <see cref="Prepare(Display, ScreenMirroringResolutions)"/>. /// </remarks> /// <returns>A task that represents the asynchronous operation.</returns> /// <privilege>http://tizen.org/privilege/internet</privilege> /// <exception cref="ArgumentException"><paramref name="sourceIp"/> is a zero-length string, contains only white space.</exception> /// <exception cref="ArgumentNullException"><paramref name="sourceIp"/> is null.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is greater than port max value(65535).</exception> /// <exception cref="InvalidOperationException"> /// The current state is not in the valid.<br/> /// -or-<br/> /// An internal error occurs. /// </exception> /// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception> /// <exception cref="UnauthorizedAccessException">Caller does not have required permission.</exception> /// <since_tizen> 9 </since_tizen> public Task ConnectAsync(string sourceIp, uint port) { if (sourceIp == null) { throw new ArgumentNullException(nameof(sourceIp)); } if (string.IsNullOrWhiteSpace(sourceIp)) { throw new ArgumentException($"{nameof(sourceIp)} is a zero-length string.", nameof(sourceIp)); } if (port > _portMax) { throw new ArgumentOutOfRangeException(nameof(port), $"{nameof(port)} is greater than max port value(65535)."); } ValidateState(ScreenMirroringState.Prepared); Native.SetIpAndPort(Handle, sourceIp, port.ToString()).ThrowIfError("Failed to set ip."); return(RunAsync(Native.Connect, "Failed to connect.")); }