Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ProtocolsSource.cs
1using System;
2using System.Collections.Generic;
3using System.Threading.Tasks;
4using Waher.Events;
6using Waher.Things;
8
10{
12 {
13 private readonly INode[] nodes;
14
15 public ProtocolsSource(params INode[] Nodes)
16 {
17 this.nodes = Nodes;
18 }
19
20 public string SourceID => "Protocols";
21 public bool HasChildren => false;
22 public DateTime LastChanged => DateTime.MinValue;
23 public IEnumerable<IDataSource> ChildSources => null;
24 public IEnumerable<INode> RootNodes => this.nodes;
25 public event EventHandlerAsync<SourceEvent> OnEvent;
26
27 public Task<bool> CanViewAsync(RequestOrigin Caller)
28 {
29 return XmppServerModule.IsAdmin(Caller.From);
30 }
31
32 public Task<string> GetNameAsync(Language Language)
33 {
34 return Language.GetStringAsync(typeof(XmppServerModule), 27, "Protocols");
35 }
36
37 public Task<INode> GetNodeAsync(IThingReference NodeRef)
38 {
39 foreach (INode Node in this.nodes)
40 {
41 if (Node.NodeId == NodeRef.NodeId &&
42 Node.SourceId == NodeRef.SourceId &&
43 Node.Partition == NodeRef.Partition)
44 {
45 return Task.FromResult<INode>(Node);
46 }
47 }
48
49 return Task.FromResult<INode>(null);
50 }
51 }
52}
Contains information about a language.
Definition: Language.cs:17
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 ...
Definition: Language.cs:209
Task< bool > CanViewAsync(RequestOrigin Caller)
If the data source is visible to the caller.
bool HasChildren
If the source has any child sources.
Task< string > GetNameAsync(Language Language)
Gets the name of data source.
Task< INode > GetNodeAsync(IThingReference NodeRef)
Gets the node, given a reference to it.
IEnumerable< INode > RootNodes
Root node references. If no root nodes are available, null is returned.
DateTime LastChanged
When the source was last updated.
IEnumerable< IDataSource > ChildSources
Child sources. If no child sources are available, null is returned.
Service Module hosting the XMPP broker and its components.
Tokens available in request.
Definition: RequestOrigin.cs:9
string From
Address of caller.
Interface for datasources that are published through the concentrator interface.
Definition: IDataSource.cs:14
Interface for nodes that are published through the concentrator interface.
Definition: INode.cs:49
Interface for thing references.
string Partition
Optional partition in which the Node ID is unique.
string SourceId
Optional ID of source containing node.