2using System.Collections.Generic;
3using System.Threading.Tasks;
26 this.sourceNode = SourceNode;
54 return Task.CompletedTask;
57 private async
void StartSearch()
64 await this.ScanChildSources(Client, FullJid);
65 await this.ScanRootNodes(Client, FullJid);
76 FullJid, this.sourceNode.RemoteSourceID);
78 Dictionary<string, ConcentratorSourceNode> BySourceId =
new Dictionary<string, ConcentratorSourceNode>();
82 if (Child is ConcentratorSourceNode SourceNode)
83 BySourceId[SourceNode.RemoteSourceID] = SourceNode;
86 LinkedList<ScanSource> NewScans =
null;
90 if (BySourceId.ContainsKey(Source.
SourceID))
93 ConcentratorSourceNode SourceNode =
new ConcentratorSourceNode()
96 RemoteSourceID = Source.SourceID
99 await this.sourceNode.AddAsync(SourceNode);
101 BySourceId[Source.
SourceID] = SourceNode;
103 if (NewScans is
null)
104 NewScans =
new LinkedList<ScanSource>();
109 if (!(NewScans is
null))
111 foreach (ScanSource ScanSource
in NewScans)
112 await ScanSource.ExecuteCommandAsync();
119 FullJid, this.sourceNode.RemoteSourceID,
false,
false,
120 string.Empty,
string.Empty,
string.Empty,
string.Empty);
122 Dictionary<string, ConcentratorNode> ByNodeId =
new Dictionary<string, ConcentratorNode>();
126 if (Child is ConcentratorNode XmppNode)
127 ByNodeId[XmppNode.RemoteNodeID] = XmppNode;
130 LinkedList<ScanNode> NewScans =
null;
134 if (ByNodeId.ContainsKey(Node.
NodeId))
137 ConcentratorNode NewNode;
141 NewNode =
new SensorNode()
144 RemoteNodeID = Node.NodeId
149 NewNode =
new ConcentratorNode()
152 RemoteNodeID = Node.NodeId
156 await this.sourceNode.AddAsync(NewNode);
158 ByNodeId[Node.
NodeId] = NewNode;
162 if (NewScans is
null)
163 NewScans =
new LinkedList<ScanNode>();
165 NewScans.AddLast(
new ScanNode(this.
Concentrator, NewNode));
169 if (!(NewScans is
null))
171 foreach (ScanNode ScanNode
in NewScans)
172 await ScanNode.ExecuteCommandAsync();
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Implements an XMPP concentrator client interface.
async Task< NodeInformation[]> GetRootNodesAsync(string To, string SourceID, bool Parameters, bool Messages, string Language, string ServiceToken, string DeviceToken, string UserToken)
Gets information about all root nodes in a data source.
async Task< DataSourceReference[]> GetChildDataSourcesAsync(string To, string SourceID)
Gets all child data sources for a data source on the server.
XmppClient Client
XMPP Client.
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 ...
Base class for all metering nodes.
static async Task< string > GetUniqueNodeId(string NodeId)
Gets a Node ID, based on NodeId that is not already available in the database.
Defines the Metering Topology data source. This data source contains a tree structure of persistent r...
const string SourceID
Source ID for the metering topology data source.
Abstract base class for concentrator commands.
ConcentratorDevice Concentrator
Reference to the concentrator node.
async Task< ConcentratorClient > GetConcentratorClient()
Gets the concentrator client, if it exists.
string GetRemoteFullJid(XmppClient Client)
Gets the Full JID of the connected device.
Scans a source node on a concentrator node for its child sources and root nodes.
override Task ExecuteCommandAsync()
Executes the command.
override Task< string > GetNameAsync(Language Language)
Gets the name of data source.
override ICommand Copy()
Creates a copy of the command object.
ScanSource(ConcentratorDevice Concentrator, ConcentratorSourceNode SourceNode)
Scans a source node on a concentrator node for its child sources and root nodes.
override string CommandID
ID of command.
override CommandType Type
Type of command.
Node representing an XMPP concentrator.
Node representing a data source in an XMPP concentrator.
Interface for nodes that are published through the concentrator interface.
Task< IEnumerable< INode > > ChildNodes
Child nodes. If no child nodes are available, null is returned.