You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/StreamCommander.hpp
+15-14Lines changed: 15 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
/*
1
+
/*
2
2
Copyright 2019 Jan-Eric Schober
3
3
4
4
Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,6 +49,7 @@ class StreamCommander
49
49
staticconstchar COMMAND_DELIMITER = '';
50
50
staticconstchar MESSAGE_DELIMITER = ':';
51
51
staticconstint ID_MAX_LENGTH = 32;
52
+
staticconst String PING_REPLY;
52
53
53
54
staticconst String COMMAND_ACTIVATE;
54
55
staticconst String COMMAND_DEACTIVATE;
@@ -79,13 +80,13 @@ class StreamCommander
79
80
Stream * getStreamInstance(); // Gets the current streamInstance of the StreamCommander.
80
81
voidsetAddStandardCommands( bool addStandardCommands ); // Sets whether the standard commands should be added or not (true/false).
81
82
boolshouldAddStandardCommands(); // Returns whether the standard commadns should be added or not.
82
-
voidsaveIdToEEPROM( String id ); // Saves and ID to the EEPROM if it differs from the old one.
83
-
voidloadIdFromEEPROM(); // Loads the ID from the EEPROM.
83
+
voidsaveIdToEeprom( String id ); // Saves and ID to the EEPROM if it differs from the old one.
84
+
voidloadIdFromEeprom(); // Loads the ID from the EEPROM.
84
85
voiddeleteCommands(); // Deletes all registered commands.
85
86
voidsetNumCommands( int numCommands ); // Sets the number of the currently registered commands.
86
87
voidincrementNumCommands(); // Increments the number of the currently registered commands.
87
88
CommandContainer * getCommandContainer( String command ); // Gets the container containing all commands.
88
-
intgetCommandContainerNum( String command ); // Returns the number (position) of a specific command in the command container.
89
+
intgetCommandContainerIndex( String command ); // Returns the index (position) of a specific command in the command container by name.
89
90
90
91
staticvoidcommandActivate( String arguments, StreamCommander * instance );// Definition of the command COMMAND_ACTIVATE.
91
92
staticvoidcommandDeactivate( String arguments, StreamCommander * instance ); // Definition of the command COMMAND_DEACTIVATE.
@@ -102,7 +103,7 @@ class StreamCommander
102
103
public:
103
104
// Constructor
104
105
StreamCommander( Stream * streamInstance = &Serial ); // Constructor, instance of a Stream object as argument.
105
-
106
+
106
107
// Destructor
107
108
~StreamCommander();
108
109
@@ -141,15 +142,15 @@ class StreamCommander
141
142
voidfetchCommand(); // Fetches and interprets incoming commands, and invokes the corresponding callbacks. This should be called in the loop or after an interrupt/event.
142
143
143
144
voidsendMessage( String type, String content ); // Sends a message with a specific type and content separated by our delimiter.
144
-
voidsendResponse( String response ); // Sends a message of type MessageType::RESPONSE
145
-
voidsendInfo( String info ); // Sends a message of type MessageType::INFO
146
-
voidsendError( String error ); // Sends a message of type MessageType::ERROR
147
-
voidsendPing(); // Sends a message of type MessageType::PING, contains a "reply"
148
-
voidsendStatus(); // Sends a message of type MessageType::STATUS, contains the current status
149
-
voidsendId(); // Sends a message of type MessageType::ID, contains the current ID
150
-
voidsendIsActive(); // Sends a message of type MessageType::ACTIVE, contains the current active status
151
-
voidsendEcho( String echo ); // Sends a message of type MessageType::ECHO
152
-
voidsendCommands(); // Sends a message of type MessageType::COMMANDS, contains a list of currently registered commands
145
+
voidsendResponse( String response ); // Sends a message of type MessageType::RESPONSE.
146
+
voidsendInfo( String info ); // Sends a message of type MessageType::INFO.
147
+
voidsendError( String error ); // Sends a message of type MessageType::ERROR.
148
+
voidsendPing(); // Sends a message of type MessageType::PING, contains a "reply".
149
+
voidsendStatus(); // Sends a message of type MessageType::STATUS, contains the current status.
150
+
voidsendId(); // Sends a message of type MessageType::ID, contains the current ID.
151
+
voidsendIsActive(); // Sends a message of type MessageType::ACTIVE, contains the current active status.
152
+
voidsendEcho( String echo ); // Sends a message of type MessageType::ECHO.
153
+
voidsendCommands(); // Sends a message of type MessageType::COMMANDS, contains a list of currently registered commands.
0 commit comments