コード例 #1
0
        public double GetWaveformData(string waveformName)
        {
            double nextValue = 0.0d;

            Waveform wf = _waveforms[waveformName];

            if (wf != null)
            {
                nextValue = wf.DataPoints[wf.DataIndex++];

                wf.DataIndex = wf.DataIndex % wf.DataPoints.Length;
            }

            return(nextValue);
        }
コード例 #2
0
        public void CreateWaveformData(string filename)
        {
            // Creates an instance of the XmlSerializer class;
            // specifies the type of object to serialize.
            XmlSerializer serializer = new XmlSerializer(typeof(WaveformData));
            TextWriter    writer     = new StreamWriter(filename);
            WaveformData  wfd        = new WaveformData();

            // Creates an address to ship and bill to.
            Waveform wf = new Waveform();

            wf.Name = "ECG";
            wf.Data = "0.0,1.0,5.0,0.0,3.0,1.0,5.0,5.0,0.0,1.0";

            wfd.Waveforms = new Waveform[] { wf };

            // Serializes the waveform data, and closes the TextWriter.
            serializer.Serialize(writer, wfd);
            writer.Close();
        }