CommandHandler (FB)

FUNCTION_BLOCK CommandHandler IMPLEMENTS ICmpEventCallback

Command Handler for the PLCShell. This function block can be used as a base to register custom Command Handlers in the PLCShell. To implement a new Command Handler, just:

  • extend this function block</li>

  • Call SUPER^.Register() on FB_init</li>

  • Overload CommandHandler() with your own command</li>

An example in Pseudocode:

FUNCTION BLOCK MyCommandHandler EXTENDS CommandHandler

METHOD CommandHandler PlcShellAppend(‘The output of my command’, iBlockID);

METHOD FB_init SUPER^.Register(‘myCmd’, ‘myCmd$r$n$tmyHelp’);

METHOD FB_exit

The registration is done in the function Register() and the deregistration is done in the FB_exit of the base FB.