jellyfin-server/MediaBrowser.Api/System/SystemInfoWebSocketListener.cs

51 lines
1.5 KiB
C#
Raw Normal View History

2013-03-07 05:34:00 +00:00
using MediaBrowser.Common.Net;
2013-02-22 15:16:48 +00:00
using MediaBrowser.Controller;
2014-12-26 19:34:39 +00:00
using MediaBrowser.Controller.Net;
2013-02-21 20:26:35 +00:00
using MediaBrowser.Model.Logging;
2013-02-22 04:23:06 +00:00
using MediaBrowser.Model.System;
2013-02-21 01:33:05 +00:00
using System.Threading.Tasks;
2014-08-10 22:13:17 +00:00
namespace MediaBrowser.Api.System
2013-02-21 01:33:05 +00:00
{
/// <summary>
/// Class SystemInfoWebSocketListener
/// </summary>
2014-05-10 17:28:03 +00:00
public class SystemInfoWebSocketListener : BasePeriodicWebSocketListener<SystemInfo, WebSocketListenerState>
2013-02-21 01:33:05 +00:00
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
protected override string Name
{
get { return "SystemInfo"; }
}
2013-02-22 15:16:48 +00:00
/// <summary>
/// The _kernel
/// </summary>
2013-03-07 05:34:00 +00:00
private readonly IServerApplicationHost _appHost;
2013-02-22 15:16:48 +00:00
2013-02-21 20:26:35 +00:00
/// <summary>
/// Initializes a new instance of the <see cref="SystemInfoWebSocketListener" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
2013-04-10 15:32:09 +00:00
/// <param name="appHost">The app host.</param>
2013-03-07 05:34:00 +00:00
public SystemInfoWebSocketListener(ILogger logger, IServerApplicationHost appHost)
2013-02-21 20:26:35 +00:00
: base(logger)
{
2013-03-07 05:34:00 +00:00
_appHost = appHost;
2013-02-21 20:26:35 +00:00
}
2013-02-21 01:33:05 +00:00
/// <summary>
/// Gets the data to send.
/// </summary>
/// <param name="state">The state.</param>
/// <returns>Task{SystemInfo}.</returns>
2014-05-10 17:28:03 +00:00
protected override Task<SystemInfo> GetDataToSend(WebSocketListenerState state)
2013-02-21 01:33:05 +00:00
{
2013-03-07 05:34:00 +00:00
return Task.FromResult(_appHost.GetSystemInfo());
2013-02-21 01:33:05 +00:00
}
}
}