public bool InitKernel(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device, IO_PARA para, SCADA_DEVICE_DRIVER driver) { try { this.ParaString = ""; this.DeviceParaString = ""; this.IOServer = server; this.IOCommunication = communication; this.IODevice = device; this.Driver = driver; if (para != null) { this.ParaString = para.IO_PARASTRING; } if (device != null) { this.DeviceParaString = device.IO_DEVICE_PARASTRING; } return(InitDeviceKernel(server, communication, device, para, driver)); } catch { return(false); } }
protected override bool InitDeviceKernel(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device, IO_PARA para, SCADA_DEVICE_DRIVER driver) { if (IsCreateControl) { if (para != null) { this.ParaCtrl = new IOParaCtrl(); this.ParaCtrl.SetUIParameter(server, device, para); } this.DeviceCtrl = new IODeviceCtrl(); this.DeviceCtrl.SetUIParameter(server, device); } if (para != null) { this.ParaString = para.IO_PARASTRING; } this.DeviceParaString = device.IO_DEVICE_PARASTRING; return(true); }
public override bool InitDrive(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device, IO_PARA para, SCADA_DEVICE_DRIVER driver) { bool res = base.InitDrive(server, communication, device, para, driver); if (res) { if (IsCreateControl) { if (para != null) { this.ParaCtrl = new TCP_IOParaCtrl(); } this.DeviceCtrl = new TCP_IODeviceCtrl(); } } return(res); }
protected virtual bool InitDeviceKernel(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device, IO_PARA para, SCADA_DEVICE_DRIVER driver) { return(true); }
public static void InitBaseModel() { if (ServerID == "") { return; } try { DbHelperSQLite.connectionString = "Data Source=" + Application.StartupPath + "\\IOProject\\Station.station"; IO_SERVER serverBll = new IO_SERVER(); AddLogToMainLog("读取采集站信息......"); IOServer = serverBll.GetModel(mServerID); if (IOServer == null) { return; } mServerID = IOServer.SERVER_ID; IOServer.SERVER_IP = LocalIp.GetLocalIp(); serverBll.Update(IOServer); //加载通道 AddLogToMainLog("读取采集站通道信息......"); IO_COMMUNICATION commBll = new IO_COMMUNICATION(); SCADA_DRIVER DriverBll = new SCADA_DRIVER(); SCADA_DEVICE_DRIVER DeviceDriverBll = new SCADA_DEVICE_DRIVER(); CommDrivers = DriverBll.GetModelList(""); DeviceDrivers = DeviceDriverBll.GetModelList(""); IOCommunications = commBll.GetModelList(" IO_SERVER_ID='" + IOServer.SERVER_ID + "'"); AddLogToMainLog("读取采集站通道下的所有设备信息......"); IO_DEVICE deviceBll = new IO_DEVICE(); IODevices = deviceBll.GetModelList(" IO_SERVER_ID='" + IOServer.SERVER_ID + "'"); AddLogToMainLog("数据处理中....."); for (int i = 0; i < IOCommunications.Count; i++) { IOCommunications[i].DriverInfo = CommDrivers.Find(x => x.Id == IOCommunications[i].IO_COMM_DRIVER_ID); if (IOCommunications[i].DriverInfo != null) { IOCommunications[i].CommunicateDriver = DriverAssembly.CreateCommunicateDriver(IOCommunications[i].DriverInfo); } AddLogToMainLog("处理 " + IOCommunications[i].IO_COMM_NAME + "[" + IOCommunications[i].IO_COMM_LABEL + "]"); IOCommunications[i].Devices = IODevices.FindAll(x => x.IO_COMM_ID == IOCommunications[i].IO_COMM_ID && x.IO_SERVER_ID == IOCommunications[i].IO_SERVER_ID); for (int j = 0; j < IOCommunications[i].Devices.Count; j++) { IOCommunications[i].Devices[j].DriverInfo = DeviceDrivers.Find(x => x.Id == IOCommunications[i].Devices[j].DEVICE_DRIVER_ID); if (IOCommunications[i].Devices[j].DriverInfo != null) { IOCommunications[i].Devices[j].DeviceDrive = DriverAssembly.CreateDeviceDrive(IOCommunications[i].Devices[j].DriverInfo); } } } AddLogToMainLog("正在创建驱动....."); AddLogToMainLog("读取工程完成!"); ProgressMaxNum = IOCommunications.Count + IODevices.Count; } catch (Exception ex) { ThrowExceptionToMain(ex); } }
protected override bool InitDeviceKernel(IO_SERVER server, IO_COMMUNICATION communication, IO_DEVICE device, IO_PARA para, SCADA_DEVICE_DRIVER driver) { if (IsCreateControl) { ParaPack commPack = new ParaPack(communication.IO_COMM_PARASTRING); ParaPack devicePack = new ParaPack(device.IO_DEVICE_PARASTRING); if (para != null) { //数据格式 if (commPack.GetValue("数据格式") == "江苏协昌环保股份有限公司") { this.ParaCtrl = new IOParaCtrl(); this.ParaCtrl.SetUIParameter(server, device, para); } else if (commPack.GetValue("数据格式") == "通用MQTT解析") { this.ParaCtrl = new GasIOParaCtrl(); this.ParaCtrl.SetUIParameter(server, device, para); } } if (commPack.GetValue("数据格式") == "江苏协昌环保股份有限公司") { this.DeviceCtrl = new IODeviceCtrl(); this.DeviceCtrl.SetUIParameter(server, device); } else if (commPack.GetValue("数据格式") == "通用MQTT解析") { this.DeviceCtrl = new GasIODeviceCtrl(); this.DeviceCtrl.SetUIParameter(server, device); } } if (para != null) { this.ParaString = para.IO_PARASTRING; } this.DeviceParaString = device.IO_DEVICE_PARASTRING; return(true); }