Explorar o código

支持KCS_KDC3_24V300W_8T灯控器型号注册

在LightManagerService中新增对KCS_KDC3_24V300W_8T型号的控制器工厂注册逻辑,通过串口协议实例化对应控制器,提升了系统对新型号灯光控制器的扩展能力。
孝锋 徐 hai 7 meses
pai
achega
ca06aff11f
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      TeamAAS-VM/Services/LightManagerService.cs

+ 8 - 0
TeamAAS-VM/Services/LightManagerService.cs

@@ -88,6 +88,14 @@ namespace TeamAAS_VP.Services
                 var protocol = new SerialPortProtocol(config.SerialPortConfig);
                 return new KCSLightController(id, protocol, config.ChannelCount,config);
             });
+            // 注册KCS控制器工厂
+            RegisterControllerFactory(LightModel.KCS_KDC3_24V300W_8T, (id, config) =>
+            {
+                if (config == null) throw new ArgumentNullException(nameof(config));
+                // 使用配置里的串口配置创建协议实现,再创建控制器实例
+                var protocol = new SerialPortProtocol(config.SerialPortConfig);
+                return new KCSLightController(id, protocol, config.ChannelCount, config);
+            });
         }
 
         /// <summary>