/// <summary> /// Lytter 1000 gange i sekundet om der kommer data ind. Kommer der data ind, returneres en liste til præstationslaget. Her modtages i bytes, det bliver decoded med ASCII og herefter deserialiseret. /// </summary> /// <returns> /// Liste bliver retuneret. /// </returns> public List <DTO_Measurement> RecieveDataPoints() { string data; byte[] bytes; measurements = new List <DTO_Measurement>(); while (true) { try { bytes = listener.Receive(ref groupEP); data = Encoding.ASCII.GetString(bytes, 0, bytes.Length); var measurementdata = JsonConvert.DeserializeObject <List <DTO_Measurement> >(data); local.SaveMeasurement(measurementdata[0].SocSecNB, measurementdata[0].mmHg, measurementdata[0].Tid, measurementdata[0].HighSys, measurementdata[0].LowSys, measurementdata[0].HighDia, measurementdata[0].LowDia, measurementdata[0].HighMean, measurementdata[0].LowMean, measurementdata[0].CalculatedSys, measurementdata[0].CalculatedDia, measurementdata[0].CalculatedMean, measurementdata[0].CalculatedPulse, measurementdata[0].Batterystatus); return(measurementdata); } catch (InvalidOperationException) { return(null); } } }