|
|
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using TeamAAS_VP.Models.Lights;
|
|
|
|
|
|
namespace TeamAAS_VP.Core.Lights
|
|
|
{
|
|
|
@@ -17,6 +18,8 @@ namespace TeamAAS_VP.Core.Lights
|
|
|
private readonly ICommunicationProtocol _protocol;
|
|
|
// 使用 ASCII 编码将字符串转换为字节流
|
|
|
private readonly Encoding _encoding;
|
|
|
+ //光源配置
|
|
|
+ private readonly LightControllerConfig _config;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 创建一个新的 <see cref="KCSLightController"/> 实例。
|
|
|
@@ -24,21 +27,24 @@ namespace TeamAAS_VP.Core.Lights
|
|
|
/// <param name="id">控制器的唯一标识符。</param>
|
|
|
/// <param name="protocol">用于与设备通信的协议实现(必须已实现连接/发送/接收等)。</param>
|
|
|
/// <param name="channelCount">该控制器管理的通道数量。</param>
|
|
|
- public KCSLightController(int id, ICommunicationProtocol protocol,int channelCount)
|
|
|
- : base(id, channelCount)
|
|
|
+ /// <param name="config">控制器的配置对象。</param>
|
|
|
+ public KCSLightController(int id, ICommunicationProtocol protocol,int channelCount, LightControllerConfig config)
|
|
|
+ : base(id, channelCount,config)
|
|
|
{
|
|
|
_protocol = protocol;
|
|
|
_encoding = Encoding.ASCII;
|
|
|
+ _config = config;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 为指定索引创建通道实例。
|
|
|
/// </summary>
|
|
|
/// <param name="index">通道索引(从 0 开始)。</param>
|
|
|
+ /// <param name="channelName">通道名称。</param>
|
|
|
/// <returns>返回对应的 <see cref="KCSLightChannel"/> 实例。</returns>
|
|
|
- protected override ILightChannel CreateChannel(int index)
|
|
|
+ protected override ILightChannel CreateChannel(int index,string channelName)
|
|
|
{
|
|
|
- return new KCSLightChannel(index, this);
|
|
|
+ return new KCSLightChannel(index, this, channelName);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|