public SystemController(IThingsResource thingsResource, IScheduleResource scheduleResource, IFeedingManager feedingManager) { _thingsResource = thingsResource; _scheduleResource = scheduleResource; _feedingManager = feedingManager; }
/// <summary> /// Default constructor for <see cref="FeedingSlot"/> /// </summary> /// <param name="slotConfig"></param> /// <param name="dependendSlots"></param> /// <param name="thingsResource"></param> public FeedingSlot(FeedingSlotOptions options, IEnumerable <FeedingSlot> dependendSlots, IThingsResource thingsResource) { _gate = thingsResource.GetDevice <IGateDevice>(options.FlapId); BypassSensor = options.BypassSensor; _sensor = BypassSensor ? null : thingsResource.GetDevice <IDigitalSensor>(options.SensorId); _dependendSlots = dependendSlots == null ? new FeedingSlot[0] : dependendSlots.ToArray(); Name = options.Name; }
/// <summary> /// Constructor for <see cref="FeedingSlot"/> /// </summary> public FeedingSlot(string name, IGateDevice gate, IDigitalSensor sensor, IEnumerable <FeedingSlot> dependendSlots, IThingsResource thingsResource) { _gate = gate; _sensor = sensor; _dependendSlots = dependendSlots.ToArray(); Name = name; }
/// <summary> /// Default constructor for <see cref="FeedingManager"/> /// </summary> /// <param name="schedulingEngine"></param> public DefaultFeedingManager(IOptions <FeedingManagerOptions> options, ILogger <DefaultFeedingManager> logger, ISchedulingEngine schedulingEngine, IThingsResource thingsResource, IScheduleResource scheduleResource) { _schedulingEngine = schedulingEngine; _logger = logger; _scheduleResource = scheduleResource; Slots = new List <FeedingSlot>(); if (options.Value?.FeedingSlots?.Any() == true) { foreach (var slotConfig in options.Value.FeedingSlots) { Slots.Add(new FeedingSlot(slotConfig, Slots, thingsResource)); } } }