void WriteSampleData(ref StringBuilder sb, Sample s) { if (!s.gps.HasValue) { sb.Append("No GPS data"); return; } else { PmwGpsService.LatestGpsData gps = s.gps.Value; sb.Append(gps.time.ToString("s") + ","); sb.Append(gps.satellites + ","); sb.Append(gps.position.Latitude.DecimalDegrees.ToString("F8") + ","); sb.Append(gps.position.Longitude.DecimalDegrees.ToString("F8") + ","); sb.Append(gps.position.Altitude.ToMeters().Value.ToString("F1") + ","); } if (s.sss.HasValue) { VerizonAppGateway.Screenshot.SignalStrengthSample sss = s.sss.Value; sb.Append(sss.sumHash + ","); sb.Append(sss.detailHash + ","); if (sss.netChoice.HasValue) { sb.Append(sss.netChoice.Value.ToString("g") + ","); } else { sb.Append("NET-UNK,"); } if (sss.detail.HasValue) { VerizonAppGateway.Screenshot.SignalDetail sd = sss.detail.Value; sb.Append(sd.bars4g + ","); sb.Append(sd.bars3g + ","); sb.Append(sd.bars2g + ","); sb.Append(sd.onWWAN + ","); } else { sb.Append("4G-UNK,3G-UNK,2G-UNK,WWAN-UNK,"); } } else { sb.Append("NO-HASH,NO-HASH,NET-UNK,4G-UNK,3G-UNK,2G-UNK,WWAN-UNK,"); } if (s.latency.HasValue) { PmwLatencyService.LatestData lat = s.latency.Value; sb.Append(LatencySampleToCSV(lat.latest) + ","); sb.Append(LatencySampleToCSV(lat.ema) + ","); } else { sb.Append("NO-PING,NO-EMA,"); } }
void UpdateLatencyElements(PmwLatencyService.LatestData?dataOrNull) { if (dataOrNull.HasValue) { PmwLatencyService.LatestData ld = dataOrNull.Value; PingEma = ld.ema; PingLatest = ld.latest; } else { PingEma = new PmwLatencyService.LatencySample { status = PmwLatencyService.SampleStatus.Nonexistent }; PingLatest = new PmwLatencyService.LatencySample { status = PmwLatencyService.SampleStatus.Nonexistent }; } }