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