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

Dependents:   A_CANAdapter USB2I2C

Committer:
WiredHome
Date:
Sun Apr 10 19:42:08 2011 +0000
Revision:
8:25581f24f7f9
Parent:
7:0f058d664b21
Child:
10:9e52bd1a4a71
hide the mystrnicmp function, which will show up in another utility lib

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