mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-31 05:14:51 +00:00
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
27 lines
859 B
C#
27 lines
859 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using PepperDash.Essentials.Core.Config;
|
|
|
|
namespace PepperDash.Essentials.Core
|
|
{
|
|
/// <summary>
|
|
/// Provides the basic needs for a Device Factory
|
|
/// </summary>
|
|
public abstract class EssentialsDeviceFactory<T> : IDeviceFactory where T : EssentialsDevice
|
|
{
|
|
/// <inheritdoc />
|
|
public Type FactoryType => typeof(T);
|
|
|
|
/// <summary>
|
|
/// A list of strings that can be used in the type property of a DeviceConfig object to build an instance of this device
|
|
/// </summary>
|
|
public List<string> TypeNames { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The method that will build the device
|
|
/// </summary>
|
|
/// <param name="dc">The device config</param>
|
|
/// <returns>An instance of the device</returns>
|
|
public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
|
|
}
|
|
} |