Commit 9f4940eb authored by fmg005's avatar fmg005

Removed example.cpp

parent cd801ba0
#include <string>
#include <iostream>
#include <cstdio>
#include <unistd.h>
#include "serial/serial.h"
#include "HardwareSimulator.h"
#include "CLA_Logger.h"
using namespace std;
int main() {
/*serial instance arguments*/
std::string port = "/dev/ttyUSB0";
uint32_t baudrate = 115200;
serial::Timeout timeout = serial::Timeout();
serial::bytesize_t bytesize = serial::eightbits;
serial::parity_t parity = serial::parity_none;
serial::stopbits_t stopbits = serial::stopbits_one;
serial::flowcontrol_t flowcontrol = serial::flowcontrol_hardware;
/*end serial instance arguments*/
CLA::LOGGER logger;
serial::Serial myserial(port, baudrate, timeout, bytesize, parity, stopbits, flowcontrol);
HardwareSimulator simulator(&myserial, &logger);
while(true) {
string s_input;
int input;
size_t* int_sz;
cout << "Select number to switch states"<<endl;
cout << "1.Remote Mode\n2.Local Mode\n3.Set IBP\n4.Set HR\n5.GetMode\n6.Quit\n\n";
getline(cin, s_input);
input = stoi(s_input, int_sz);
if(input == 1) {
simulator.SetRemoteMode();
cout<<"\n";
}
else if(input == 2) {
simulator.SetLocalMode();
cout<<"\n";
}
else if(input == 3) {
double sys;
double diast;
string sys_string;
string diast_string;
size_t* sz;
cout <<"Enter the systolic pressure: ";
getline(cin, sys_string);
sys = stod(sys_string, sz);
cout <<"Enter the diastolic pressure: ";
getline(cin, diast_string);
diast = stod(diast_string, sz);
simulator.SetIBP(1, sys, diast);
cout<<"\n";
}
else if(input == 4) {
double hr;
string s_hr;
size_t* sz;
cout<<"Enter the Heart Rate: ";
getline(cin, s_hr);
hr = stod(s_hr, sz);
simulator.SetHeartRate(hr);
cout<<"\n";
}
else if(input == 5) {
cout<<"Device is currently in "<<simulator.GetCurrentMode()<<" mode\n\n";
}
else if(input == 6) {
break;
}
}
return 0;
}
......@@ -60,7 +60,6 @@ configure_file(
set( my_srcs
HardwareSimulator.cpp
CLA_Logger.cpp
#example.cpp
SimulationEngine.cpp
Timer.cpp
Action.cpp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment