2using System.Collections.Generic;
3using System.Threading.Tasks;
29 [Page(2,
"Script", 100)]
30 [Header(6,
"Script Node:")]
31 [ToolTip(7,
"ID of template node that defines how the node operates.")]
92 await base.StartReadout(Request,
false);
95 throw new Exception(
"Script Node ID not defined.");
98 ??
throw new Exception(
"Node not found: " + this.
ScriptNodeId);
101 throw new Exception(
"Script Node reference does not point to a script node.");
110 v.OnPreview += (Sender, e) =>
112 ScriptNode.ReportFields(Request, e.Preview.AssociatedObjectValue,
false);
113 return Task.CompletedTask;
117 ScriptNode.ReportFields(Request, Obj, DoneAfter);
144 public override Task<IEnumerable<ICommand>>
Commands => this.GetCommands();
146 internal async Task<IEnumerable<ICommand>> GetCommands()
149 ??
throw new Exception(
"Node not found: " + this.
ScriptNodeId);
151 List<ICommand>
Commands =
new List<ICommand>();
152 Commands.AddRange(await base.Commands);
156 IEnumerable<INode> Children = await Node.
ChildNodes;
157 if (!(Children is
null))
159 foreach (
INode Child
in Children)
162 Commands.Add(await CommandNode.GetCommand(
this));
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
async Task< object > EvaluateAsync(Variables Variables)
Evaluates the expression, using the variables provided in the Variables collection....
virtual Task LogErrorAsync(string Body)
Logs an error message on the node.
virtual Task< bool > RemoveErrorAsync()
Removes error messages with an empty event ID from the node.
Defines the Metering Topology data source. This data source contains a tree structure of persistent r...
static Task< MeteringNode > GetNode(string NodeId)
Gets a node from the Metering Topology
Class for the root node of the Metering topology.
Abstract base class for script node commands and queries.
Expression ParsedSensorDataScript
Parsed sensor-data script.
Node referencing a script node.
override bool IsReadable
If the node can be read.
override Task< bool > AcceptsChildAsync(INode Child)
If the node accepts a presumptive child, i.e. can receive as a child (if that child accepts the node ...
virtual void PopulateVariables(Variables Variables)
Populates a variable collection with variables before script execution.
string ScriptNodeId
ID of node containing script defining node.
override Task< IEnumerable< ICommand > > Commands
Available command objects. If no commands are available, null is returned.
ScriptReferenceNode()
Node referencing a script node.
override async Task StartReadout(ISensorReadout Request, bool DoneAfter)
Starts the readout of the sensor.
override Task< bool > AcceptsParentAsync(INode Parent)
If the node accepts a presumptive parent, i.e. can be added to that parent (if that parent accepts th...
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
Contains information about an error on a thing
Virtual node, that can be used as a placeholder for services.
MetaDataValue[] MetaData
Meta-data attached to virtual node.
Interface for nodes that are published through the concentrator interface.
bool HasChildren
If the source has any child sources.
Task< IEnumerable< INode > > ChildNodes
Child nodes. If no child nodes are available, null is returned.
INode Parent
Parent Node, or null if a root node.
Interface for sensor nodes.
Interface for classes managing sensor data readouts.
Task ReportErrors(bool Done, params ThingError[] Errors)
Report error states to the client.