public override bool Init(LightCfg cfg, ICommunicationPortCfg communicationPort) { try { this.lightCfg = cfg; MAXCH = this.lightCfg.MaxChannelNo; MINCH = this.lightCfg.MinChannelNo; if (lightCfg.NeedInit) { ComportCfg portCfg = communicationPort as ComportCfg; LightController = new JKLightSource(int.Parse(portCfg.Port.ToUpper().Replace("COM", "")), 9600); LightController.Open(); return(true); } else { return(true); } } catch (Exception ex) { return(false); } }