jellyfin/MediaBrowser.Common/Api/SystemInfoWebSocketListener.cs
2013-02-21 15:26:55 -05:00

45 lines
1.3 KiB
C#

using MediaBrowser.Common.Kernel;
using MediaBrowser.Model.Logging;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
namespace MediaBrowser.Common.Api
{
/// <summary>
/// Class SystemInfoWebSocketListener
/// </summary>
[Export(typeof(IWebSocketListener))]
public class SystemInfoWebSocketListener : BasePeriodicWebSocketListener<IKernel, Model.System.SystemInfo, object>
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
protected override string Name
{
get { return "SystemInfo"; }
}
/// <summary>
/// Initializes a new instance of the <see cref="SystemInfoWebSocketListener" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
[ImportingConstructor]
public SystemInfoWebSocketListener([Import("logger")] ILogger logger)
: base(logger)
{
}
/// <summary>
/// Gets the data to send.
/// </summary>
/// <param name="state">The state.</param>
/// <returns>Task{SystemInfo}.</returns>
protected override Task<Model.System.SystemInfo> GetDataToSend(object state)
{
return Task.FromResult(Kernel.GetSystemInfo());
}
}
}