57 const std::string&
GetName()
const;
97 bool Matches(
const char* receivedMessage)
const;
112 void Execute(
const char* receivedMessage)
const;
A command a remote client can send, paired with the handler that carries it out.
Definition: RemoteCommand.h:15
const std::string & GetName() const
Gets this command's name.
Definition: RemoteCommand.cpp:39
bool Matches(const char *receivedMessage) const
Checks whether a received message is addressed to this command by testing if the message contains the...
Definition: RemoteCommand.cpp:85
std::string myName
This command's name; a received message that contains it is routed to this command.
Definition: RemoteCommand.h:22
CommandHandler GetHandler() const
Gets the handler function that runs when this command matches a message.
Definition: RemoteCommand.cpp:61
void Execute(const char *receivedMessage) const
Runs this command's handler on the given message.
Definition: RemoteCommand.cpp:104
std::function< void(const char *receivedMessage)> CommandHandler
The signature every command handler must have: it receives the full message and returns nothing.
Definition: RemoteCommand.h:18
RemoteCommand(const std::string &name, CommandHandler handler)
Builds a remote command from its name and the handler that carries it out.
Definition: RemoteCommand.cpp:19
CommandHandler myHandler
The function invoked when this command matches a message.
Definition: RemoteCommand.h:25
RumPi is the library's top-level facade.
Definition: AlertManager.h:6