The CommandProcessor is the interface to install a run-time menu into an embedded system.
Dependents: A_CANAdapter USB2I2C
Diff: CommandProcessor.h
- Revision:
- 6:1a0512faa75d
- Parent:
- 4:283e35536097
- Child:
- 7:0f058d664b21
--- a/CommandProcessor.h Thu Mar 31 00:33:18 2011 +0000 +++ b/CommandProcessor.h Sat Apr 02 17:12:39 2011 +0000 @@ -161,25 +161,27 @@ /// This function has a number of parameters, which make the CommandProcessor quite flexible. /// The user can enable a default menu, which can consist of the following functions. /// Note that when the [bit] is set, that menu item is enabled. - /// * [2] Help - which in turn will show all the menu items and their brief descriptions + /// * [3] Help - which in turn will show all the menu items and their brief descriptions + /// * [2] Echo - which adds the echo command help /// * [1] About - just a tiny statement about the CommandProcessor itself /// * [0] Exit - a method to permit a consistent means to exit the CommandProcessor /// /// @param defaultMenu enables various default menu items, based on the bit values. - /// @param caseinsensitive when TRUE, as the name implies, permits "help" and "HeLp" to function the same - /// @param maxCmdLen sets the memory allocation for the command buffer. This should be sized - /// to the maximum command, including any passed in text as parameters. /// @param kbhit is a user provided function to detect if a character is available for the CommandProcessor, /// and when using standard io, you can typically use kbhit, or _kbhit as your system provides. /// @param getch is a user provided function that provides a single character to the CommandProcessor /// @param putch is a user provided function that permits the CommandProcessor to output a character /// @param puts is a user provided function that permits the CommandProcessor to output a string /// to which is automatically appended a \\n + /// @param caseinsensitive when TRUE, as the name implies, permits "help" and "HeLp" to function the same + /// @param maxCmdLen sets the memory allocation for the command buffer. This should be sized + /// to the maximum command, including any passed in text as parameters. /// @returns INITRESULT_T to indicate if the init was successful or failed INITRESULT_T (*Init)( int defaultMenu, int caseinsensitive, - int maxCmdLen, + int echo, + int maxCmdLen, int (*kbhit)(void), int (*getch)(void), int (*putch)(int ch), @@ -191,8 +193,8 @@ /// This passes in a reference to a user provided CMD_T item, which is /// added to the menu system. /// - /// @param m is a pointer to the user provided menu - /// @returns ADDRESULT_T to indicate if the add was successful or failed + /// @param m is a pointer to the user provided menu + /// @returns ADDRESULT_T to indicate if the add was successful or failed /// ADDRESULT_T (*Add)(CMD_T * m); @@ -209,6 +211,18 @@ /// command that was executed is requesting the CommandProcessor to exit. /// RUNRESULT_T (*Run)(void); + + /// Echo command permits turning the echo on and off + /// + /// When interactive with the user, it is best to have echo on, so they can see + /// the prompt, but if this is simply slaved to another program, then the echo + /// might need to be off to best manage the stream. + /// + /// @param echo turns the echo on (non-zero) or off (zero) + /// @returns RUNRESULT_T to indicate if the CommandProcessor should remain active or if the + /// command that was executed is requesting the CommandProcessor to exit. + /// + RUNRESULT_T (*Echo)(int echo); /// End if the function to be called when you want to gracefully end the CommandProcessor. ///