CmpPlcShell Library Documentation ¶ Company 3S - Smart Software Solutions GmbH Title CmpPlcShell Version 3.5.17.0 Categories System|SysLibs Namespace SHELL Author 3S - Smart Software Solutions GmbH Placeholder CmpPlcShell Description 1 ¶ This library can be used to implement own Commands for the PlcShell. Contents: ¶ CommandHandler (FunctionBlock) CommandHandler (Method) EventCallback (Method) FB_exit (Method) FB_init (Method) Register (Method) EVTPARAM_PlcShellCommand (Struct) PlcShellAppend (Function) PlcShellRegister (Function) PlcShellSetEof (Function) PlcShellSkip (Function) PlcShellUnregister (Function) Indices and tables ¶ 1 Based on CmpPlcShell.library, last modified 20.04.2021, 15:54:06. LibDoc 4.4.0.0-b.27 The content file CmpPlcShell.clean.json was generated with CODESYS V3.5 SP16 Patch 3 on 20.04.2021, 15:54:06.
CommandHandler.CommandHandler (METH) ¶ METHOD CommandHandler : UDINT InOut: Scope Name Type Return CommandHandler UDINT Input pszArguments REFERENCE TO STRING diBlockID DINT udiBlockSize UDINT
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. Methods: CommandHandler EventCallback FB_exit FB_init Register Structure: CommandHandler (Method) EventCallback (Method) FB_exit (Method) FB_init (Method) Register (Method)
CommandHandler.EventCallback (METH) ¶ METHOD EventCallback : UDINT InOut: Scope Name Type Return EventCallback UDINT Input pEventParam POINTER TO EventParam
CommandHandler.FB_exit (METH) ¶ METHOD FB_exit InOut: Scope Name Type Input bInCopyCode BOOL
CommandHandler.FB_init (METH) ¶ METHOD FB_init InOut: Scope Name Type Input bInitRetains BOOL bInCopyCode BOOL
CommandHandler.Register (METH) ¶ METHOD Register InOut: Scope Name Type Input pszCommand REFERENCE TO STRING pszHelp REFERENCE TO STRING
EVTPARAM_PlcShellCommand (STRUCT) ¶ TYPE EVTPARAM_PlcShellCommand : STRUCT Event Parameter, passed to the Command Handler</b> The Command Handlers are called, using the event interface of the EventMgr. These are the parameters that are passed to the event. To get the parameters, you need to cast the element “pParameter” from the “pEventParam”, that is passed to the EventCallback. METHOD EventCallback : UDINT VAR_INPUT pEventParam : POINTER TO EventParam; END_VAR pParam := pEventParam^.pParameter; InOut: Name Type pszCommand REFERENCE TO STRING pszArguments REFERENCE TO STRING diBlockID DINT udiBlockSize UDINT
PlcShellAppend (FUN) ¶ FUNCTION PlcShellAppend : RTS_IEC_RESULT Append a line to the command output The passed parameter iBlockID, has TO be the BlockID, which was passed to the command handler! The communication layer automatically manages the split of blocks. If you want to avoid this and write only the current block that is sent to CoDeSys, use the function PlcShellSkip(). RETURN: Returns the runtime system error code (see CmpErrors.library) InOut: Scope Name Type Return PlcShellAppend RTS_IEC_RESULT Input pszString REFERENCE TO STRING iBlockID DINT
PlcShellRegister (FUN) ¶ FUNCTION PlcShellRegister : RTS_IEC_RESULT Register a new Command Handler The command is sent TO the handler as an event OF the EventMgr. So the CommandHandler needs to implement the Interface ICmpEventCallback. Note: For the ease of use, you can also derive your Command Handler from the FB “CommandHandler” in this library. This helps you in the registration and deregistration of the handler. RETURN: Returns the runtime system error code (see CmpErrors.library) InOut: Scope Name Type Return PlcShellRegister RTS_IEC_RESULT Input pszName REFERENCE TO STRING pszHelp REFERENCE TO STRING pICallback ICmpEventCallback