The CommandProcessor is the interface to install a run-time menu into an embedded system.

Dependents:   A_CANAdapter USB2I2C

Committer:
WiredHome
Date:
Sat Apr 02 17:12:39 2011 +0000
Revision:
6:1a0512faa75d
Parent:
4:283e35536097
Child:
7:0f058d664b21
Added ability to turn prompt echo on or off

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 0:198f53da1bc8 1 /// @file CommandProcessor.h defined the interface to the CommandProcessor
WiredHome 0:198f53da1bc8 2 ///
WiredHome 0:198f53da1bc8 3 /// @mainpage
WiredHome 0:198f53da1bc8 4 /// The CommandProcessor is the interface to install a run-time menu into an embedded system.
WiredHome 0:198f53da1bc8 5 /// This contains the complete interface to the CommandProcessor.
WiredHome 0:198f53da1bc8 6 ///
WiredHome 0:198f53da1bc8 7 /// @version 1.0
WiredHome 0:198f53da1bc8 8 ///
WiredHome 0:198f53da1bc8 9 /// @note The CommandProcessor is text-based, because it is intended to interact with a
WiredHome 0:198f53da1bc8 10 /// user.
WiredHome 0:198f53da1bc8 11 ///
WiredHome 0:198f53da1bc8 12 /// The menu is designed to be interactively accessed, perhaps via a console interface
WiredHome 0:198f53da1bc8 13 /// or a serial port. The actual interface to the user is provided by the application
WiredHome 0:198f53da1bc8 14 /// during initialization, so it can be connected to a serial port, or it could
WiredHome 0:198f53da1bc8 15 /// be interface to CAN, telnet, or by some other method.
WiredHome 0:198f53da1bc8 16 ///
WiredHome 0:198f53da1bc8 17 /// The CommandProcessor has a few special features:
WiredHome 0:198f53da1bc8 18 /// \li If the minimum number of characters of a command have been entered, the
WiredHome 0:198f53da1bc8 19 /// user does not have to type the entire command. (e.g. 'He' will execute
WiredHome 0:198f53da1bc8 20 /// the command for 'Help', if no other command beings with 'He').
WiredHome 0:198f53da1bc8 21 /// \li If the user does not type the entire set of characters, the command
WiredHome 0:198f53da1bc8 22 /// will be rewritten to the output device with the entire command word.
WiredHome 0:198f53da1bc8 23 /// \li The user is not permitted to enter an incorrect command (e.g. If 'Help'
WiredHome 0:198f53da1bc8 24 /// is the only command started with 'Hel', the user cannot enter 'Heu'.
WiredHome 0:198f53da1bc8 25 /// The CommandProcessor will trap the 'u' and issue a beep).
WiredHome 0:198f53da1bc8 26 /// \li Simple editing of parameters to commands is permitted with \<bs\> to
WiredHome 0:198f53da1bc8 27 /// erase incorrect text.
WiredHome 0:198f53da1bc8 28 /// \li Tab completion of a command is available - so long as the user has
WiredHome 4:283e35536097 29 /// typed at least the minimum number of unique characters. (e.g. 'He\<tab\>'
WiredHome 0:198f53da1bc8 30 /// will be replaced with 'Help')
WiredHome 4:283e35536097 31 /// \li Command cancellation is available - just enter the \<esc\> key and
WiredHome 0:198f53da1bc8 32 /// the buffer is erased.
WiredHome 0:198f53da1bc8 33 /// \li The user is not permitted to enter text longer than the defined buffer,
WiredHome 0:198f53da1bc8 34 /// to avoid buffer overrun and the possible memory damaging results.
WiredHome 0:198f53da1bc8 35 ///
WiredHome 0:198f53da1bc8 36 /// The CommandProcessor is designed as a set of C functions, which makes it
WiredHome 0:198f53da1bc8 37 /// reusable in more systems (as C++ compilers are not always available for
WiredHome 0:198f53da1bc8 38 /// all micros).
WiredHome 0:198f53da1bc8 39 ///
WiredHome 0:198f53da1bc8 40 /// Example:
WiredHome 0:198f53da1bc8 41 /// @code
WiredHome 0:198f53da1bc8 42 /// extern "C" {
WiredHome 0:198f53da1bc8 43 /// #include "CommandProcessor.h"
WiredHome 0:198f53da1bc8 44 /// }
WiredHome 0:198f53da1bc8 45 ///
WiredHome 0:198f53da1bc8 46 /// RUNRESULT_T Who(char *p);
WiredHome 0:198f53da1bc8 47 /// const CMD_T WhoCmd = {"who", "Shows who is logged on, or 'who id' for specifics", Who, visible};
WiredHome 0:198f53da1bc8 48 ///
WiredHome 0:198f53da1bc8 49 /// RUNRESULT_T Who(char *p)
WiredHome 0:198f53da1bc8 50 /// {
WiredHome 4:283e35536097 51 /// printf("\r\nwho...\r\n");
WiredHome 4:283e35536097 52 /// if (*p)
WiredHome 4:283e35536097 53 /// printf(" Sorry, no help for [%s]\r\n", p);
WiredHome 4:283e35536097 54 /// return runok;
WiredHome 0:198f53da1bc8 55 /// }
WiredHome 0:198f53da1bc8 56 ///
WiredHome 0:198f53da1bc8 57 /// int main(int argc, char* argv[])
WiredHome 0:198f53da1bc8 58 /// {
WiredHome 4:283e35536097 59 /// CMDP_T * cp = GetCommandProcessor();
WiredHome 4:283e35536097 60 /// cp->Init(7, TRUE, 50, _kbhit, _getch, _putch, printf);
WiredHome 4:283e35536097 61 /// cp->Add(&WhoCmd);
WiredHome 0:198f53da1bc8 62 ///
WiredHome 4:283e35536097 63 /// while (cp->Run())
WiredHome 4:283e35536097 64 /// {
WiredHome 4:283e35536097 65 /// ;
WiredHome 4:283e35536097 66 /// }
WiredHome 4:283e35536097 67 /// cp->End();
WiredHome 4:283e35536097 68 /// return 0;
WiredHome 0:198f53da1bc8 69 /// }
WiredHome 0:198f53da1bc8 70 /// @endcode
WiredHome 0:198f53da1bc8 71 ///
WiredHome 0:198f53da1bc8 72 /// @note Copyright &copy; 2011 by Smartware Computing, all rights reserved.
WiredHome 0:198f53da1bc8 73 /// This program may be used by others as long as this copyright notice
WiredHome 0:198f53da1bc8 74 /// remains intact.
WiredHome 0:198f53da1bc8 75 /// @author David Smart
WiredHome 0:198f53da1bc8 76 ///
WiredHome 0:198f53da1bc8 77 #ifndef COMMANDPROCESSOR_H
WiredHome 0:198f53da1bc8 78 #define COMMANDPROCESSOR_H
WiredHome 0:198f53da1bc8 79
WiredHome 0:198f53da1bc8 80 #ifndef TRUE
WiredHome 4:283e35536097 81 #define TRUE 1 ///< Definition for TRUE, if not already provided
WiredHome 4:283e35536097 82 #define FALSE 0 ///< Definition for FALSE, if not already provided
WiredHome 0:198f53da1bc8 83 #endif
WiredHome 0:198f53da1bc8 84
WiredHome 0:198f53da1bc8 85 /// @brief This type determines if menu items are visible to the Help system, or hidden.
WiredHome 0:198f53da1bc8 86 /// @details This is used in the definition of the menu item.
WiredHome 0:198f53da1bc8 87 typedef enum
WiredHome 0:198f53da1bc8 88 {
WiredHome 4:283e35536097 89 invisible, ///< use this value to have invisible (hidden) a menu in the Help
WiredHome 4:283e35536097 90 visible ///< use this value to have visible a menu in the Help
WiredHome 4:283e35536097 91 } VISIBLE_T; ///< This determines if menu items are made visible in the Help system.
WiredHome 0:198f53da1bc8 92
WiredHome 0:198f53da1bc8 93 /// Callbacks that are executed return a value to indicate if the menu
WiredHome 0:198f53da1bc8 94 /// should remain active
WiredHome 0:198f53da1bc8 95 typedef enum
WiredHome 0:198f53da1bc8 96 {
WiredHome 4:283e35536097 97 runexit, ///< use this return value to cause the menu (perhaps the program) to exit
WiredHome 4:283e35536097 98 runok ///< use this return value to keep the menu running
WiredHome 0:198f53da1bc8 99 } RUNRESULT_T;
WiredHome 0:198f53da1bc8 100
WiredHome 0:198f53da1bc8 101 /// Adding items to the menu can succeed, or fail.
WiredHome 0:198f53da1bc8 102 typedef enum
WiredHome 0:198f53da1bc8 103 {
WiredHome 4:283e35536097 104 addfailed, ///< this indicates the menu was not added (usually failure to allocate memory)
WiredHome 4:283e35536097 105 addok ///< this indicates the menu was successfully added
WiredHome 0:198f53da1bc8 106 } ADDRESULT_T;
WiredHome 0:198f53da1bc8 107
WiredHome 0:198f53da1bc8 108 /// Initialization can succeed, or fail.
WiredHome 0:198f53da1bc8 109 typedef enum
WiredHome 0:198f53da1bc8 110 {
WiredHome 4:283e35536097 111 initfailed, ///< this indicates that the menu system was not initialized (usually failure to allocate memory)
WiredHome 4:283e35536097 112 initok ///< this indicates that the menu system was successfully initialized
WiredHome 0:198f53da1bc8 113 } INITRESULT_T;
WiredHome 0:198f53da1bc8 114
WiredHome 0:198f53da1bc8 115 /// This is the type for the basic callback, when a menu pick is activated.
WiredHome 0:198f53da1bc8 116 ///
WiredHome 0:198f53da1bc8 117 /// The callback function is executed when a command is entered on the menu and \<enter\>
WiredHome 0:198f53da1bc8 118 /// is signaled. If there is any additional text entered on the commandline, it is
WiredHome 0:198f53da1bc8 119 /// passed to the callback.
WiredHome 0:198f53da1bc8 120 ///
WiredHome 0:198f53da1bc8 121 /// example:
WiredHome 4:283e35536097 122 /// "Test1 ab c 123 567"
WiredHome 0:198f53da1bc8 123 /// If "Test1" is a valid command, the corresponding function would be called
WiredHome 4:283e35536097 124 /// passing to that function the string "ab c 123 567". Note that the delimiter space
WiredHome 0:198f53da1bc8 125 /// was removed.
WiredHome 0:198f53da1bc8 126 ///
WiredHome 4:283e35536097 127 /// @param p is a pointer to a character string
WiredHome 4:283e35536097 128 /// @returns RUNRESULT_T to indicate if the CommandProcessor should continue
WiredHome 0:198f53da1bc8 129 ///
WiredHome 0:198f53da1bc8 130 typedef RUNRESULT_T (*MENU_CALLBACK)(char *p);
WiredHome 0:198f53da1bc8 131
WiredHome 0:198f53da1bc8 132 /// This defines the type for a single item to be added to the CommandProcessor menu.
WiredHome 0:198f53da1bc8 133 ///
WiredHome 0:198f53da1bc8 134 /// This is defined in the application code, and a pointer to this item is passed to the
WiredHome 0:198f53da1bc8 135 /// CommandProcessor to add this item to the menu system.
WiredHome 0:198f53da1bc8 136 ///
WiredHome 0:198f53da1bc8 137 /// example:
WiredHome 4:283e35536097 138 /// @code
WiredHome 0:198f53da1bc8 139 /// const CMD_T WhoCmd = {"who", "Shows who is logged on, or 'who id' for specifics", Who, visible};
WiredHome 0:198f53da1bc8 140 /// @endcode
WiredHome 0:198f53da1bc8 141 ///
WiredHome 0:198f53da1bc8 142 typedef const struct
WiredHome 0:198f53da1bc8 143 {
WiredHome 4:283e35536097 144 char * command; ///< a pointer to the command to match (e.g. 'Help')
WiredHome 4:283e35536097 145 char * helptext; ///< a pointer to some text to show when user types 'Help'
WiredHome 4:283e35536097 146 MENU_CALLBACK callback; ///< the function to call when user enters this command
WiredHome 4:283e35536097 147 VISIBLE_T visible; ///< a flag that determines if this command is visible in Help.
WiredHome 0:198f53da1bc8 148 } CMD_T;
WiredHome 0:198f53da1bc8 149
WiredHome 0:198f53da1bc8 150 /// This is the CommandProcessor interface from the user application.
WiredHome 0:198f53da1bc8 151 ///
WiredHome 4:283e35536097 152 /// The user aquires a handle to this set of functions with the GetCommandProcessor command.
WiredHome 0:198f53da1bc8 153 /// After this, the user may then initialize the CommandProcessor, add items to the menu,
WiredHome 0:198f53da1bc8 154 /// cause the CommandProcessor to run periodically, and if need be the application can end
WiredHome 0:198f53da1bc8 155 /// the CommandProcessor.
WiredHome 0:198f53da1bc8 156 ///
WiredHome 0:198f53da1bc8 157 typedef const struct
WiredHome 0:198f53da1bc8 158 {
WiredHome 4:283e35536097 159 /// Init is the first function to call to configure the CommandProcessor.
WiredHome 4:283e35536097 160 ///
WiredHome 4:283e35536097 161 /// This function has a number of parameters, which make the CommandProcessor quite flexible.
WiredHome 4:283e35536097 162 /// The user can enable a default menu, which can consist of the following functions.
WiredHome 4:283e35536097 163 /// Note that when the [bit] is set, that menu item is enabled.
WiredHome 6:1a0512faa75d 164 /// * [3] Help - which in turn will show all the menu items and their brief descriptions
WiredHome 6:1a0512faa75d 165 /// * [2] Echo - which adds the echo command help
WiredHome 4:283e35536097 166 /// * [1] About - just a tiny statement about the CommandProcessor itself
WiredHome 4:283e35536097 167 /// * [0] Exit - a method to permit a consistent means to exit the CommandProcessor
WiredHome 4:283e35536097 168 ///
WiredHome 4:283e35536097 169 /// @param defaultMenu enables various default menu items, based on the bit values.
WiredHome 4:283e35536097 170 /// @param kbhit is a user provided function to detect if a character is available for the CommandProcessor,
WiredHome 4:283e35536097 171 /// and when using standard io, you can typically use kbhit, or _kbhit as your system provides.
WiredHome 4:283e35536097 172 /// @param getch is a user provided function that provides a single character to the CommandProcessor
WiredHome 4:283e35536097 173 /// @param putch is a user provided function that permits the CommandProcessor to output a character
WiredHome 4:283e35536097 174 /// @param puts is a user provided function that permits the CommandProcessor to output a string
WiredHome 4:283e35536097 175 /// to which is automatically appended a \\n
WiredHome 6:1a0512faa75d 176 /// @param caseinsensitive when TRUE, as the name implies, permits "help" and "HeLp" to function the same
WiredHome 6:1a0512faa75d 177 /// @param maxCmdLen sets the memory allocation for the command buffer. This should be sized
WiredHome 6:1a0512faa75d 178 /// to the maximum command, including any passed in text as parameters.
WiredHome 4:283e35536097 179 /// @returns INITRESULT_T to indicate if the init was successful or failed
WiredHome 4:283e35536097 180 INITRESULT_T (*Init)(
WiredHome 4:283e35536097 181 int defaultMenu,
WiredHome 4:283e35536097 182 int caseinsensitive,
WiredHome 6:1a0512faa75d 183 int echo,
WiredHome 6:1a0512faa75d 184 int maxCmdLen,
WiredHome 4:283e35536097 185 int (*kbhit)(void),
WiredHome 4:283e35536097 186 int (*getch)(void),
WiredHome 4:283e35536097 187 int (*putch)(int ch),
WiredHome 4:283e35536097 188 int (*puts)(const char * s)
WiredHome 4:283e35536097 189 );
WiredHome 0:198f53da1bc8 190
WiredHome 4:283e35536097 191 /// Add is called to add an item to the CommandProcessor menu
WiredHome 4:283e35536097 192 ///
WiredHome 4:283e35536097 193 /// This passes in a reference to a user provided CMD_T item, which is
WiredHome 4:283e35536097 194 /// added to the menu system.
WiredHome 4:283e35536097 195 ///
WiredHome 6:1a0512faa75d 196 /// @param m is a pointer to the user provided menu
WiredHome 6:1a0512faa75d 197 /// @returns ADDRESULT_T to indicate if the add was successful or failed
WiredHome 4:283e35536097 198 ///
WiredHome 4:283e35536097 199 ADDRESULT_T (*Add)(CMD_T * m);
WiredHome 0:198f53da1bc8 200
WiredHome 4:283e35536097 201 /// Run is the primary runtime entry point for the CommandProcessor.
WiredHome 4:283e35536097 202 ///
WiredHome 4:283e35536097 203 /// This function should be called periodically - fast enough not to miss user input.
WiredHome 4:283e35536097 204 /// This function always returns, so if not character is available for the CommandProcessor
WiredHome 4:283e35536097 205 /// it will return very fast. If there is a character (as detected by the kbhit callback),
WiredHome 4:283e35536097 206 /// then it will process that character and determine what to do. It may then execute one
WiredHome 4:283e35536097 207 /// of the menu functions. In this case, CPU cycles spent are based on the function
WiredHome 4:283e35536097 208 /// being executed.
WiredHome 4:283e35536097 209 ///
WiredHome 4:283e35536097 210 /// @returns RUNRESULT_T to indicate if the CommandProcessor should remain active or if the
WiredHome 4:283e35536097 211 /// command that was executed is requesting the CommandProcessor to exit.
WiredHome 4:283e35536097 212 ///
WiredHome 4:283e35536097 213 RUNRESULT_T (*Run)(void);
WiredHome 6:1a0512faa75d 214
WiredHome 6:1a0512faa75d 215 /// Echo command permits turning the echo on and off
WiredHome 6:1a0512faa75d 216 ///
WiredHome 6:1a0512faa75d 217 /// When interactive with the user, it is best to have echo on, so they can see
WiredHome 6:1a0512faa75d 218 /// the prompt, but if this is simply slaved to another program, then the echo
WiredHome 6:1a0512faa75d 219 /// might need to be off to best manage the stream.
WiredHome 6:1a0512faa75d 220 ///
WiredHome 6:1a0512faa75d 221 /// @param echo turns the echo on (non-zero) or off (zero)
WiredHome 6:1a0512faa75d 222 /// @returns RUNRESULT_T to indicate if the CommandProcessor should remain active or if the
WiredHome 6:1a0512faa75d 223 /// command that was executed is requesting the CommandProcessor to exit.
WiredHome 6:1a0512faa75d 224 ///
WiredHome 6:1a0512faa75d 225 RUNRESULT_T (*Echo)(int echo);
WiredHome 0:198f53da1bc8 226
WiredHome 4:283e35536097 227 /// End if the function to be called when you want to gracefully end the CommandProcessor.
WiredHome 4:283e35536097 228 ///
WiredHome 4:283e35536097 229 /// Calling this function causes the CommandProcessor to free any memory that was previously
WiredHome 4:283e35536097 230 /// allocated by the Init and Add functions.
WiredHome 4:283e35536097 231 RUNRESULT_T (*End)(void); ///< Called to shutdown the processor
WiredHome 0:198f53da1bc8 232 } CMDP_T;
WiredHome 0:198f53da1bc8 233
WiredHome 3:7c9993cac92b 234
WiredHome 3:7c9993cac92b 235 /// The CommandProcessor is the interface to install a run-time menu into an embedded system.
WiredHome 3:7c9993cac92b 236 /// This contains the complete interface to the CommandProcessor.
WiredHome 3:7c9993cac92b 237 ///
WiredHome 3:7c9993cac92b 238 /// @version 1.0
WiredHome 3:7c9993cac92b 239 ///
WiredHome 3:7c9993cac92b 240 /// @note The CommandProcessor is text-based, because it is intended to interact with a
WiredHome 3:7c9993cac92b 241 /// user.
WiredHome 3:7c9993cac92b 242 ///
WiredHome 3:7c9993cac92b 243 /// The menu is designed to be interactively accessed, perhaps via a console interface
WiredHome 3:7c9993cac92b 244 /// or a serial port. The actual interface to the user is provided by the application
WiredHome 3:7c9993cac92b 245 /// during initialization, so it can be connected to a serial port, or it could
WiredHome 3:7c9993cac92b 246 /// be interface to CAN, telnet, or by some other method.
WiredHome 3:7c9993cac92b 247 ///
WiredHome 3:7c9993cac92b 248 /// The CommandProcessor has a few special features:
WiredHome 3:7c9993cac92b 249 /// \li If the minimum number of characters of a command have been entered, the
WiredHome 3:7c9993cac92b 250 /// user does not have to type the entire command. (e.g. 'He' will execute
WiredHome 3:7c9993cac92b 251 /// the command for 'Help', if no other command beings with 'He').
WiredHome 3:7c9993cac92b 252 /// \li If the user does not type the entire set of characters, the command
WiredHome 3:7c9993cac92b 253 /// will be rewritten to the output device with the entire command word.
WiredHome 3:7c9993cac92b 254 /// \li The user is not permitted to enter an incorrect command (e.g. If 'Help'
WiredHome 3:7c9993cac92b 255 /// is the only command started with 'Hel', the user cannot enter 'Heu'.
WiredHome 3:7c9993cac92b 256 /// The CommandProcessor will trap the 'u' and issue a beep).
WiredHome 3:7c9993cac92b 257 /// \li Simple editing of parameters to commands is permitted with \<bs\> to
WiredHome 3:7c9993cac92b 258 /// erase incorrect text.
WiredHome 3:7c9993cac92b 259 /// \li Tab completion of a command is available - so long as the user has
WiredHome 4:283e35536097 260 /// typed at least the minimum number of unique characters. (e.g. 'He\<tab\>'
WiredHome 3:7c9993cac92b 261 /// will be replaced with 'Help')
WiredHome 4:283e35536097 262 /// \li Command cancellation is available - just enter the \<esc\> key and
WiredHome 3:7c9993cac92b 263 /// the buffer is erased.
WiredHome 3:7c9993cac92b 264 /// \li The user is not permitted to enter text longer than the defined buffer,
WiredHome 3:7c9993cac92b 265 /// to avoid buffer overrun and the possible memory damaging results.
WiredHome 3:7c9993cac92b 266 ///
WiredHome 3:7c9993cac92b 267 /// The CommandProcessor is designed as a set of C functions, which makes it
WiredHome 3:7c9993cac92b 268 /// reusable in more systems (as C++ compilers are not always available for
WiredHome 3:7c9993cac92b 269 /// all micros).
WiredHome 3:7c9993cac92b 270 ///
WiredHome 3:7c9993cac92b 271 /// Example:
WiredHome 3:7c9993cac92b 272 /// @code
WiredHome 3:7c9993cac92b 273 /// extern "C" {
WiredHome 3:7c9993cac92b 274 /// #include "CommandProcessor.h"
WiredHome 3:7c9993cac92b 275 /// }
WiredHome 3:7c9993cac92b 276 ///
WiredHome 3:7c9993cac92b 277 /// RUNRESULT_T Who(char *p);
WiredHome 3:7c9993cac92b 278 /// const CMD_T WhoCmd = {"who", "Shows who is logged on, or 'who id' for specifics", Who, visible};
WiredHome 3:7c9993cac92b 279 ///
WiredHome 3:7c9993cac92b 280 /// RUNRESULT_T Who(char *p)
WiredHome 3:7c9993cac92b 281 /// {
WiredHome 4:283e35536097 282 /// printf("\r\nwho...\r\n");
WiredHome 4:283e35536097 283 /// if (*p)
WiredHome 4:283e35536097 284 /// printf(" Sorry, no help for [%s]\r\n", p);
WiredHome 4:283e35536097 285 /// return runok;
WiredHome 3:7c9993cac92b 286 /// }
WiredHome 3:7c9993cac92b 287 ///
WiredHome 3:7c9993cac92b 288 /// int main(int argc, char* argv[])
WiredHome 3:7c9993cac92b 289 /// {
WiredHome 4:283e35536097 290 /// CMDP_T * cp = GetCommandProcessor();
WiredHome 4:283e35536097 291 /// cp->Init(7, TRUE, 50, _kbhit, _getch, _putch, printf);
WiredHome 4:283e35536097 292 /// cp->Add(&WhoCmd);
WiredHome 3:7c9993cac92b 293 ///
WiredHome 4:283e35536097 294 /// while (cp->Run())
WiredHome 4:283e35536097 295 /// {
WiredHome 4:283e35536097 296 /// ;
WiredHome 4:283e35536097 297 /// }
WiredHome 4:283e35536097 298 /// cp->End();
WiredHome 4:283e35536097 299 /// return 0;
WiredHome 3:7c9993cac92b 300 /// }
WiredHome 3:7c9993cac92b 301 /// @endcode
WiredHome 3:7c9993cac92b 302 ///
WiredHome 3:7c9993cac92b 303 /// @note Copyright &copy; 2011 by Smartware Computing, all rights reserved.
WiredHome 3:7c9993cac92b 304 /// This program may be used by others as long as this copyright notice
WiredHome 3:7c9993cac92b 305 /// remains intact.
WiredHome 3:7c9993cac92b 306 /// @author David Smart
WiredHome 3:7c9993cac92b 307 ///
WiredHome 0:198f53da1bc8 308 /// GetCommandProcessor is called to get a handle to the CommandProcessor itself.
WiredHome 0:198f53da1bc8 309 ///
WiredHome 0:198f53da1bc8 310 /// Call this function to get a handle to the CommandProcessor. After this is done, then
WiredHome 0:198f53da1bc8 311 /// you can use that handle to activate the CommandProcessor methods.
WiredHome 0:198f53da1bc8 312 ///
WiredHome 0:198f53da1bc8 313 /// example:
WiredHome 0:198f53da1bc8 314 /// @code
WiredHome 4:283e35536097 315 /// CMDP_T * cp = GetCommandProcessor();
WiredHome 4:283e35536097 316 /// cp->Init(7, TRUE, 50, _kbhit, _getch, _putch, printf);
WiredHome 0:198f53da1bc8 317 /// @endcode
WiredHome 0:198f53da1bc8 318 ///
WiredHome 1:1c81feb2f8bd 319 /// @returns CMDP_T a handle to the CommandProcessor
WiredHome 0:198f53da1bc8 320 ///
WiredHome 0:198f53da1bc8 321 #ifdef WIN32
WiredHome 0:198f53da1bc8 322 CMDP_T * GetCommandProcessor(void);
WiredHome 0:198f53da1bc8 323 #else // This is necessary for the mbed - not sure why.
WiredHome 0:198f53da1bc8 324 extern "C" CMDP_T * GetCommandProcessor(void);
WiredHome 0:198f53da1bc8 325 #endif
WiredHome 0:198f53da1bc8 326
WiredHome 4:283e35536097 327
WiredHome 4:283e35536097 328
WiredHome 4:283e35536097 329 int mystrnicmp(const char *l, const char *r, size_t n);
WiredHome 1:1c81feb2f8bd 330 #endif // COMMANDPROCESSOR_H