/// <summary> /// 从采集站端上传报警值 /// </summary> /// <param name="server"></param> /// <param name="comm"></param> /// <param name="device"></param> /// <returns></returns> public static bool UploadAlarm(List <AlarmCacheObject> receiveCaches) { bool result = false; string sendString = ""; receiveCaches.ForEach(delegate(AlarmCacheObject p) { sendString += p.DataString + "^"; }); try { Scada.AsyncNetTcp.TcpData tcpData = new Scada.AsyncNetTcp.TcpData(); byte[] simuBytes = tcpData.StringToTcpByte(sendString, Scada.AsyncNetTcp.ScadaTcpOperator.报警值); if (IOMonitorManager.TcpClient != null && IOMonitorManager.TcpClient.IsClientConnected) { IOMonitorManager.TcpClient.Send(new ArraySegment <byte>(simuBytes)); result = true; } } catch (Exception ex) { result = false; //写入错误日志,并将错误日志返回的日志窗体 MonitorFormManager.DisplyException(ex); } receiveCaches.Clear(); receiveCaches = null; sendString = ""; return(result); }
public static void UserLogin(string user, string password) { STATION_TCP_INFO loginInfo = new STATION_TCP_INFO(); loginInfo.USER = user; loginInfo.PASSWROD = password; loginInfo.IO_SERVER_ID = MonitorDataBaseModel.ServerID; loginInfo.IO_SERVER_IP = ""; loginInfo.RESULT = "false"; loginInfo.FUNCTION = "IOMonitor"; Scada.AsyncNetTcp.TcpData tcpData = new Scada.AsyncNetTcp.TcpData(); byte[] loginbytes = tcpData.StringToTcpByte(loginInfo.GetCommandString(), Scada.AsyncNetTcp.ScadaTcpOperator.登录); //发送登录命令 TcpClient.Send(new ArraySegment <byte>(loginbytes)); }
public static bool LoginManager(string user, string password) { STATION_TCP_INFO loginInfo = new STATION_TCP_INFO(); loginInfo.USER = user; loginInfo.PASSWROD = password; loginInfo.IO_SERVER_ID = ""; loginInfo.IO_SERVER_IP = ""; loginInfo.RESULT = "false"; loginInfo.FUNCTION = "IOFlow"; Scada.AsyncNetTcp.TcpData tcpData = new Scada.AsyncNetTcp.TcpData(); byte[] loginbytes = tcpData.StringToTcpByte(loginInfo.GetCommandString(), Scada.AsyncNetTcp.ScadaTcpOperator.流程设计器登录); //发送登录命令 TcpClient.Send(new ArraySegment <byte>(loginbytes)); return(false); }