public override void LoopContent() { _dict.Clear(); _dict.Add(CHART_REMOTE_PORT1, string.Format("{0},{1:f3},{2:f3},{3:f3}", Config.MachineName, Const.GnssInfo.LocalCoor_Tipx, Const.GnssInfo.LocalCoor_Tipy, Const.StrategyDataSource.MaterialHeight)); _dict.Add(CHART_REMOTE_PORT2, string.Format("{0},{1:f3},{2:f3},{3:f3},{4:f3},{5:f3},{6:f3}", Config.MachineName, Const.RadarInfo.DistLeftFront, Const.RadarInfo.DistLeftMiddle, Const.RadarInfo.DistLeftBack, Const.RadarInfo.DistRightFront, Const.RadarInfo.DistRightMiddle, Const.RadarInfo.DistRightBack)); _dict.Add(CHART_REMOTE_PORT3, string.Format("{0},{1:f3},{2:f3},{3:f3},{4:f3},{5:f3},{6:f3}", Config.MachineName, Const.GnssInfo.LocalCoor_Tipx, Const.GnssInfo.LocalCoor_Tipy, Const.GnssInfo.LocalCoor_Tipz, Const.GnssInfo.LocalCoor_Centrex, Const.GnssInfo.LocalCoor_Centrey, Const.GnssInfo.LocalCoor_Centrez)); List <int> ports = _dict.Keys.Cast <int>().ToList(); ports.ForEach(port => { _dict[port] = HexHelper.GetStringSumResult(_dict[port]); try { _udp.SendString(_dict[port], Const.LocalIp, port); } catch (Exception) { } }); }
public override void LoopContent() { string result = string.Format("{0},{1:f3},{2:f3},{3:f3}", Config.MachineName, Const.GnssInfo.LocalCoor_Tipx, Const.GnssInfo.LocalCoor_Tipy, Const.StrategyDataSource.MaterialHeight); result = HexHelper.GetStringSumResult(result); //雷达数据是否合格 bool is_radar_valid = !Const.IsStacker || (Const.RadarInfo.DistWheelLeft != 0 && Const.RadarInfo.DistWheelRight != 0 && Const.RadarInfo.DistWheelAverage != 0 && Const.RadarInfo.DistWheelDiff.Between(0, Config.DistDiffThres[1])); //附加条件 bool additional = Const.StrategyDataSource.MaterialHeight != 0; //所有条件均符合要求后才发送消息,否则发送随机字符 result = is_radar_valid && Const.IsGnssValid && additional && Const.IsCoalValid ? result : "#"; udp.SendString(result, Config.ModelServerIp, Config.UdpModelRemotePort); _taskLogsBuffer = new List <string>() { result }; }