public void UploadTempAndVol(tTmpVoltageParam _WSTemperature) { string cacheData = string.Empty; System.Threading.Tasks.Task.Run(() => { try { if (iCMS.WG.Agent.ComFunction.IsExisted(iCMS.WG.Agent.ComFunction.CreateCacheData(_WSTemperature, EnumCacheType.TmpVoltage))) { iCMS.WG.Agent.Common.LogHelper.WriteLog(iCMS.WG.Agent.Common.Enum.EnumLogType.InvalidData.ToString(), "重复温度电压,MAC: " + _WSTemperature.mac.ToHexString() + "采集时间:" + iCMS.WG.Agent.ComFunction.GetSamplingTime(_WSTemperature.SampleTime)); return; } VolAndTempParameter volAndTemp = new VolAndTempParameter() { SamplingTime = iCMS.WG.Agent.ComFunction.GetSamplingTime(_WSTemperature.SampleTime), Temperature = _WSTemperature.f32Temperature, Volatage = _WSTemperature.f32Voltage, WSMAC = _WSTemperature.mac.ToHexString().ToUpper() }; cacheData = volAndTemp.ToClientString(); ComFunction.CreateRequest(EnumRequestType.UpLoadData, "UploadVolAndTemp", cacheData); } catch (Exception ex) { iCMS.WG.Agent.Common.LogHelper.WriteLog(iCMS.WG.Agent.Common.Enum.EnumLogType.Error.ToString(), "iCMS.WG.Agent.CommunicationWithServer.UploadTempAndVol执行失败,异常:" + ex.Message + "\r\n详细:" + ex.StackTrace.ToString()); if (iCMS.WG.Agent.ComFunction.GetAppConfig("isCache").Trim() == "1") { iCMS.WG.Agent.Common.LogHelper.WriteLog(iCMS.WG.Agent.Common.Enum.EnumLogType.Cache.ToString(), "UploadTempAndVol # \r\n" + cacheData); } } }); }
/// <summary> /// 通信层的健康报告再处理 /// </summary> private void HealthReportAnalysis(tHealthReportParam param) { //拆分出温度电压的报告 tTmpVoltageParam AppTV = new tTmpVoltageParam(); AppTV.mac.Assign(param.mac); AppTV.f32Temperature = param.u32FacilityTmp; AppTV.f32Voltage = param.u32BatState; AppTV.SampleTime.u8Year = param.TmpTime.u8Year; AppTV.SampleTime.u8Month = param.TmpTime.u8Month; AppTV.SampleTime.u8Day = param.TmpTime.u8Day; AppTV.SampleTime.u8Hour = param.TmpTime.u8Hour; AppTV.SampleTime.u8Min = param.TmpTime.u8Min; AppTV.SampleTime.u8Sec = param.TmpTime.u8Sec; if (WsTmpVoltageDataNotify != null) { WsTmpVoltageDataNotify(AppTV); } //拆分出自报告 tSelfReportParam AppSR = new tSelfReportParam(); AppSR.State = (enWsRunState)param.u8State; AppSR.mac.Assign(param.mac); if (NetworkWSInfo.ContainsKey(param.mac.ToHexString())) { AppSR.Version.u8Main = NetworkWSInfo[param.mac.ToHexString()].u8Main; AppSR.Version.u8Sub = NetworkWSInfo[param.mac.ToHexString()].u8Sub; AppSR.Version.u8Rev = NetworkWSInfo[param.mac.ToHexString()].u8Rev; AppSR.Version.u8Build = NetworkWSInfo[param.mac.ToHexString()].u8Build; } else { //没有版本号时,需要自己获取 tGetSelfReportParam getSelf = new tGetSelfReportParam(); getSelf.mac.Assign(param.mac); GetSelfReport(getSelf); } AppSR.u16ErrCode = param.u16ErrorCode; AppSR.f32Temperature = param.u32DeviceTmp; AppSR.f32Voltage = param.u32BatState; AppSR.WakeupMode = (enWsWkupMode)param.u8WakeupMode; AppSR.MoteBoot = (enMoteBoot)param.u8MoteBoot; if (!NetworkWSDaqSlot.ContainsKey(param.mac.ToHexString())) { tGetMeasDefParam getDef = new tGetMeasDefParam(); getDef.mac.Assign(param.mac); GetMeasDef(getDef); } else { AppSR.u8TempDaqPeriod = (byte)(NetworkWSDaqSlot[param.mac.ToHexString()].TmpDaqPeriod.u8Hour * 60 + NetworkWSDaqSlot[param.mac.ToHexString()].TmpDaqPeriod.u8Min); AppSR.u16CharCnt = NetworkWSDaqSlot[param.mac.ToHexString()].u16EigenDaqMult; AppSR.u16WaveCnt = NetworkWSDaqSlot[param.mac.ToHexString()].u16WaveDaqMult; } if (NetworkWSInfo.ContainsKey(param.mac.ToHexString())) { if (WsSelfReportNotify != null) { WsSelfReportNotify(AppSR); } } }