Пример #1
0
        protected override void ZephyrLog(ZephyrPacket zephyrPacket)
        {
            DateTime timestamp = DateTime.Now;

            heartbeats = zephyrHxM.HeartBeats;

            if (zephyrHxM.MinHeartRate < min || min == null)
            {
                min     = zephyrHxM.MinHeartRate;
                minTime = timestamp;
            }
            if (zephyrHxM.MaxHeartRate > max || max == null)
            {
                max     = zephyrHxM.MaxHeartRate;
                maxTime = timestamp;
            }

            if (!running)
            {
                return;
            }

            for (int i = 0; i < zephyrHxM.NewRRIntervals.Count; i++)
            {
                write(zephyrPacket, i, timestamp);
            }
        }
Пример #2
0
        private void ClosePacketQueue()
        {
#if DEBUG
            logger.Debug("Closing packet queue");
#endif

            packetQueue.Enqueue(receivedData.Dequeue());

            try
            {
                ZephyrPacket zephyrPacket = new ZephyrPacket(packetQueue.ToArray());
                secondLastPacket = lastPacket;
                lastPacket       = zephyrPacket;

#if DEBUG
                logger.Debug("Constructed Zephyr HxM packet = " + zephyrPacket);
#endif
            }
            catch (CorruptedPacketExcpetion e)
            {
#if DEBUG
                logger.Debug("Packet construction failed, corrupted packet", e);
#endif

                CorruptedPackets++;
            }

            ProcessPackets();

            ResetPacketQueue();
        }
Пример #3
0
        private void write(ZephyrPacket zephyrPacket, int index, DateTime timestamp)
        {
            excelWorksheet.Cells[row, 1].Value = timestamp;
            excelWorksheet.Cells[row, 1].Style.Numberformat.Format = dateFormat;
            excelWorksheet.Cells[row, 2].Value = zephyrPacket.HeartRate;
            excelWorksheet.Cells[row, 3].Value = zephyrPacket.rrIntervals[index];

            row++;
        }
Пример #4
0
        protected override void ZephyrLog(ZephyrPacket zephyrPacket)
        {
            DateTime timestamp = DateTime.Now;

            if (!running)
            {
                return;
            }

            for (int i = 0; i < zephyrHxM.NewRRIntervals.Count; i++)
            {
                write(zephyrPacket, i, timestamp);
            }
        }
Пример #5
0
 private void write(ZephyrPacket zephyrPacket, int index, DateTime timestamp)
 {
     xmlWriter.WriteStartElement("Record");
     xmlWriter.WriteStartAttribute("time");
     xmlWriter.WriteValue(timestamp);
     xmlWriter.WriteEndAttribute();
     xmlWriter.WriteStartElement("BPM");
     xmlWriter.WriteValue(zephyrPacket.HeartRate);
     xmlWriter.WriteEndElement();
     xmlWriter.WriteStartElement("RRInterval");
     xmlWriter.WriteValue(zephyrPacket.rrIntervals[index]);
     xmlWriter.WriteEndElement();
     xmlWriter.WriteEndElement();
 }
Пример #6
0
        private void write(ZephyrPacket zephyrPacket, int index, DateTime timestamp)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(timestamp.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrHxM.HeartBeats.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrPacket.HeartRate.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrHxM.MinHeartRate.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrHxM.MaxHeartRate.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrPacket.rrIntervals[index].ToString());
            sb.Append(delimiter);

            streamWriter.WriteLine(sb.ToString());
        }
Пример #7
0
        private void write(ZephyrPacket zephyrPacket, int index, DateTime timestamp)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append((packetIndex++).ToString());
            sb.Append(delimiter);
            sb.Append(timestamp.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrHxM.HeartBeats.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrPacket.HeartRate.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrHxM.MinHeartRate.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrHxM.MaxHeartRate.ToString());
            sb.Append(delimiter);
            sb.Append(zephyrPacket.rrIntervals[index].ToString());
            sb.Append(delimiter);
            sb.Append(Environment.NewLine);

            byte[] payload = Encoding.UTF8.GetBytes(sb.ToString());

            udpClient.Send(payload, payload.Length, this.ipAddress, this.destinationPort);
        }
Пример #8
0
 protected abstract void ZephyrLog(ZephyrPacket zephyrPacket);