feat: add BatteryMonitor implementation with discovery, notification, and scheduling services
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NetDaemon.AppModel;
|
||||
using BatteryMonitorManager.Interface;
|
||||
using BatteryMonitorManager.Models;
|
||||
|
||||
namespace BatteryMonitorManager;
|
||||
|
||||
public static class BatteryMonitorServiceRegistration
|
||||
{
|
||||
public static IServiceCollection AddBatteryMonitor(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
var options = configuration
|
||||
.GetSection(BatteryMonitorOptions.SectionName)
|
||||
.Get<BatteryMonitorOptions>() ?? new BatteryMonitorOptions();
|
||||
|
||||
if (!options.Enabled)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
|
||||
services
|
||||
.AddNetDaemonApp<BatteryMonitorInit>()
|
||||
.AddScoped<IBatterySensorDiscoveryService, BatterySensorDiscoveryService>()
|
||||
.AddScoped<IBatteryNotificationService, BatteryNotificationService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user