jellyfin/MediaBrowser.Api/WebSocket/SystemInfoWebSocketListener.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2013-02-20 18:33:05 -07:00
using MediaBrowser.Common.Kernel;
2013-02-22 08:16:48 -07:00
using MediaBrowser.Controller;
2013-02-21 13:26:35 -07:00
using MediaBrowser.Model.Logging;
2013-02-21 21:23:06 -07:00
using MediaBrowser.Model.System;
2013-02-20 18:33:05 -07:00
using System.Threading.Tasks;
2013-02-21 21:23:06 -07:00
namespace MediaBrowser.Api.WebSocket
2013-02-20 18:33:05 -07:00
{
/// <summary>
/// Class SystemInfoWebSocketListener
/// </summary>
2013-02-22 08:16:48 -07:00
public class SystemInfoWebSocketListener : BasePeriodicWebSocketListener<SystemInfo, object>
2013-02-20 18:33:05 -07:00
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
protected override string Name
{
get { return "SystemInfo"; }
}
2013-02-22 08:16:48 -07:00
/// <summary>
/// The _kernel
/// </summary>
private readonly IKernel _kernel;
2013-02-21 13:26:35 -07:00
/// <summary>
/// Initializes a new instance of the <see cref="SystemInfoWebSocketListener" /> class.
/// </summary>
2013-02-22 08:16:48 -07:00
/// <param name="kernel">The kernel.</param>
2013-02-21 13:26:35 -07:00
/// <param name="logger">The logger.</param>
2013-02-23 00:57:11 -07:00
public SystemInfoWebSocketListener(Kernel kernel, ILogger logger)
2013-02-21 13:26:35 -07:00
: base(logger)
{
2013-02-22 08:16:48 -07:00
_kernel = kernel;
2013-02-21 13:26:35 -07:00
}
2013-02-20 18:33:05 -07:00
/// <summary>
/// Gets the data to send.
/// </summary>
/// <param name="state">The state.</param>
/// <returns>Task{SystemInfo}.</returns>
2013-02-21 21:23:06 -07:00
protected override Task<SystemInfo> GetDataToSend(object state)
2013-02-20 18:33:05 -07:00
{
2013-02-22 08:16:48 -07:00
return Task.FromResult(_kernel.GetSystemInfo());
2013-02-20 18:33:05 -07:00
}
}
}