]> git.sur5r.net Git - freertos/blobdiff - Demo/Common/Utils/CommandInterpreter.h
Change command interpreter semantics.
[freertos] / Demo / Common / Utils / CommandInterpreter.h
index e3d01614be02f23b517d84edf49a642b44fbbf7e..4173056093900a0a534215c80db6b098cbebb958 100644 (file)
 \r
 /* The prototype to which callback functions used to process command line\r
 commands must comply.  This type will change when commands with parameters \r
-are included. */\r
-typedef const signed char * (*pdCOMMAND_LINE_CALLBACK)( void );\r
+are included.  pcWriteBuffer is a buffer into which the output from executing\r
+the command can be written, xWriteBufferLen is the length, in bytes, of the\r
+pcWriteBuffer buffer. */\r
+typedef portBASE_TYPE (*pdCOMMAND_LINE_CALLBACK)( signed char *pcWriteBuffer, size_t xWriteBufferLen );\r
 \r
 /* The structure that defines command line commands.  A command line command\r
 should be defined by declaring a const structure of this type. */\r
 typedef struct xCOMMAND_LINE_INPUT\r
 {\r
        const signed char * const pcCommand;                            /* The command that causes pxCommandInterpreter to be executed.  For example "help".  Must be all lower case. */\r
-       const signed char * const pcHelpString;                         /* String that describes how to use the command.  Should start with the command itself, and end with "\r\n".  For exxample "help: Returns a list of all the commands\r\n". */\r
+       const signed char * const pcHelpString;                         /* String that describes how to use the command.  Should start with the command itself, and end with "\r\n".  For example "help: Returns a list of all the commands\r\n". */\r
        const pdCOMMAND_LINE_CALLBACK pxCommandInterpreter;     /* A pointer to the callback function that will return the output generated by the command. */\r
 } xCommandLineInput;\r
 \r
@@ -77,18 +79,17 @@ typedef struct xCOMMAND_LINE_INPUT
 portBASE_TYPE xCmdIntRegisterCommand( const xCommandLineInput * const pxCommandToRegister );\r
 \r
 /*\r
- * Runns the command interpreter for the command string "pcCommandInput".  If\r
- * pcCommandInput is valid (the command has been registered) a string will be \r
- * returned, and pcCmdIntProcessCommand must then be called repeatedly until \r
- * NULL is returned.  If pcCommand pcCommandInput is not valid (the command is\r
- * not recognised as a registered command) then an error message will be\r
- * returned - and again pcCmdIntProcessCommand() must be called repeatedly\r
- * until NULL is returned.\r
+ * Runs the command interpreter for the command string "pcCommandInput".  Any\r
+ * output generated by running the command will be placed into pcWriteBuffer.\r
+ * xWriteBufferLen must indicate the size, in bytes, of the buffer pointed to\r
+ * by pcWriteBuffer.\r
+ *\r
+ * xCmdIntProcessCommand should be called repeatedly until it returns pdFALSE.\r
  *\r
  * pcCmdIntProcessCommand is not reentrant.  It must not be called from more\r
  * than one task - or at least - by more than one task at a time.\r
  */\r
-const signed char *pcCmdIntProcessCommand( const signed char * const pcCommandInput );\r
+portBASE_TYPE xCmdIntProcessCommand( const signed char * const pcCommandInput, signed char * pcWriteBuffer, size_t xWriteBufferLen  );\r
 \r
 #endif /* COMMAND_INTERPRETER_H */\r
 \r