Skip to content
Snippets Groups Projects
Commit bab4a5b5 authored by Querejeta Lomas, Leire's avatar Querejeta Lomas, Leire
Browse files

new command SendCustomCommand included

parent 8edb1d4d
No related branches found
No related tags found
No related merge requests found
Pipeline #92373 failed
......@@ -189,6 +189,8 @@ public:
std::string ping();
std::string getHelp();
std::string sendCustomCommand(std::string &command);
};
#endif
\ No newline at end of file
......@@ -168,9 +168,9 @@ std::string CLASS_SerialPort::communication(const char *buffer, std::string auxC
std::string result;
std::string buf("[" + auxControl + "] ");
buf.append(buffer);
buffer = buf.c_str();
//std::string buf("[" + auxControl + "] ");
//buf.append(buffer);
//buffer = buf.c_str();
bool ret = write(buffer);
if(!ret)
......@@ -1527,3 +1527,15 @@ std::string CLASS_SerialPort::getHelp()
std::string result = communication(msg.c_str());
return result;
}
/**
* @brief sends custom command to class
*
* @param command custom command string to send to class device
* @return std::string answer
*/
std::string CLASS_SerialPort::sendCustomCommand(std::string &command)
{
std::string result = communication(command.c_str());
return result;
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ using namespace std;
int main(void)
{
std::string port;
port = "COM3"; // name of port assigned to class bluetooth device
port = "COM4"; // name of port assigned to class bluetooth device
CLASS_SerialPort serial;
bool port_status = serial.SetOpenPort(port);
......@@ -33,6 +33,10 @@ int main(void)
std::string start_communication = serial.startFESCommunication();
cout << "start_communication : " + start_communication << endl;
std::string customcommand = "ping\r\n";
std::string custom = serial.sendCustomCommand(customcommand);
cout << "custom : " << custom << endl;
std::string setStimulationOn = serial.setStimulationOn();
cout << "setStimulationOn : " << setStimulationOn << endl;
......@@ -301,13 +305,16 @@ int main(void)
//std::string setRTCTime = serial.setRTCTime(time);
//cout << "setRTCTime : " << setRTCTime << endl;
std::string ping = serial.ping();
cout << "ping : " + ping << endl;
std::string help = serial.getHelp();
cout << "Help : " + help << endl;
std::string customcommand = "ping\r\n";
std::string custom = serial.sendCustomCommand(customcommand);
cout << "custom : " << custom << endl;
std::string shutDown = serial.shutDown();
cout << "shutDown : " << shutDown << endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment