Files
Essentials/src/PepperDash.Essentials.Core/Factory/DeviceFactoryWrapper.cs
Andrew Welker 8db559f197 feat: factory updates & refactoring
This commit introduces significant updates to the device factory system, enhancing the way devices are created and managed within the PepperDash Essentials framework.
The changes include:
- New attributes for device configuration and description.
- Refactoring of the device manager and essentials device classes to support new factory methods.
- modified factory classes for essentials devices, plugin development devices, and processor extension devices.
- The device factory interface has been updated to include a factory method for creating devices.
- Added a wrapper for the device factory to streamline device creation.
- Updated plugin loader to accommodate the new device factory structure.

Fixes #1065
Fixed #1277
2025-07-25 09:05:40 -05:00

44 lines
1.4 KiB
C#

using System;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Wraps a device factory, providing metadata and a factory method for creating devices.
/// </summary>
public class DeviceFactoryWrapper
{
/// <summary>
/// Gets or sets the type associated with the current instance.
/// </summary>
public Type Type { get; set; }
/// <summary>
/// Gets or sets the description associated with the object.
/// </summary>
public string Description { get; set; }
/// <summary>
/// Gets or sets the factory method used to create an <see cref="IKeyed"/> instance based on the provided <see
/// cref="DeviceConfig"/>.
/// </summary>
/// <remarks>The factory method allows customization of how <see cref="IKeyed"/> instances are created for
/// specific <see cref="DeviceConfig"/> inputs. Ensure the delegate is not null before invoking it.</remarks>
public Func<DeviceConfig, IKeyed> FactoryMethod { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="DeviceFactoryWrapper"/> class with default values.
/// </summary>
/// <remarks>The <see cref="Type"/> property is initialized to <see langword="null"/>, and the <see
/// cref="Description"/> property is set to "Not Available".</remarks>
public DeviceFactoryWrapper()
{
Type = null;
Description = "Not Available";
}
}
}