API Broadcast - Krystian-L-Lis/Stage GitHub Wiki
#API #Broadcast
Type: UDINT(1..16#7FFFFFFF)
Description:
Max number of signals.
Type: UDINT(1..16#7FFFFFFF)
Description:
Max number of signal-receiver pairings.
Type: Function
Description:
Searches an I_Entity
for an I_Receiver
component matching the provided tag pattern.
Results:
-
Ok
– ReturnsI_Receiver
. -
Err.NotFound
– Returnsnull
. -
Err.InvRef
– Returnsnull
. -
Err.Itf0
– Returnsnull
.
Signature:
FUNCTION GetReceiver : Result
VAR_INPUT
iEntity : I_Entity;
sTagId : Str;
iOut : REFERENCE TO I_Receiver;
END_VAR
Type: Function
Description:
Searches an I_Entity
for an I_Signal
component matching the provided tag pattern.
Results:
-
Ok
– ReturnsI_Signal
. -
Err.NotFound
– Returnsnull
. -
Err.InvRef
– Returnsnull
. -
Err.Itf0
– Returnsnull
(incorrect interface).
Signature:
FUNCTION GetSignal : Result
VAR_INPUT
iEntity : I_Entity;
sTagId : Str;
iOut : REFERENCE TO I_Signal;
END_VAR
Type: Function
Description:
Casts an I_Component
to an I_Receiver
.
Results:
-
Ok
– Cast successful. -
Err.Itf0
–iSource = 0
. -
Err.NoMatch
– Cast failed; returnsnull
.
Signature:
FUNCTION ICompToIRec : Result
VAR_INPUT
iIn : I_Component;
iOut : REFERENCE TO I_Receiver;
END_VAR
Type: Function
Description:
Casts an I_Component
to an I_Signal
.
Results:
-
Ok
– Cast successful. -
Err.Itf0
–iSource = 0
. -
Err.NoMatch
– Cast failed; returnsnull
.
Signature:
FUNCTION ICompToISignal : Result
VAR_INPUT
iIn : I_Component;
iOut : REFERENCE TO I_Signal;
END_VAR
Type: Function
Description:
Casts I_Arg
to I_Component
.
Results:
-
Ok
– Cast successful. -
Err.Itf0
–iSource
is null. -
Err.NoMatch
– Cast failed; returnsnull
.
Signature:
FUNCTION IArgAsIComp : Result
VAR_INPUT
iIn : I_Arg;
iOut : REFERENCE TO I_Component;
END_VAR
Type: Function
Description:
Casts I_Component
to I_Arg
.
Results:
-
Ok
– Cast successful. -
Err.Itf0
–iSource
is null. -
Err.NoMatch
– Cast failed; returnsnull
.
Signature:
FUNCTION ICompToIArg : Result
VAR_INPUT
iIn : I_Component;
iOut : REFERENCE TO I_Arg;
END_VAR
Type: Function
Description:
Casts I_Arg
as I_RealArg
.
Results:
-
Ok
– Successful cast. -
None
– Cast failed; returnsnull
.
Signature:
FUNCTION IArgToIRealtArg : Result
VAR_INPUT
iIn : I_Arg;
iOut : REFERENCE TO I_RealArg;
END_VAR
Type: Function
Description:
Casts I_Arg
as I_DwordArg
.
Results:
-
Ok
– Successful cast. -
Error
– Cast failed; returnsnull
.
Signature:
FUNCTION IArgToIDwordArg : Result
VAR_INPUT
iIn : I_Arg;
iOut : REFERENCE TO I_DwordArg;
END_VAR
Type: Function
Description:
Casts I_Arg
as I_BoolArg
.
Results:
-
Ok
– Successful cast. -
None
– Cast failed; returnsnull
.
Signature:
FUNCTION IArgToIBoolArg : Result
VAR_INPUT
iIn : I_Arg;
iOut : REFERENCE TO I_BoolArg;
END_VAR
Type: Interface
Extends: I_RawComponent
Description:
Represents a pairable receiver in the broadcast system.
Type: Property
Accessors: Get
Description:
Returns the tag associated with this signal.
Signature: PROPERTY Tag : I_Tag
Type: Interface
Extends: I_RawComponent
Description:
Enables pairing with receivers and casting to I_Component
. Does not allow emitting.
Type: Method
Description:
Pairs the signal with a receiver.
Results:
-
Ok
– Pairing successful. -
Err.Itf0
– Invalid receiver interface. -
Err.IncArg
– InvalidI_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
Type: Method
Description:
Unpairs the signal from the specified receiver.
Results:
-
Ok
– Unpairing successful. -
Err.Itf0
– Invalid receiver interface. -
Err.IncArg
– InvalidI_Receiver
. -
Err.NoMatch
– Not paired with the given receiver.
Signature:
METHOD Unpair : Result
VAR_INPUT
iReceiver : I_Receiver;
END_VAR
Type: Interface
Description:
Enables pairing with receivers and emitting. Does not support casting to I_Component
.
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
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
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
Type: Property
Accessors: Get
Description:
Returns the tag associated with this signal.
Signature:
PROPERTY Tag : I_Tag
Type: Method
Description:
Pairs the signal with a receiver.
Results:
-
Ok
– Pairing successful. -
Err.Itf0
– Invalid receiver interface. -
Err.IncArg
– InvalidI_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
Type: Method
Description:
Unpairs the signal from the specified receiver.
Results:
-
Ok
– Unpairing successful. -
Err.Itf0
– Invalid receiver interface. -
Err.IncArg
– InvalidI_Receiver
. -
Err.NoMatch
– Not paired with the given receiver.
Signature:
METHOD Unpair : Result
VAR_INPUT
iReceiver : I_Receiver;
END_VAR
Type: Function Block
Implements: I_Callable
, I_Receiver
Description:
Represents a receiver in the broadcast system.
Type: Method
Description:
Initializes the receiver.
Signature:
METHOD FB_Init : BOOL
VAR_INPUT
bInitRetains : BOOL;
bInCopyCode : BOOL;
iCallable : I_Callable;
END_VAR
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
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
Type: Property
Accessors: Get
From: I_Receiver
Description:
Returns the associated tag.
Signature:
PROPERTY Tag : I_Tag
Type: Function Block
Implements: I_Signal
, I_SignalEmit
Description:
A signal node for event broadcasting. Supports emission and receiver pairing.
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
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
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
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
Type: Property
Accessors: Get
From: I_Signal
, I_SignalEmit
Description:
Returns the tag associated with this signal.
Signature:
PROPERTY Tag : I_Tag
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
– InvalidI_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
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
– InvalidI_Receiver
. -
Err.NoMatch
– Not paired with the given receiver.
Signature:
METHOD Unpair : Result
VAR_INPUT
iReceiver : I_Receiver;
END_VAR
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.
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
Type: Interface
Extends: I_Debug
, __System.IQueryInterface
Description:
Alias for __System.IQueryInterface
. It can be cast to other interfaces.
Type: Interface
Extends: I_Arg
Description:
A broadcastable wrapper for a REAL
value.
Type: Property
Accessors: Get
Description:
Reads the internal value.
Signature:
PROPERTY Get : REAL
Type: Property
Accessors: Get
Description:
Returns TRUE
if the value is mutable.
Signature:
PROPERTY IsMut : BOOL
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
Type: Function Block
Implements: I_RealArg
Description:
A broadcastable wrapper for a REAL
value.
Type: Method
Description:
Enables external modification of the internal value.
Signature:
METHOD AllowMut
Type: Method
Description:
Disables external modification of the internal value.
Signature:
METHOD BlockMut
Type: Method
Description:
Directly modifies the internal value, bypassing any mutability restrictions.
Signature:
METHOD OpSet : I_Arg
VAR_INPUT
newVal : REAL;
END_VAR
Type: Property
Accessors: Get
From: I_RealArg
Description:
Reads the internal value.
Signature:
PROPERTY Get : REAL
Type: Property
Accessors: Get
From: I_RealArg
Description:
Returns TRUE
if the value is mutable.
Signature:
PROPERTY IsMut : BOOL
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
Type: Interface
Extends: I_Arg
Description:
A broadcastable wrapper for a DWORD
value.
Type: Property
Accessors: Get
Description:
Reads the internal value.
Signature:
PROPERTY Get : DWORD
Type: Property
Accessors: Get
Description:
Returns TRUE
if the value is mutable.
Signature:
PROPERTY IsMut : BOOL
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
Type: Function Block
Implements: I_DwordArg
Description:
A broadcastable wrapper for a DWORD
value.
Type: Method
Description:
Enables external modification of the internal value.
Signature:
METHOD AllowMut
Type: Method
Description:
Disables external modification of the internal value.
Signature:
METHOD BlockMut
Type: Method
Description:
Directly modifies the internal value, bypassing any mutability restrictions.
Signature:
METHOD OpSet : I_Arg
VAR_INPUT
newVal : DWORD;
END_VAR
Type: Property
Accessors: Get
From: I_DwordArg
Description:
Reads the internal value.
Signature:
PROPERTY Get : DWORD
Type: Property
Accessors: Get
From: I_DwordArg
Description:
Returns TRUE
if the value is mutable.
Signature:
PROPERTY IsMut : BOOL
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
Type: Interface
Extends: I_Arg
Description:
A broadcastable wrapper for a BOOL
value.
Type: Property
Accessors: Get
Description:
Reads the internal value.
Signature:
PROPERTY Get : BOOL
Type: Property
Accessors: Get
Description:
Returns TRUE
if the value is mutable.
Signature:
PROPERTY IsMut : BOOL
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
Type: Function Block
Implements: I_BoolArg
Description:
A broadcastable wrapper for a BOOL
value.
Type: Method
Description:
Enables external modification of the internal value.
Signature:
METHOD AllowMut
Type: Method
Description:
Disables external modification of the internal value.
Signature:
METHOD BlockMut
Type: Method
Description:
Directly modifies the internal value, bypassing any mutability restrictions.
Signature:
METHOD OpSet : I_Arg
VAR_INPUT
newVal : BOOL;
END_VAR
Type: Property
Accessors: Get
From: I_BoolArg
Description:
Reads the internal value.
Signature:
PROPERTY Get : BOOL
Type: Property
Accessors: Get
From: I_BoolArg
Description:
Returns TRUE
if the value is mutable.
Signature:
PROPERTY IsMut : BOOL
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