Skip to content

Commit

Permalink
Remove unused code inside patientview RPI.
Browse files Browse the repository at this point in the history
  • Loading branch information
LesleyWagner committed May 7, 2020
1 parent 484d7df commit 9d5b405
Showing 1 changed file with 6 additions and 212 deletions.
218 changes: 6 additions & 212 deletions PatientView_RPI/src/patientviewrpi/PatientViewRPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import controlP5.*;

/**
* @author lesley
* @author lesley wagner
*
*/
public class PatientViewRPI extends PApplet {
Expand Down Expand Up @@ -145,8 +145,6 @@ public class PatientViewRPI extends PApplet {
/************** Serial Variables (Lesley) **********************/
SensorDataReceiver receiver = new SensorDataReceiver();

boolean is_raspberrypi=false;

int global_hr;
int global_rr;
float global_temp;
Expand Down Expand Up @@ -174,7 +172,6 @@ public void setup() {
pointsRed = new GPointsArray(nPoints);

heightHeader = 100;
println("Height:" + height);

totalPlotsHeight = height - heightHeader;

Expand Down Expand Up @@ -204,23 +201,22 @@ public void setup() {
pointsRed.add(i, 0);
}
plotRed.setPoints(pointsRed);
plotIR.setPoints(pointsIR);

// create server
server = new Server(this, wifiPort);
plotIR.setPoints(pointsIR);

dataBufferRed = new LinkedList<Integer>();
dataBufferIR = new LinkedList<Integer>();
dataBufferTemperature = new LinkedList<Integer>();
dataBufferHr = new LinkedList<Integer>();
dataBufferSpo2 = new LinkedList<Integer>();

server = new Server(this, wifiPort);

if (testing) {
testStreamer = new TestDataStreamer();
testStreamer.start();
}
else {
receiver.startSerial(this); // start serial connection
receiver.startSerial(this);
}
startPlot = true;
}
Expand All @@ -242,8 +238,7 @@ public void controlEvent(CallbackEvent event) {
//cp5.remove(event.getController().getName());
}
}
}
);
});

lblHR = cp5.addTextlabel("lblHR")
.setText("Heartrate: --- bpm")
Expand Down Expand Up @@ -511,207 +506,6 @@ public void run() {
Runtime.getRuntime().addShutdownHook(logfileHook);
}

// /**
// * Update data with new point from test data. Runs every 8 ms.
// */
// TimerTask updateData = new TimerTask() {
// public void run() {
// // clear buffers and move recently added data to the beginning of the buffers
// dataBufferTestRed[contentIndex] = ecgTestDataSync.get(testDataIndex);
// dataBufferTestIR[contentIndex] = ppgTestData.get(testDataIndex);
// contentIndex++;
// if (contentIndex == testBufferSize) {
// contentIndex = 0;
// }
// if ((testDataIndex % 125) == 0) {
// dataBufferTestTemperature[hrFrequencyIndex] = tempTestDataSync.get(hrFrequencyIndex);
// dataBufferTestHr[hrFrequencyIndex] = hrTestData.get(hrFrequencyIndex);
// dataBufferTestSpo2[hrFrequencyIndex] = spo2TestData.get(hrFrequencyIndex);
// hrFrequencyIndex++;
// newHrPoint = true;
// }
// testDataIndex++;
// }
// };

// /**
// * setup test data and timer
// */
// public void testSetup() {
// frameRate(30);
//
// dataBufferTestRed = new int[testBufferSize];
// dataBufferTestIR = new int[testBufferSize];
// dataBufferTestTemperature = new int[testBufferSize];
// dataBufferTestHr = new int[testBufferSize];
// dataBufferTestSpo2 = new int[testBufferSize];
//
// for (int i=0; i<testBufferSize; i++) {
// dataBufferTestRed[i] = 0;
// dataBufferTestIR[i] = 0;
// }
//
// // ecg test values
// try (InputStream ecgInput = new FileInputStream(new File(getClass().getResource("/ecg_testdata.csv").toURI()))) {
// String[] ecgFileContents = loadStrings(ecgInput); // contents of ecg data file
// String[] ecgTestDataStrings = ecgFileContents[0].split(",");
// IntList ecgTestData = new IntList();
// for (int i = 0; i < ecgTestDataStrings.length; i++) {
// String formattedString = ecgTestDataStrings[i];
// while (!formattedString.matches("\\-?0\\.\\d{3}")) {
// formattedString += "0";
// }
// ecgTestData.append(parseInt(formattedString.replaceAll("0\\.0*", "")));
// }
// ecgTestDataSync = new IntList();
// // take every fourth entry of ecg test data at 500 Hzto synchronize it with the other data at 125 Hz
// for (int i = 0; i < ecgTestData.size(); i++) {
// if ((i % 4) == 0) {
// ecgTestDataSync.append(ecgTestData.get(i));
// }
// }
// }
// catch (Exception e){
// e.printStackTrace();
// System.out.println("ECG file not found.");
// }
//
// // ppg test values
// try (InputStream ppgInput = new FileInputStream(new File(getClass().getResource("/bidmc_01_Signals.csv").toURI()))) {
// Table ppgTestTable = new Table (ppgInput, "csv, header");
// ppgTestData = new IntList();
// for (TableRow row : ppgTestTable.rows()) {
// String formattedString = row.getString(2).replaceAll("0\\.0*", "");
// int parsedInt = parseInt(formattedString);
// while (parsedInt < 10000) {
// parsedInt *= 10;
// }
// parsedInt >>= 2; // make the value fit in two bytes
// ppgTestData.append(parsedInt);
// }
// }
// catch (Exception e){
// e.printStackTrace();
// System.out.println("PPG file not found.");
// }
//
// // temp test values
// try (InputStream tempInput = new FileInputStream(new File(getClass().getResource("/temperature_testdata.csv").toURI()))) {
// String[] tempFileContents = loadStrings(tempInput);
// String[] tempTestDataStrings = tempFileContents[0].split(",");
// IntList tempTestData = new IntList();
// for (int i = 0; i < tempTestDataStrings.length; i++) {
// String formattedString = tempTestDataStrings[i].replaceAll("(\\d{2})(\\.)(\\d{1})(\\d*)", "$1$3");
// tempTestData.append(parseInt(formattedString));
// }
// tempTestDataSync = new IntList();
// // take every eight entry of temp test data at 8 Hz to synchronize with other data at 1 Hz
// for (int i = 0; i < tempTestData.size(); i++) {
// if ((i % 8) == 0) {
// tempTestDataSync.append(tempTestData.get(i));
// }
// }
// }
// catch (Exception e){
// e.printStackTrace();
// System.out.println("ECG file not found.");
// }
//
// // hr and spo2 test values
// try (InputStream hrInput = new FileInputStream(new File(getClass().getResource("/HR_SPO2_testdata.csv").toURI()))) {
// Table hrspo2TestTable = new Table(hrInput, "csv, header");
// hrTestData = new IntList();
// spo2TestData = new IntList();
//
// for (TableRow row : hrspo2TestTable.rows()) {
// spo2TestData.append(row.getInt(0));
// hrTestData.append(row.getInt(1));
// }
// }
// catch (Exception e){
// e.printStackTrace();
// System.out.println("PPG file not found.");
// }
//
// // update test data every 8 milliseconds
// testTimer = new java.util.Timer("timer");
// long delay = 1000L;
// long period = 8L;
// testTimer.scheduleAtFixedRate(updateData, delay, period);
// }
//
// /**
// * updates points when testing
// * returns list of integer arrays with new data points
// */
// ArrayList<int[]> updateTestPoints() {
// ArrayList<int[]> newData = new ArrayList<int[]>();
//
// if (startPlot) {
// prevPlotIndex = plotIndex;
// plotIndex = contentIndex;
// if (plotIndex > prevPlotIndex) {
// nNewPoints = plotIndex - prevPlotIndex;
// }
// else {
// nNewPoints = plotIndex + testBufferSize - prevPlotIndex;
// }
//
// // new data
// int hrIndex = (hrFrequencyIndex == 0) ? 0 : hrFrequencyIndex-1;
// int hr = dataBufferTestHr[hrIndex];
// int spo2 = dataBufferTestSpo2[hrIndex];
// int temp = dataBufferTestTemperature[hrIndex];
//
// if (newHrPoint) {
// newHrPoint = false;
// lblHR.setText("Heartrate: " + String.valueOf(hr) + " bpm");
// lblSPO2.setText("SpO2: " + String.valueOf(spo2) + " %");
// lblTemp.setText("Temperature: " + String.format("%.1f", temp/(float)10) + " \u00B0 C");
// }
//
// // remove n points at the beginning of the plot
// for (int i=nNewPoints-1; i >= 0; i--) {
// pointsRed.remove(i);
// pointsIR.remove(i);
// }
//
// // move plot to the left
// for (int i=0; i < nPoints-nNewPoints; i++) {
// pointsRed.setX(i, i);
// pointsIR.setX(i, i);
// }
//
// // add n new points
// int bufferIndex = prevPlotIndex;
// for (int i=0; i < nNewPoints; i++) {
// if (bufferIndex == testBufferSize) {
// bufferIndex = 0;
// }
// int red = dataBufferTestRed[bufferIndex];
// int ir = dataBufferTestIR[bufferIndex];
// pointsRed.add(nPoints-nNewPoints+i, nPoints-nNewPoints+i, red);
// pointsIR.add(nPoints-nNewPoints+i, nPoints-nNewPoints+i, ir);
// if (logging) {
// logData(red, ir, hr, spo2, temp);
// }
//
// // add new point for transmitting
// int[] newDataPoint = new int[5];
// newDataPoint[0] = red;
// newDataPoint[1] = ir;
// newDataPoint[2] = hr;
// newDataPoint[3] = spo2;
// newDataPoint[4] = temp;
// newData.add(newDataPoint);
//
// bufferIndex = bufferIndex + 1;
// }
// }
// return newData;
//
// }

/**
* @param args
*/
Expand Down

0 comments on commit 9d5b405

Please sign in to comment.