Skip to main content

TcMessage

Short summary

This class is a concrete CNM message implementation that uses the TwinCAT event logger classes. Messages can only be thrown and don't need to be cleared explicitly.

AccessAbstractFinalExtendsImplements
NoYesAbstractMessage-

UML Diagram

Parameters

none

Properties

arguments

Type: Tc3_EventLogger.I_TcArguments

This property returns an interface pointer that defines methods for the argument handling.

className

Type: CNM_MessageInterfaces.CNM_AbstractObject.ClassName

This abstract property returns the class name of the concrete object,

id

Type: DINT

This property returns the ID of the event.

messageServiceProvider

Type: CNM_MessageInterfaces.IMessageServiceProvider

This property returns the messageServiceProvider of the concrete class.

source

Type: Tc2_System.T_MaxString

This property returns the source of the event. The SourceInfo is generated internally as standard behavior.

state

Type: CNM_MessageInterfaces.MessageConfirmationState

This property contains the state of the alarm.

stopCategory

Type: CNM_MessageInterfaces.AlarmStopCategory

This property contains the stop catagory of the alarm.

Methods

FB_Exit

  • Parameters:
    • bInCopyCode (BOOL): TRUE: the exit method is called in order to leave the instance which will be copied afterwards (online change).
  • Return type: BOOL

FB_Exit must be implemented explicitly. If there is an implementation, then the

FB_init

  • Parameters:
    • bInitRetains (BOOL): if TRUE, the retain variables are initialized (warm start / cold start)
    • bInCopyCode (BOOL): if TRUE, the instance afterwards gets moved into the copy code (online change)
    • event (Global.TcEventEntry)
    • injectedService (CNM_MessageInterfaces.IMessageService)
  • Return type: BOOL

The constructor FB_init is needed to create an unique hash code.

throw

  • Return type: VOID

This method throws/sends the message and sends it to the associated message service to be handled.

Code

Declaration

FUNCTION_BLOCK FINAL TcMessage EXTENDS AbstractMessage
VAR
myMessageServiceProvider :MessageServiceProvider(0);
myMessage :Tc3_EventLogger.FB_TcMessage();
END_VAR