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
PlcShellSetEof (FUN) ¶ FUNCTION PlcShellSetEof : RTS_IEC_RESULT Set EOF This function should be called when the Command Handler is finished with it’s output. RETURN: Returns the runtime system error code (see CmpErrors.library) InOut: Scope Name Type Return PlcShellSetEof RTS_IEC_RESULT
PlcShellSkip (FUN) ¶ FUNCTION PlcShellSkip : RTS_IEC_RESULT Skip a number of blocks in the output. If a Command Handler sends a huge amount of output, it might be necessary, that this output is splitted into several blocks by the communication layer. When this happens, the communication layer will discard everything, but the current block from the output and recall the Command Handler several times. To avoid this, an intelligent Command Handler can generate only the currently necessary block of output. For this, it needs to “skip” all blocks, which are already sent, by calling this function. Then it should write only that much data, that they fit into one block and call PlcShellSetEof() when it is finished. RETURN: Returns the runtime system error code (see CmpErrors.library) InOut: Scope Name Type Return PlcShellSkip RTS_IEC_RESULT Input iBlockID DINT
PlcShellUnregister (FUN) ¶ FUNCTION PlcShellUnregister : RTS_IEC_RESULT Unregister a new Command Handler Unregister the command handler, which is passed to this function. Most likely this function will be used in FB_exit, because every Command Handler in IEC has to unregister when the application is deleted. RETURN: Returns the runtime system error code (see CmpErrors.library) InOut: Scope Name Type Return PlcShellUnregister RTS_IEC_RESULT Input pICallback ICmpEventCallback