コード例 #1
0
        /// <summary>
        /// Denne metode bruges til at modtage data fra operatørsystemet
        /// </summary>
        public void RecieveData()
        {
            broadCastIP = IPAddress.Parse("127.0.0.1");
            UdpClient udpClient = new UdpClient(port0);
            var       remoteIP  = new IPEndPoint(broadCastIP, port0);

            byte[] bytes;
            string jason;

            try
            {
                while (true)
                {
                    bytes       = udpClient.Receive(ref remoteIP);
                    jason       = Encoding.ASCII.GetString(bytes, 0, bytes.Length);
                    measurement = JsonSerializer.Deserialize <DTO_Measurement>(jason);
                    measurementQueue.Add(measurement);
                }
            }
            catch (SocketException e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                udpClient.Close();
            }
        }
コード例 #2
0
        public int convertToBlobAndUpload(DTO_Measurement nyMaaling)
        {
            //Konvertering sker direkte i datalag

            maalingID = ecgData.uploadECG(nyMaaling);
            return(maalingID);
        }
コード例 #3
0
        public void Update(object obj)
        {
            int             lowerGatingValue1 = 0;
            DTO_Measurement _data             = obj as DTO_Measurement;

            UpperGatingValue = _data.GatingUpperValue;
            LowerGatingValue = _data.GatingLowerValue;
            Height           = Convert.ToInt32((UpperGatingValue * 450) - (LowerGatingValue * 450));

            lowerGatingValue1 = Convert.ToInt32(LowerGatingValue * 450);

            Standard.Dispatcher.Invoke(DispatcherPriority.Normal,
                                       new Action(() =>
            {
                Canvas.SetBottom(GatingArea, (lowerGatingValue1));
                GatingArea.Height = Height;


                move = Math.Round(_data.MeasurementData * 450, 1);
                Canvas.SetBottom(BlockPosition, move);

                if (_data.GatingState)
                {
                    Alarm.Visibility = Visibility.Visible;
                    SystemSounds.Beep.Play();
                }
                else
                {
                    Alarm.Visibility = Visibility.Hidden;
                }
            }));
        }
コード例 #4
0
        /// <summary>
        /// Gemmer målingen undervejs. Her gemmer den for hvert nye målepunkt.
        /// </summary>
        /// <param name="socSecNb"></param>
        /// <param name="mmhg"></param>
        /// <param name="tid"></param>
        /// <param name="highSys"></param>
        /// <param name="lowSys"></param>
        /// <param name="highDia"></param>
        /// <param name="lowDia"></param>
        /// <param name="highMean"></param>
        /// <param name="lowMean"></param>
        /// <param name="sys"></param>
        /// <param name="dia"></param>
        /// <param name="mean"></param>
        /// <param name="pulse"></param>
        /// <param name="batterystatus"></param>
        /// <returns></returns>
        public object SaveMeasurement(string socSecNb, double mmhg, DateTime tid, bool highSys, bool lowSys, bool highDia, bool lowDia, bool highMean, bool lowMean, int sys, int dia, int mean, int pulse, int batterystatus)
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();

            socSecNb = "";
            mmhg     = 0;

            var    filename = latestfile("");
            string path     = @"C:\ST3PRJ3FIL\" + filename;


            //string path = @"C:\ST3PRJ3FIL\ " + soc.ToString() + DateTime.Now.ToString("dd-MM-yyyy");
            DTO_Measurement measurement = new DTO_Measurement(socSecNb, mmhg, tid, highSys, lowSys, highDia, lowDia, highMean, lowMean, sys, dia, mean, pulse, batterystatus);


            using (StreamWriter file = File.AppendText(path))
            {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Formatting = Formatting.Indented;
                serializer.Serialize(file, measurement);
                file.Close();
            }

            return(null);
        }
コード例 #5
0
        public void DataCollector()
        {
            while (true)
            {
                DTO_Measurement _data = _measurementQueue.Take();

                _gateControl.CheckGating(_data);

                NotifyGui(_data);
            }
        }
コード例 #6
0
        public int uploadECG(DTO_Measurement nyMaaling)
        {
            double[] tal;
            double[] ecgVoltage            = new double[500];
            string   insertStringDLEDBData = "INSERT INTO db_owner.EKGDATA (raa_data,samplerate_hz,interval_sec,interval_min,data_format," +
                                             "bin_eller_tekst,maaleformat_type,start_tid,kommentar,ekgmaaleid,maalenehed_identifikation) " +
                                             "VALUES (@raa_data, @samplerate_hz, @interval_sec, @interval_min, @data_format, @bin_eller_tekst, " +
                                             "@maaleformat_type,@start_tid,@kommentar,@ekgmaaleid,@maalenehed_identifikation)";
            string insertStringDLEDBMaeling = "INSERT INTO db_owner.EKGMAELING (dato,antalmaalinger,sfp_maaltagerfornavn,sfp_maltagerefternavn," +
                                              "sfp_maaltagermedarbjnr,sfp_mt_org,sfp_mt_kommentar,borger_fornavn,borger_efternavn,borger_cprnr,stemi_mistaenkt) " + "OUTPUT INSERTED.ekgmaaleid " +
                                              "VALUES (@dato,@antalmaalinger,@sfp_maaltagerfornavn, @sfp_maltagerefternavn,@sfp_maaltagermedarbjnr," +
                                              "@sfp_mt_org,@sfp_mt_kommentar,@borger_fornavn,@borger_efternavn,@borger_cprnr,@stemi_mistaenkt)";

            using (SqlCommand command = new SqlCommand(insertStringDLEDBMaeling, connect))
            {
                command.Parameters.AddWithValue("@dato", nyMaaling._dato);
                command.Parameters.AddWithValue("@antalmaalinger", nyMaaling._antalmaalinger);
                command.Parameters.AddWithValue("@sfp_maaltagerfornavn", nyMaaling._sfp_maaltagerfornavn);
                command.Parameters.AddWithValue("@sfp_maltagerefternavn", nyMaaling._sfp_maaltagerefternavn);
                command.Parameters.AddWithValue("@sfp_maaltagermedarbjnr", nyMaaling._sfp_maaltagermedarbjdnr);
                command.Parameters.AddWithValue("@sfp_mt_org", nyMaaling._sfp_mt_org);
                command.Parameters.AddWithValue("@sfp_mt_kommentar", nyMaaling._sfp_mt_kommentar);
                command.Parameters.AddWithValue("@borger_fornavn", nyMaaling._borger_fornavn);
                command.Parameters.AddWithValue("@borger_efternavn", nyMaaling._borger_efternavn);
                command.Parameters.AddWithValue("@borger_cprnr", nyMaaling._borger_cprnr);
                command.Parameters.AddWithValue("@stemi_mistaenkt", nyMaaling._STEMI_suspected);

                nyMaaling._ekgmaaleid = Convert.ToInt32(command.ExecuteScalar());
            }
            using (SqlCommand command = new SqlCommand(insertStringDLEDBData, connect))
            {
                tal = nyMaaling._lokalECG;
                for (int i = 0; i < nyMaaling._lokalECG.Length; i++)
                {
                    tal[i] = Math.Round(nyMaaling._lokalECG[i], 4);
                }

                command.Parameters.AddWithValue("@raa_data", tal.SelectMany(value => BitConverter.GetBytes(value)).ToArray());
                command.Parameters.AddWithValue("@samplerate_hz", nyMaaling._samplerate_hz);
                command.Parameters.AddWithValue("@interval_sec", nyMaaling._interval_sec);
                command.Parameters.AddWithValue("@interval_min", nyMaaling._interval_min);
                command.Parameters.AddWithValue("@data_format", nyMaaling._dataformat);
                command.Parameters.AddWithValue("@bin_eller_tekst", nyMaaling._bin_eller_tekst);
                command.Parameters.AddWithValue("@maaleformat_type", nyMaaling._maaleformat_type);
                command.Parameters.AddWithValue("@start_tid", nyMaaling._start_tid);
                command.Parameters.AddWithValue("@kommentar", nyMaaling._kommentar);
                command.Parameters.AddWithValue("@ekgmaaleid", nyMaaling._ekgmaaleid);
                command.Parameters.AddWithValue("@maalenehed_identifikation", nyMaaling._maaleenhed_identifikation);
                command.ExecuteScalar();

                connect.Close();
                return(nyMaaling._ekgmaaleid);
            }
        }
コード例 #7
0
        /// <summary>
        /// Denne metode skal tjekke på den indkommende data fra operatør siden. Den tjekker altså om den data der kommer ind
        /// passer med det gatingvindue der er blevet lavet fra operatør siden. Passer data ind i vinduet, sætter den gatingstate.
        /// </summary>
        /// <param name="obj"></param>
        public void CheckGating(object obj)
        {
            DTO_Measurement data = obj as DTO_Measurement;

            if (data.GatingLowerValue <= data.MeasurementData && data.MeasurementData <= data.GatingUpperValue)
            {
                data.GatingState = true;
            }
            else
            {
                data.GatingState = false;
            }
        }
コード例 #8
0
        /// <summary>
        /// Denne metode skal bruges til at flytte blokken i vinduet og fremvise "Hold vejret"-beskeden til patienten. Indeholder object som parameter
        /// </summary>
        /// <param name="obj"></param>
        public void Update(object obj)
        {
            DTO_Measurement dto_measurement = obj as DTO_Measurement;

            move = dto_measurement.MeasurementData;



            UpperGatingValue = dto_measurement.GatingUpperValue;
            LowerGatingValue = dto_measurement.GatingLowerValue;
            Height           = Convert.ToInt32((UpperGatingValue * 450) - (LowerGatingValue * 450));



            Christmas.Dispatcher.Invoke(DispatcherPriority.Normal,
                                        new Action(() =>
            {
                Canvas.SetBottom(BlockPosition, move);
                Canvas.SetBottom(GatingArea, (LowerGatingValue * 450));


                int lowerGatingValue1 = 0;

                lowerGatingValue1 = Convert.ToInt32(LowerGatingValue * 450);

                GatingArea.Height = Height;
                Canvas.SetBottom(GatingArea, (lowerGatingValue1));
                GatingArea.Height = Height;


                move = Math.Round(dto_measurement.MeasurementData * 450, 1);
                Canvas.SetBottom(BlockPosition, move);

                if (dto_measurement.GatingState)
                {
                    HoldLabel.Visibility = Visibility.Visible;
                    SystemSounds.Beep.Play();
                }
                else
                {
                    HoldLabel.Visibility = Visibility.Hidden;
                }
            }));
        }
コード例 #9
0
        private void Read()
        {
            while (IsReading)
            {
                try
                {
                    BreathingValuesDataContainer data = _breathingData.Take();

                    Console.ReadLine();
                    value = data.BreathingSample;


                    //Metode der kaldes for at få data fra køen

                    double dataPoint = cr.AdjustBaseLine(value);

                    DTO_Send = new DTO_Measurement(dataPoint, LowerGatingValue, UpperGatingValue, DateTime.Now);
                    countDownTimer.Start(dataPoint, LowerGatingValue, UpperGatingValue);
                    //Husk at ændre til rigtige gating værdier
                    cr.SendMeasurement(DTO_Send);



                    ChartValues.Add(new MeasurementModel
                    {
                        Time    = DateTime.Now,
                        RawData = dataPoint
                    });

                    SetAxisLimits(DateTime.Now);


                    if (ChartValues.Count > 150)
                    {
                        ChartValues.RemoveAt(0);
                    }


                    this.Dispatcher.Invoke(() =>
                    {
                        TimeRemaining_TB.Text = Convert.ToString(timeRemaining);
                        TimeElapsed_TB.Text   = Convert.ToString(timeElapsed);

                        if (AutoBaseLineWarning_L.Visibility == Visibility.Visible || ManualBaseLineWarning_L.Visibility == Visibility.Visible || LimitValueWarning_Label.Visibility == Visibility.Visible)
                        {
                            count++;
                            if (count >= 125)
                            {
                                AutoBaseLineWarning_L.Visibility   = Visibility.Hidden;
                                ManualBaseLineWarning_L.Visibility = Visibility.Hidden;
                                LimitValueWarning_Label.Visibility = Visibility.Hidden;
                                count = 0;
                            }
                        }
                    });
                }
                catch (InvalidOperationException)
                {
                }
            }
        }
コード例 #10
0
 public ECGData()
 {
     lokalinfo = new DTO_Measurement();
 }
コード例 #11
0
        public DTO_Measurement GetLokalinfo()
        {
            DTO_Measurement info = ecgData.lokalmaaling();

            return(info);
        }