|
|
@ -273,8 +273,13 @@ class FocusExampleCommand : public Plugin {
|
|
|
|
return ::Focus.sendName(F("FocusExampleCommand"));
|
|
|
|
return ::Focus.sendName(F("FocusExampleCommand"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EventHandlerResult onFocusEvent(const char *command) {
|
|
|
|
EventHandlerResult onFocusEvent(const char *input) {
|
|
|
|
if (strcmp_P(command, PSTR("example")) != 0)
|
|
|
|
const char *cmd = PSTR("example");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (::Focus.inputMatchesHelp(input))
|
|
|
|
|
|
|
|
return ::Focus.printHelp(cmd);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!::Focus.inputMatchesCommand(input, cmd))
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
|
|
|
|
|
|
|
|
::Focus.send(F("This is an example response. Hello world!"));
|
|
|
|
::Focus.send(F("This is an example response. Hello world!"));
|
|
|
@ -348,8 +353,8 @@ class ExamplePlugin : public Plugin {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
ExamplePlugin();
|
|
|
|
ExamplePlugin();
|
|
|
|
|
|
|
|
|
|
|
|
EventHandlerResult onFocusEvent(const char *command) {
|
|
|
|
EventHandlerResult onFocusEvent(const char *input) {
|
|
|
|
if (strcmp_P(command, PSTR("example.toggle")) != 0)
|
|
|
|
if (!::Focus.inputMatchesCommand(input, PSTR("example.toggle")))
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
|
|
|
|
|
|
|
|
example_toggle_ = !example_toggle_;
|
|
|
|
example_toggle_ = !example_toggle_;
|
|
|
@ -408,8 +413,8 @@ class ExampleOptionalCommand : public Plugin {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
ExampleOptionalCommand() {}
|
|
|
|
ExampleOptionalCommand() {}
|
|
|
|
|
|
|
|
|
|
|
|
EventHandlerResult onFocusEvent(const char *command) {
|
|
|
|
EventHandlerResult onFocusEvent(const char *input) {
|
|
|
|
if (strcmp_P(command, PSTR("optional")) != 0)
|
|
|
|
if (!::Focus.inputMatchesCommand(input, PSTR("optional")))
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
|
|
|
|
|
|
|
|
::Focus.send(Layer.getLayerState());
|
|
|
|
::Focus.send(Layer.getLayerState());
|
|
|
|