Commit 857ed1f6 authored by fmg005's avatar fmg005

added function to get current mode

parent a6caf15e
......@@ -61,22 +61,23 @@ void HardwareSimulator::SetRemoteMode() {
SendCommand("REMOTE");
m_logger->info("Device switched to REMOTE mode");
}
void HardwareSimulator::SetLocalMode() {
SendCommand("LOCAL");
m_logger->info("Device switched to LOCAL mode");
}
bool HardwareSimulator::isRemoteMode() {
string HardwareSimulator::GetCurrentMode() {
SendCommand("QMODE");
string data = GetResponse();
if (data.find("RMAIN") != std::string::npos) {
return true;
mode = "REMOTE";
}
else {
return false;
mode = "LOCAL";
}
return mode;
}
size_t HardwareSimulator::SendCommand(string command) {
......@@ -91,15 +92,6 @@ string HardwareSimulator::GetResponse() {
return response;
}
string HardwareSimulator::GetMode() {
if(isRemoteMode()){
return "REMOTE";
}
else {
return "LOCAL";
}
}
void HardwareSimulator::Clear() {
m_serial = nullptr;
m_logger = nullptr;
......
......@@ -20,7 +20,7 @@ private:
size_t SendCommand(string);
string GetResponse();
CLA::LOGGER* m_logger;
string mode;
public:
HardwareSimulator(serial::Serial*, CLA::LOGGER*);
~HardwareSimulator();
......@@ -31,7 +31,7 @@ public:
void SetBloodPressure(int);
void SetRemoteMode();
void SetLocalMode();
string GetMode();
string GetCurrentMode();
};
#endif
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