diff --git a/include/regilo/controller.hpp b/include/regilo/controller.hpp index 9340ecf..bb239d2 100644 --- a/include/regilo/controller.hpp +++ b/include/regilo/controller.hpp @@ -160,27 +160,12 @@ class StreamController : public virtual IController virtual std::string sendCommand(const std::string& command) final override; - /** - * @brief Send a command to the device and keep the response in the buffer. - * @param command A commmand with all parameters. - */ - template::value, Response>::type* = nullptr> - void sendCommand(const Command& command); - - /** - * @brief Send a command to the device and keep the response in the buffer. - * @param command A commmand without parameters. - * @param params Parameters that will be inserted into the command (separated by space). - */ - template::value, Response>::type* = nullptr> - void sendCommand(const Command& command, const Args& ... params); - /** * @brief Send a command to the device. * @param command A commmand with all parameters. * @return A response to the command. */ - template::value, Response>::type* = nullptr> + template Response sendCommand(const Command& command); /** @@ -188,7 +173,7 @@ class StreamController : public virtual IController * @param command A commmand without parameters. * @return Parameters that will be inserted into the command (separated by space). */ - template::value, Response>::type* = nullptr> + template Response sendCommand(const Command& command, const Args& ... params); /** @@ -197,8 +182,8 @@ class StreamController : public virtual IController * @param params Parameters that will be inserted into the command. * @return A response to the command. */ - template - std::string sendFormattedCommand(const std::string& commandFormat, Args... params); + template + Response sendFormattedCommand(const std::string& commandFormat, Args... params); /** * @brief Create a command with the specified parameters (printf formatting is used). @@ -253,23 +238,7 @@ std::string StreamController::sendCommand(const std::string& command) } template -template::value, Response>::type*> -void StreamController::sendCommand(const Command& command) -{ - deviceInput << command; - sendCommand(); -} - -template -template::value, Response>::type*> -void StreamController::sendCommand(const Command& command, const Args& ... params) -{ - deviceInput << command << ' '; - sendCommand(params...); -} - -template -template::value, Response>::type*> +template Response StreamController::sendCommand(const Command& command) { deviceInput << command; @@ -277,7 +246,7 @@ Response StreamController::sendCommand(const Command& command) } template -template::value, Response>::type*> +template Response StreamController::sendCommand(const Command& command, const Args& ... params) { deviceInput << command << ' '; @@ -285,10 +254,10 @@ Response StreamController::sendCommand(const Command& command, const Ar } template -template -std::string StreamController::sendFormattedCommand(const std::string& commandFormat, Args... params) +template +Response StreamController::sendFormattedCommand(const std::string& commandFormat, Args... params) { - return sendCommand(createFormattedCommand(commandFormat, params...)); + return sendCommand(createFormattedCommand(commandFormat, params...)); } template