static void aclwcar_Server_SessionClosed(ACLWCARProtocolSession session, CloseReason value) { //识别码_IP生成KEY用于保存session string key = session.SessionID; ThJob.removeLw(key); //连接关闭 printColsed(session.SessionID); }
static void louverlightSensor_Server_SessionClosed(LouverlightSensorProtocolSession session, CloseReason value) { //识别码_IP生成KEY用于保存session string key = session.SessionID; ThJob.removeLouverlightSensor(key); //连接关闭 printColsed(session.SessionID); }
static void anemoclinograp_Server_SessionClosed(ANEMOCLINOGRAPProtocolSession session, CloseReason value) { //识别码_IP生成KEY用于保存session string key = session.SessionID; ThJob.removeAnemoclinoGrap(key); //连接关闭 printColsed(session.SessionID); }
static void th11s_Server_SessionClosed(TH11SProtocolSession session, CloseReason value) { //识别码_IP生成KEY用于保存session string key = session.SessionID; ThJob.removeTh11s(key); //连接关闭 printColsed(session.SessionID); }
static void louverlightSensor_Server_NewSessionConnected(LouverlightSensorProtocolSession session) { //识别码_IP生成KEY用于保存session string key = session.SessionID; CommonSession cs = new CommonSession(); cs.session = session; ThJob.addLouverlightSensor(key, cs); ///连接打开 printConnectioned(session.SessionID, session.RemoteEndPoint.Address.ToString(), session.RemoteEndPoint.Port.ToString()); }
static void actwcar_Server_NewSessionConnected(ACTWCARProtocolSession session) { //识别码_IP生成KEY用于保存session string key = session.SessionID; CommonSession cs = new CommonSession(); cs.session = session; ThJob.addTw(key, cs); ///连接打开 printConnectioned(session.SessionID, session.RemoteEndPoint.Address.ToString(), session.RemoteEndPoint.Port.ToString()); }
static void anemoclinograp_Server_NewSessionConnected(ANEMOCLINOGRAPProtocolSession session) { //识别码_IP生成KEY用于保存session string key = session.SessionID; CommonSession cs = new CommonSession(); cs.session = session; ThJob.addAnemoclinoGrap(key, cs); ///连接打开 printConnectioned(session.SessionID, session.RemoteEndPoint.Address.ToString(), session.RemoteEndPoint.Port.ToString()); }
static void aclwcar_Server_NewRequestReceived(ACLWCARProtocolSession session, SuperSocket.SocketBase.Protocol.BinaryRequestInfo requestInfo) { //string remoteEndPoint = session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port.ToString(); string terminalType = DeviceCode.LW; string DeviceSN = ""; //处理设备的登陆信息 handleDeviceInfo(terminalType, requestInfo.Key.Substring(0, 2), session.RemoteEndPoint.Address.ToString(), session.RemoteEndPoint.Port.ToString(), out DeviceSN); //获取原始监控数据 InspectOriginalData oData = new ACLWCARDataResolver().CreateOriginalData(DeviceSN, requestInfo); if ("wipe,0,".Equals(Tools.HexStringToString(oData.InspectData.Substring(2), Encoding.UTF8))) { string sr = "11117076616C2C0D"; session.Send(sr); ///打印采集信息 printData(session.SessionID, session.RemoteEndPoint.Address.ToString(), session.RemoteEndPoint.Port.ToString(), oData, null); Console.WriteLine("SendResponse:" + sr); return; } else { //解析监控数据 List <InspectItemData> itemDatas = new ACLWCARDataResolver().ResolveItemData(oData); ///保存监测数据 saveData(oData, itemDatas); //返回状态为0时修改集合中的状态,设置设备状态为复位 if ("0".Equals(itemDatas[itemDatas.Count() - 1].InspectData)) { ThJob.setLwIsWorking(session.SessionID, false); } ///打印采集信息 printData(session.SessionID, session.RemoteEndPoint.Address.ToString(), session.RemoteEndPoint.Port.ToString(), oData, itemDatas); } ////更新当前连接信息到静态变量中,用于定时清理垃圾session //CommonSession cs = ThJob.getLw(session.SessionID); //if (cs != null) //{ // cs.session = session; // ThJob.updateLw(session.SessionID, cs); //} }