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