// Event Handler private void OnTimer(object sender, EventArgs e) { double[] daneRys; // read all the data in the queue: while (driver.Count > 0) // driver = the queue of buffer contents { // get the current data buffer at the front of the queue DaneSerialPort data = driver.Dequeue(); // driver.Count decreases for (int g = 0; g < data.zmienna.Length; g++) { // interpret the current byte data.zmienna[g] daneRys = Convert.interpretBinaryStream(data.zmienna[g]); // public byte[] zmienna; // buffer if (daneRys != null) // the 8 channel data is completely read => Add the double data of each channel to the list of // values for each channel. { //daneRys = ValueOrZero(daneRys); // daneRys = array of 8 places => ValueOrZero sets the non-activated channel to 0 // which indicates which channel is active. writeEEGToFile(daneRys); // within This function, daneRys is converted to microVolt unit createEEGPlot(daneRys); } // else: get the next byte } // get the next buffer at the queue } }// OnTimer
// Event Handler private void timer1_Tick(object sender, EventArgs e) { double[] daneRys; // read all the data in the queue: while (driver.Count > 0) // driver = the queue of buffer contents { // get the current data buffer at the front of the queue DaneSerialPort data = driver.Dequeue(); // driver.Count decreases for (int g = 0; g < data.zmienna.Length; g++) { // interpret the current byte data.zmienna[g] daneRys = Convert.interpretBinaryStream(data.zmienna[g]); // public byte[] zmienna; // buffer if (daneRys != null) // the 8 channel data is completely read { daneRys = ValueOrZero(daneRys); // daneRys = array of 8 places => ValueOrZero sets the non-activated channel to 0 // which indicates which channel is active. writeToFile(daneRys); createPlot(daneRys); } // else: get the next byte } // get the next buffer at the queue } }
private void timer1_Tick(object sender, EventArgs e) { double[] daneRys; while (driver.Count > 0) { DaneSerialPort data = driver.Dequeue(); for (int g = 0; g < data.zmienna.Length; g++) { daneRys = Convert.interpretBinaryStream(data.zmienna[g]); if (daneRys != null) { daneRys = ValueOrZero(daneRys); writeToFile(daneRys); drawPlot(daneRys); } } } }