#include "ShellExecPlugin.h" #include "GsmModem.h" #include "util.h" ShellExecPlugin::ShellExecPlugin(std::string pluginCommand, std::string exeCommand) : Plugin(pluginCommand, std::string("ShellExec: ")+exeCommand ), _exeCommand(exeCommand) { } void ShellExecPlugin::Execute(IGsmModem& modem, SMS& sms) { std::string parameters = GetSmsData(sms); parameters = Util::str_replace(parameters,";"); std::string command = _exeCommand + " " + parameters; int retval = ::system( command.c_str() ); std::string message; if (retval == -1) message = "Error"; else message = "OK"; modem.SendSms(sms.sender, message ); }