2013-05-09 10:38:02 -07:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
2013-09-24 08:42:30 -07:00
|
|
|
|
using MediaBrowser.Model.Session;
|
2013-05-09 10:38:02 -07:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2013-09-24 08:42:30 -07:00
|
|
|
|
using System.Threading;
|
2013-05-09 10:38:02 -07:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Session
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface ISessionManager
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface ISessionManager
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [playback start].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<PlaybackProgressEventArgs> PlaybackStart;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [playback progress].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<PlaybackProgressEventArgs> PlaybackProgress;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [playback stopped].
|
|
|
|
|
/// </summary>
|
2013-12-30 10:18:18 -07:00
|
|
|
|
event EventHandler<PlaybackStopEventArgs> PlaybackStopped;
|
2013-05-09 10:38:02 -07:00
|
|
|
|
|
2014-04-06 10:53:23 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [session started].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<SessionEventArgs> SessionStarted;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [session ended].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<SessionEventArgs> SessionEnded;
|
|
|
|
|
|
2013-05-09 10:38:02 -07:00
|
|
|
|
/// <summary>
|
2013-05-10 05:18:07 -07:00
|
|
|
|
/// Gets the sessions.
|
2013-05-09 10:38:02 -07:00
|
|
|
|
/// </summary>
|
2013-05-10 05:18:07 -07:00
|
|
|
|
/// <value>The sessions.</value>
|
|
|
|
|
IEnumerable<SessionInfo> Sessions { get; }
|
2013-05-09 10:38:02 -07:00
|
|
|
|
|
2013-12-25 07:39:46 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the parts.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionFactories">The session factories.</param>
|
|
|
|
|
void AddParts(IEnumerable<ISessionControllerFactory> sessionFactories);
|
|
|
|
|
|
2013-05-09 10:38:02 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Logs the user activity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="clientType">Type of the client.</param>
|
2013-07-09 09:11:16 -07:00
|
|
|
|
/// <param name="appVersion">The app version.</param>
|
2013-05-09 10:38:02 -07:00
|
|
|
|
/// <param name="deviceId">The device id.</param>
|
|
|
|
|
/// <param name="deviceName">Name of the device.</param>
|
2013-12-25 07:39:46 -07:00
|
|
|
|
/// <param name="remoteEndPoint">The remote end point.</param>
|
2013-05-09 10:38:02 -07:00
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException">user</exception>
|
2013-12-25 07:39:46 -07:00
|
|
|
|
Task<SessionInfo> LogSessionActivity(string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint, User user);
|
2013-05-09 10:38:02 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to report that playback has started for an item
|
|
|
|
|
/// </summary>
|
2013-09-24 08:08:51 -07:00
|
|
|
|
/// <param name="info">The info.</param>
|
2013-07-09 09:11:16 -07:00
|
|
|
|
/// <returns>Task.</returns>
|
2013-09-24 08:08:51 -07:00
|
|
|
|
Task OnPlaybackStart(PlaybackInfo info);
|
2013-05-09 10:38:02 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to report playback progress for an item
|
|
|
|
|
/// </summary>
|
2013-09-30 08:05:07 -07:00
|
|
|
|
/// <param name="info">The info.</param>
|
2013-05-09 10:38:02 -07:00
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException"></exception>
|
2013-09-30 08:05:07 -07:00
|
|
|
|
Task OnPlaybackProgress(PlaybackProgressInfo info);
|
2013-05-09 10:38:02 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to report that playback has ended for an item
|
|
|
|
|
/// </summary>
|
2013-09-30 08:05:07 -07:00
|
|
|
|
/// <param name="info">The info.</param>
|
2013-05-09 10:38:02 -07:00
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException"></exception>
|
2013-09-30 08:05:07 -07:00
|
|
|
|
Task OnPlaybackStopped(PlaybackStopInfo info);
|
2013-09-24 08:42:30 -07:00
|
|
|
|
|
2014-03-09 19:33:19 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reports the session ended.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task ReportSessionEnded(Guid sessionId);
|
|
|
|
|
|
2014-04-06 10:53:23 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the session info dto.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="session">The session.</param>
|
|
|
|
|
/// <returns>SessionInfoDto.</returns>
|
|
|
|
|
SessionInfoDto GetSessionInfoDto(SessionInfo session);
|
|
|
|
|
|
2013-09-24 08:42:30 -07:00
|
|
|
|
/// <summary>
|
2014-03-31 14:04:22 -07:00
|
|
|
|
/// Sends the general command.
|
2013-09-24 08:42:30 -07:00
|
|
|
|
/// </summary>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2014-03-31 14:04:22 -07:00
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
2013-09-24 08:42:30 -07:00
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-03-31 14:04:22 -07:00
|
|
|
|
Task SendGeneralCommand(Guid controllingSessionId, Guid sessionId, GeneralCommand command, CancellationToken cancellationToken);
|
|
|
|
|
|
2013-09-24 12:54:42 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the message command.
|
|
|
|
|
/// </summary>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2013-09-24 12:54:42 -07:00
|
|
|
|
/// <param name="sessionId">The session id.</param>
|
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
Task SendMessageCommand(Guid controllingSessionId, Guid sessionId, MessageCommand command, CancellationToken cancellationToken);
|
2013-09-24 12:54:42 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the play command.
|
|
|
|
|
/// </summary>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2013-09-24 12:54:42 -07:00
|
|
|
|
/// <param name="sessionId">The session id.</param>
|
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
Task SendPlayCommand(Guid controllingSessionId, Guid sessionId, PlayRequest command, CancellationToken cancellationToken);
|
2013-09-24 12:54:42 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the browse command.
|
|
|
|
|
/// </summary>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2013-09-24 12:54:42 -07:00
|
|
|
|
/// <param name="sessionId">The session id.</param>
|
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
Task SendBrowseCommand(Guid controllingSessionId, Guid sessionId, BrowseRequest command, CancellationToken cancellationToken);
|
2013-09-24 12:54:42 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the playstate command.
|
|
|
|
|
/// </summary>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
/// <param name="controllingSessionId">The controlling session identifier.</param>
|
2013-09-24 12:54:42 -07:00
|
|
|
|
/// <param name="sessionId">The session id.</param>
|
|
|
|
|
/// <param name="command">The command.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-03-16 09:15:10 -07:00
|
|
|
|
Task SendPlaystateCommand(Guid controllingSessionId, Guid sessionId, PlaystateRequest command, CancellationToken cancellationToken);
|
2013-10-02 18:22:50 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the restart required message.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2013-10-03 11:02:23 -07:00
|
|
|
|
Task SendRestartRequiredNotification(CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the server shutdown notification.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task SendServerShutdownNotification(CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sends the server restart notification.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task SendServerRestartNotification(CancellationToken cancellationToken);
|
2014-01-03 19:35:41 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the additional user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <param name="userId">The user identifier.</param>
|
|
|
|
|
void AddAdditionalUser(Guid sessionId, Guid userId);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes the additional user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <param name="userId">The user identifier.</param>
|
|
|
|
|
void RemoveAdditionalUser(Guid sessionId, Guid userId);
|
2014-01-11 16:07:56 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Authenticates the new session.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <param name="password">The password.</param>
|
|
|
|
|
/// <param name="clientType">Type of the client.</param>
|
|
|
|
|
/// <param name="appVersion">The application version.</param>
|
|
|
|
|
/// <param name="deviceId">The device identifier.</param>
|
|
|
|
|
/// <param name="deviceName">Name of the device.</param>
|
|
|
|
|
/// <param name="remoteEndPoint">The remote end point.</param>
|
|
|
|
|
/// <returns>Task{SessionInfo}.</returns>
|
|
|
|
|
Task<SessionInfo> AuthenticateNewSession(User user, string password, string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint);
|
2014-03-20 20:31:40 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reports the capabilities.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sessionId">The session identifier.</param>
|
|
|
|
|
/// <param name="capabilities">The capabilities.</param>
|
|
|
|
|
void ReportCapabilities(Guid sessionId, SessionCapabilities capabilities);
|
2013-05-09 10:38:02 -07:00
|
|
|
|
}
|
|
|
|
|
}
|