API Broadcast - Krystian-L-Lis/Stage GitHub Wiki

#API #Broadcast

Parameters

SIGNAL_CAP

Type: UDINT(1..16#7FFFFFFF)
Description:
Max number of signals.


RECEIVER_CAP

Type: UDINT(1..16#7FFFFFFF)
Description:
Max number of signal-receiver pairings.


GetReceiver

Type: Function
Description:
Searches an I_Entity for an I_Receiver component matching the provided tag pattern.
Results:

  • Ok – Returns I_Receiver.
  • Err.NotFound – Returns null.
  • Err.InvRef – Returns null.
  • Err.Itf0 – Returns null.

Signature:

FUNCTION GetReceiver : Result  
VAR_INPUT  
    iEntity : I_Entity;  
    sTagId  : Str;  
    iOut    : REFERENCE TO I_Receiver;
END_VAR  

GetSignal

Type: Function
Description:
Searches an I_Entity for an I_Signal component matching the provided tag pattern.
Results:

  • Ok – Returns I_Signal.
  • Err.NotFound – Returns null.
  • Err.InvRef – Returns null.
  • Err.Itf0 – Returns null (incorrect interface).

Signature:

FUNCTION GetSignal : Result  
VAR_INPUT  
    iEntity : I_Entity;  
    sTagId  : Str;  
    iOut    : REFERENCE TO I_Signal;
END_VAR  

ICompToIRec

Type: Function
Description:
Casts an I_Component to an I_Receiver.
Results:

  • Ok – Cast successful.
  • Err.Itf0iSource = 0.
  • Err.NoMatch – Cast failed; returns null.

Signature:

FUNCTION ICompToIRec : Result  
VAR_INPUT  
    iIn  : I_Component;  
    iOut : REFERENCE TO I_Receiver;  
END_VAR  

ICompToISignal

Type: Function
Description:
Casts an I_Component to an I_Signal.
Results:

  • Ok – Cast successful.
  • Err.Itf0iSource = 0.
  • Err.NoMatch – Cast failed; returns null.

Signature:

FUNCTION ICompToISignal : Result  
VAR_INPUT  
    iIn  : I_Component;  
    iOut : REFERENCE TO I_Signal;  
END_VAR  

IArgAsIComp

Type: Function
Description:
Casts I_Arg to I_Component.
Results:

  • Ok – Cast successful.
  • Err.Itf0iSource is null.
  • Err.NoMatch – Cast failed; returns null.

Signature:

FUNCTION IArgAsIComp : Result  
VAR_INPUT  
    iIn  : I_Arg;  
    iOut : REFERENCE TO I_Component;  
END_VAR  

ICompToIArg

Type: Function
Description:
Casts I_Component to I_Arg.
Results:

  • Ok – Cast successful.
  • Err.Itf0iSource is null.
  • Err.NoMatch – Cast failed; returns null.

Signature:

FUNCTION ICompToIArg : Result  
VAR_INPUT  
    iIn  : I_Component;  
    iOut : REFERENCE TO I_Arg;  
END_VAR  

IArgToIRealtArg

Type: Function
Description:
Casts I_Arg as I_RealArg.
Results:

  • Ok – Successful cast.
  • None – Cast failed; returns null.

Signature:

FUNCTION IArgToIRealtArg : Result  
VAR_INPUT  
    iIn  : I_Arg;  
    iOut : REFERENCE TO I_RealArg;  
END_VAR  

IArgToIDwordArg

Type: Function
Description:
Casts I_Arg as I_DwordArg.
Results:

  • Ok – Successful cast.
  • Error – Cast failed; returns null.

Signature:

FUNCTION IArgToIDwordArg : Result  
VAR_INPUT  
    iIn  : I_Arg;  
    iOut : REFERENCE TO I_DwordArg;  
END_VAR  

IArgToIBoolArg

Type: Function
Description:
Casts I_Arg as I_BoolArg.
Results:

  • Ok – Successful cast.
  • None – Cast failed; returns null.

Signature:

FUNCTION IArgToIBoolArg : Result  
VAR_INPUT  
    iIn  : I_Arg;  
    iOut : REFERENCE TO I_BoolArg;  
END_VAR  

I_Receiver

Type: Interface
Extends: I_RawComponent
Description:
Represents a pairable receiver in the broadcast system.

Members

Tag

Type: Property
Accessors: Get
Description:
Returns the tag associated with this signal. Signature: PROPERTY Tag : I_Tag


I_Signal

Type: Interface
Extends: I_RawComponent
Description:
Enables pairing with receivers and casting to I_Component. Does not allow emitting.

Members

Pair

Type: Method
Description:
Pairs the signal with a receiver.
Results:

  • Ok – Pairing successful.
  • Err.Itf0 – Invalid receiver interface.
  • Err.IncArg – Invalid I_Receiver.
  • Err.ItfEq – Receiver already paired with this signal.
  • Err.Ovf – Maximum pairings reached.

Signature:

METHOD Pair : Result  
VAR_INPUT  
    iReceiver : I_Receiver;  
END_VAR  

Unpair

Type: Method
Description:
Unpairs the signal from the specified receiver.
Results:

  • Ok – Unpairing successful.
  • Err.Itf0 – Invalid receiver interface.
  • Err.IncArg – Invalid I_Receiver.
  • Err.NoMatch – Not paired with the given receiver.

Signature:

METHOD Unpair : Result  
VAR_INPUT  
    iReceiver : I_Receiver;  
END_VAR  

I_SignalEmit

Type: Interface
Description:
Enables pairing with receivers and emitting. Does not support casting to I_Component.

Members

Emit

Type: Method
Description:
Emits an argument through the broadcast system. Defaults to the associated tag if no argument is provided.
Results:

  • Ok – Emission successful.
  • Err.InfLoop – Infinite loop detected.

Signature:

METHOD Emit : Result  
VAR_INPUT  
    iArg : I_Arg := 0;  
END_VAR  

EmitTo

Type: Method
Description:
Emits an argument to the specified receiver.
Results:

  • Ok – Emission successful.
  • Err.Itf0 – Invalid receiver interface.
  • Err.InfLoop – Infinite loop detected.

Signature:

METHOD EmitTo : Result  
VAR_INPUT  
    iReceiver : I_Receiver;  
    iArg      : I_Arg := 0;  
END_VAR  

Option

Type: Property
Accessors: Get, Set
Description:
Provides access to the Tag.Option property of the internal tag.
Signature:

METHOD Option : Str  
VAR_INPUT  
    sOption : Str;  
END_VAR  

Tag

Type: Property
Accessors: Get
Description:
Returns the tag associated with this signal.
Signature:

PROPERTY Tag : I_Tag  

Pair

Type: Method
Description:
Pairs the signal with a receiver.
Results:

  • Ok – Pairing successful.
  • Err.Itf0 – Invalid receiver interface.
  • Err.IncArg – Invalid I_Receiver.
  • Err.ItfEq – Receiver already paired with this signal.
  • Err.Ovf – Maximum pairings reached.

Signature:

METHOD Pair : Result  
VAR_INPUT  
    iReceiver : I_Receiver;  
END_VAR  

Unpair

Type: Method
Description:
Unpairs the signal from the specified receiver.
Results:

  • Ok – Unpairing successful.
  • Err.Itf0 – Invalid receiver interface.
  • Err.IncArg – Invalid I_Receiver.
  • Err.NoMatch – Not paired with the given receiver.

Signature:

METHOD Unpair : Result  
VAR_INPUT  
    iReceiver : I_Receiver;  
END_VAR  

Receiver

Type: Function Block
Implements: I_Callable, I_Receiver
Description:
Represents a receiver in the broadcast system.

Members

FB_Init

Type: Method
Description:
Initializes the receiver.
Signature:

METHOD FB_Init : BOOL  
VAR_INPUT  
    bInitRetains : BOOL;  
    bInCopyCode  : BOOL;  
    iCallable    : I_Callable;  
END_VAR  

Callable

Type: Property
Accessors: Get, Set
Description:
A reference to an I_Callable object that will be invoked when a signal is received. By default, this property is set to THIS^.
Signature: PROPERTY FINAL Callable : I_Callable


Call

Type: Method
From: I_Callable
Description:
Executes the object using the provided input. The Call method is typically implemented to perform an operation using the input argument passed via iArg.
Signature:

METHOD Call  
VAR_INPUT  
    iArg : I_Arg;  
END_VAR  

Tag

Type: Property
Accessors: Get
From: I_Receiver
Description:
Returns the associated tag.
Signature:

PROPERTY Tag : I_Tag  

Signal

Type: Function Block
Implements: I_Signal, I_SignalEmit
Description:
A signal node for event broadcasting. Supports emission and receiver pairing.

Members

Proxy

Type: Property
Accessors: Get, Set
Description:
Provides a reference to the instance as an I_SignalEmit.
Signature:

PROPERTY Proxy : REFERENCE TO I_SignalEmit  

Example:

iSignal: I_SignalEmit;  
signal: Signal := (Proxy := iSignal);  
// Result: iSignal <> 0  

Emit

Type: Method
From: I_SignalEmit
Description:
Emits an argument through the broadcast system. Defaults to the associated tag if no argument is provided.
Results:

  • Ok – Emission successful.
  • Err.InfLoop – Infinite loop detected.

Signature:

METHOD Emit : Result  
VAR_INPUT  
    iArg : I_Arg := 0;  
END_VAR  

EmitTo

Type: Method
From: I_SignalEmit
Description:
Emits an argument to the specified receiver.
Results:

  • Ok – Emission successful.
  • Err.Itf0 – Invalid receiver interface.
  • Err.InfLoop – Infinite loop detected.

Signature:

METHOD EmitTo : Result  
VAR_INPUT  
    iReceiver : I_Receiver;  
    iArg      : I_Arg := 0;  
END_VAR  

Option

Type: Property
Accessors: Get, Set
From: I_SignalEmit
Description:
Provides access to the Tag.Option property of the internal tag.
Signature:

METHOD Option : Str  
VAR_INPUT  
    sOption : Str;  
END_VAR  

Tag

Type: Property
Accessors: Get
From: I_Signal, I_SignalEmit
Description:
Returns the tag associated with this signal.
Signature:

PROPERTY Tag : I_Tag  

Pair

Type: Method
From: I_Signal, I_SignalEmit
Description:
Pairs the signal with a receiver.
Results:

  • Ok – Pairing successful.
  • Err.Itf0 – Invalid receiver interface.
  • Err.IncArg – Invalid I_Receiver.
  • Err.ItfEq – Receiver already paired with this signal.
  • Err.Ovf – Maximum pairings reached.

Signature:

METHOD Pair : Result  
VAR_INPUT  
    iReceiver : I_Receiver;  
END_VAR  

Unpair

Type: Method
From: I_Signal, I_SignalEmit
Description:
Unpairs the signal from the specified receiver.
Results:

  • Ok – Unpairing successful.
  • Err.Itf0 – Invalid receiver interface.
  • Err.IncArg – Invalid I_Receiver.
  • Err.NoMatch – Not paired with the given receiver.

Signature:

METHOD Unpair : Result  
VAR_INPUT  
    iReceiver : I_Receiver;  
END_VAR  

I_Callable

Type: Interface
From: I_Debug
Description:
Represents an object that can be invoked or executed through the system. This interface defines a contract for any object that supports being "called" with specific input arguments.

Members

Call

Type: Method
Description:
Executes the object using the provided input. The Call method is typically implemented to perform an operation using the input argument passed via iArg.
Signature:

METHOD Call  
VAR_INPUT  
    iArg : I_Arg;  
END_VAR  

I_Arg

Type: Interface
Extends: I_Debug, __System.IQueryInterface
Description:
Alias for __System.IQueryInterface. It can be cast to other interfaces.


I_RealArg

Type: Interface
Extends: I_Arg
Description:
A broadcastable wrapper for a REAL value.

Members

Get

Type: Property
Accessors: Get
Description:
Reads the internal value.
Signature:

PROPERTY Get : REAL  

IsMut

Type: Property
Accessors: Get
Description:
Returns TRUE if the value is mutable.
Signature:

PROPERTY IsMut : BOOL  

Set

Type: Method
Description:
Modifies the internal value.
Results:

  • Ok – Modification successful.
  • Error – Mutability is disabled.

Signature:

METHOD Set : Result  
VAR_INPUT  
    newVal : REAL;  
END_VAR  

RealArg

Type: Function Block
Implements: I_RealArg
Description:
A broadcastable wrapper for a REAL value.

Members

AllowMut

Type: Method
Description:
Enables external modification of the internal value.
Signature:

METHOD AllowMut  

BlockMut

Type: Method
Description:
Disables external modification of the internal value.
Signature:

METHOD BlockMut  

OpSet

Type: Method
Description:
Directly modifies the internal value, bypassing any mutability restrictions.
Signature:

METHOD OpSet : I_Arg  
VAR_INPUT  
    newVal : REAL;  
END_VAR  

Get

Type: Property
Accessors: Get
From: I_RealArg
Description:
Reads the internal value.
Signature:

PROPERTY Get : REAL  

IsMut

Type: Property
Accessors: Get
From: I_RealArg
Description:
Returns TRUE if the value is mutable.
Signature:

PROPERTY IsMut : BOOL  

Set

Type: Method
From: I_RealArg
Description:
Modifies the internal value.
Results:

  • Ok – Modification successful.
  • Error – Mutability is disabled.

Signature:

METHOD Set : Result  
VAR_INPUT  
    newVal : REAL;  
END_VAR  

I_DwordArg

Type: Interface
Extends: I_Arg
Description:
A broadcastable wrapper for a DWORD value.

Members

Get

Type: Property
Accessors: Get
Description:
Reads the internal value.
Signature:

PROPERTY Get : DWORD  

IsMut

Type: Property
Accessors: Get
Description:
Returns TRUE if the value is mutable.
Signature:

PROPERTY IsMut : BOOL  

Set

Type: Method
Description:
Modifies the internal value.
Results:

  • Ok – Modification successful.
  • Error – Mutability is disabled.

Signature:

METHOD Set : Result  
VAR_INPUT  
    newVal : DWORD;  
END_VAR  

DwordArg

Type: Function Block
Implements: I_DwordArg
Description:
A broadcastable wrapper for a DWORD value.

Members

AllowMut

Type: Method
Description:
Enables external modification of the internal value.
Signature:

METHOD AllowMut  

BlockMut

Type: Method
Description:
Disables external modification of the internal value.
Signature:

METHOD BlockMut  

OpSet

Type: Method
Description:
Directly modifies the internal value, bypassing any mutability restrictions.
Signature:

METHOD OpSet : I_Arg  
VAR_INPUT  
    newVal : DWORD;  
END_VAR  

Get

Type: Property
Accessors: Get
From: I_DwordArg
Description:
Reads the internal value.
Signature:

PROPERTY Get : DWORD  

IsMut

Type: Property
Accessors: Get
From: I_DwordArg
Description:
Returns TRUE if the value is mutable.
Signature:

PROPERTY IsMut : BOOL  

Set

Type: Method
From: I_DwordArg
Description:
Modifies the internal value.
Results:

  • Ok – Modification successful.
  • Error – Mutability is disabled.

Signature:

METHOD Set : Result  
VAR_INPUT  
    newVal : DWORD;  
END_VAR  

I_BoolArg

Type: Interface
Extends: I_Arg
Description:
A broadcastable wrapper for a BOOL value.

Members

Get

Type: Property
Accessors: Get
Description:
Reads the internal value.
Signature:

PROPERTY Get : BOOL  

IsMut

Type: Property
Accessors: Get
Description:
Returns TRUE if the value is mutable.
Signature:

PROPERTY IsMut : BOOL  

Set

Type: Method
Description:
Modifies the internal value.
Results:

  • Ok – Modification successful.
  • Error – Mutability is disabled.

Signature:

METHOD Set : Result  
VAR_INPUT  
    newVal : BOOL;  
END_VAR  

BoolArg

Type: Function Block
Implements: I_BoolArg
Description:
A broadcastable wrapper for a BOOL value.

Members

AllowMut

Type: Method
Description:
Enables external modification of the internal value.
Signature:

METHOD AllowMut  

BlockMut

Type: Method
Description:
Disables external modification of the internal value. Signature:

METHOD BlockMut  

OpSet

Type: Method
Description:
Directly modifies the internal value, bypassing any mutability restrictions.
Signature:

METHOD OpSet : I_Arg  
VAR_INPUT  
    newVal : BOOL;  
END_VAR  

Get

Type: Property
Accessors: Get
From: I_BoolArg
Description:
Reads the internal value.
Signature:

PROPERTY Get : BOOL  

IsMut

Type: Property
Accessors: Get
From: I_BoolArg
Description:
Returns TRUE if the value is mutable.
Signature:

PROPERTY IsMut : BOOL  

Set

Type: Method
From: I_BoolArg
Description:
Modifies the internal value.
Results:

  • Ok – Modification successful.
  • Error – Mutability is disabled.

Signature:

METHOD Set : Result  
VAR_INPUT  
    newVal : BOOL;  
END_VAR  

⚠️ **GitHub.com Fallback** ⚠️