You can send an existing Signal Instance (or create a new one and then send it) to a target object with the following APIs
void sendSignal(String signalName, Object_ object) void sendSignal(String signalName, String targetName) void sendSignal(SignalInstance signal, Object_ object) void sendSignal(SignalInstance signal, String targetName) void sendSignal(String signalName, Object_ target, String portName) void sendSignal(SignalInstance signal, Object_ target, String portName)
The conditions that apply when creating an Instance are as follows
- If a signal name contains "::", it will find the signal from a qualified name. The signal will be found if its qualified name is ended with signalName.
- If an object is an instance of an Object_, send the signal to that Object_ directly.
- If an object is an instance of a String, there are two possible cases as follows
- It will find the target object(s) from all waiting objects whose part/property names match the target's String parameter.
- It will find the target object(s) through connected ports, given that the port is the name of the current object.
The following example shows how to send a specific signal to a specific target object in ALH API
ALH.sendSignal("play", o); → "o" references to a target object. ALH.sendSignal("system::play", o); → Find a signal using a qualified name. ALH.sendSignal("play", "Speaker"); → Send to all waiting objects that have "Speaker" as their type name. ALH.sendSignal("play", "Player", "out2"); → "Player" is an object, and "out2" is a port name.
All parameters must not be null, otherwise the ScriptEngine errors will be thrown.