public void Stop() { LogerHelper.DefaultInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " Stop"); Stream inputStream = Request.GetBufferedInputStream(); StopRealTime real = RealTimeAnalysis.analysisStop(inputStream); if (RealTimeThread.dic.ContainsKey(real.TerminalId)) { CarInfo info = RealTimeThread.dic[real.TerminalId] as CarInfo; if (info != null) { info.Power = int.Parse(real.Power); info.Voltage = int.Parse(real.Voltage); info.Current = int.Parse(real.Current); info.Temperature = int.Parse(real.Temperature); RealTimeThread.dic[real.TerminalId] = info; } } else { CarInfo c = new CarInfo(); c.Power = int.Parse(real.Power); c.Voltage = int.Parse(real.Voltage); c.Current = int.Parse(real.Current); c.Temperature = int.Parse(real.Temperature); RealTimeThread.dic.Add(real.TerminalId, c); } if (real != null) { orderbll.uploadStopRealTime(real); } }
public override void ExecuteCommand(MySession session, StringRequestInfo requestInfo) { // Console.WriteLine("Run:" + requestInfo.Body.Length); //foreach (var x in requestInfo.Body) //{ // Console.WriteLine((int)Convert.ToChar(x)); //} //session.Send(requestInfo.Body); StopRealTime real = Analysis.analysisStop(requestInfo); // 33字节请求数据 if (RealTimeThread.dic.ContainsKey(real.TerminalId)) { CarInfo info = RealTimeThread.dic[real.TerminalId] as CarInfo; if (info != null) { info.Power = int.Parse(real.Power); info.Voltage = int.Parse(real.Voltage); info.Current = int.Parse(real.Current); info.Temperature = int.Parse(real.Temperature); RealTimeThread.dic[real.TerminalId] = info; } } else { CarInfo c = new CarInfo(); c.Power = int.Parse(real.Power); c.Voltage = int.Parse(real.Voltage); c.Current = int.Parse(real.Current); c.Temperature = int.Parse(real.Temperature); RealTimeThread.dic.Add(real.TerminalId, c); } if (requestInfo != null) { db_realtime.uploadStopRealTime(real); } //服务器响应 // session.Send(requestInfo.Body); }