Vincent Cheung
/
HelloWorld
h
Fork of HelloWorld by
Diff: interface.cpp
- Revision:
- 3:641eefd1110b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface.cpp Wed Oct 26 21:17:17 2016 +0000 @@ -0,0 +1,180 @@ +#include "PaceHeart.h" +#include <string> +#include <iostream> + +using namespace std; + +void interface(){ + +int initialize_settings = 1; +while(initialize_settings ==1){ + + + PaceHeart* Pace = new PaceHeart(); //change contents based on constructor +int VA; + + +cout << "Enter 1 for atrium, 2 for ventricle: " << endl; +cin >> VA; + + +if (VA == 2){ + system ("CLS"); + int waveform = 0; + cout << "Enter 1 to change amplitude, 2 for duration, 3 for width, 0 to cancel: " << endl; + cin >> waveform; + + + if (waveform == 0){ + continue; + } + else if (waveform == 1){ + + //Make sure reference to PaceHeart is correct + double amplitude = Pace->get_p_vPaceAmp(); + cout << "Current amplitude is: " << amplitude << " mV." << endl; + + + cout << "Set the amplitude for the ventricle in mV (or enter -1 to escape): " << endl; + cin >> amplitude; + if ((amplitude >= 500) && (amplitude <= 7000)) { + cout << "Valid input. Amplitude is now set to " << amplitude << "mV" << endl; + Pace->set_p_vPaceAmp(amplitude); + } + else if (amplitude == -1) continue; + else { + cout << "Invalid input. Returning to main menu" << endl; + system("PAUSE"); //use these to prompt user to return + + } + } + else if (waveform == 2){ + + + //Make sure reference to PaceHeart is correct + int duration = Pace->get_p_VRP(); + cout << "Current duration is: " << duration << "msec. " << endl; + + + cout << "Set the duration for the ventricle in msec (or enter -1 to escape): " << endl; + cin >> duration; + if ((duration >= 150) && (duration <= 500)) { + cout << "Valid input. Duration is now set to " << duration << "msec" << endl; + Pace->set_p_VRP(duration); + } + else if (duration == -1) continue; + else { + cout << "Invalid input. Returning to main menu" << endl; + system("PAUSE"); //use these to prompt user to return + } + + + + + } + else if (waveform == 3){ + //Make sure reference to PaceHeart is correct + double width = Pace->get_p_vPaceWidth(); + cout << "Current width is: " << width << "msec. " << endl; + + + cout << "Set the width for the ventricle in msec (or enter -1 to escape): " << endl; + cin >> width; + if ((width >= 0.1) && (width <= 1.9)) { + cout << "Valid input. Width is now set to " << width<< "msec" << endl; + Pace->set_p_vPaceWidth(width); + } + else if (width == -1) continue; + else { + cout << "Invalid input. Returning to main menu" << endl; + system("PAUSE"); //use these to prompt user to return + } + + + } + + +} +else if (VA == 1){ + system ("CLS"); + int waveform = 0; + cout << "Enter 1 to change amplitude, 2 for duration, 3 for width, 0 to cancel: " << endl; + cin >> waveform; + + + if (waveform == 0){ + continue; + } + else if (waveform == 1){ + + //Make sure reference to PaceHeart is correct + int amplitude = Pace->get_p_aPaceAmp(); + cout << "Current amplitude is: " << amplitude << " mV." << endl; + + + cout << "Set the amplitude for the atrium in mV (or enter -1 to escape): " << endl; + cin >> amplitude; + if ((amplitude >= 500) && (amplitude <= 7000)) { + cout << "Valid input. Amplitude is now set to " << amplitude << "mV" << endl; + Pace->set_p_aPaceAmp(amplitude); + } + else if (amplitude == -1) continue; + else { + cout << "Invalid input. Returning to main menu" << endl; + system("PAUSE"); //use these to prompt user to return + + + } + } + else if (waveform == 2){ + + + //Make sure reference to PaceHeart is correct + int duration = Pace->get_p_ARP(); + cout << "Current duration is: " << duration << "msec. " << endl; + + + cout << "Set the duration for the atrium in msec (or enter -1 to escape): " << endl; + cin >> duration; + if ((duration >= 150) && (duration <= 500)) { + cout << "Valid input. Duration is now set to " << duration << "msec" << endl; + Pace->set_p_ARP(duration); + } + else if (duration == -1) continue; + else { + cout << "Invalid input. Returning to main menu" << endl; + system("PAUSE"); //use these to prompt user to return + } + + + + + } + else if (waveform == 3){ + //Make sure reference to PaceHeart is correct + double width = Pace->get_p_aPaceWidth(); + cout << "Current width is: " << width << "msec. " << endl; + + + cout << "Set the width for the atrium in msec (or enter -1 to escape): " << endl; + cin >> width; + if ((width >= 0.1) && (width <= 1.9)) { + cout << "Valid input. Width is now set to " << width<< "msec" << endl; + Pace->set_p_aPaceWidth(width); + } + else if (width == -1) continue; + else { + cout << "Invalid input. Returning to main menu" << endl; + system("PAUSE"); //use these to prompt user to return + } + + + } + //Checks if user wants to re-input settings + cout << "Do you want to change any values? (1 to re-input all settings, 0 to start PaceMaker)" << endl; + cin >> initialize_settings; + + + } + } +} \ No newline at end of file