Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ConcentratorDevice.cs
2using System.Threading.Tasks;
7
8namespace Waher.Things.Xmpp
9{
14 {
19 : base()
20 {
21 }
22
28 public override Task<string> GetTypeNameAsync(Language Language)
29 {
30 return Language.GetStringAsync(typeof(ConcentratorDevice), 1, "XMPP Concentrator");
31 }
32
38 public override Task<bool> AcceptsChildAsync(INode Child)
39 {
40 return Task.FromResult(
41 Child is ConcentratorSourceNode ||
42 Child is ConcentratorNode);
43 }
44
48 public override Task<IEnumerable<ICommand>> Commands => this.GetCommands();
49
50 private async Task<IEnumerable<ICommand>> GetCommands()
51 {
52 List<ICommand> Result = new List<ICommand>();
53 Result.AddRange(await base.Commands);
54
55 XmppClient Client = await this.GetClient();
56 if (!(Client is null))
57 {
58 this.GetRemoteFullJid(Client, out bool HasContact, out bool HasSubscription);
59
60 if (HasContact && HasSubscription)
61 Result.Add(new ScanRootSources(this));
62 }
63
64 return Result.ToArray();
65 }
66
72 public async Task<ConcentratorClient> GetConcentratorClient()
73 {
74 XmppClient Client = await this.GetClient();
75 if (Client is null)
76 return null;
77
79 return null;
80
81 return ConcentratorClient;
82 }
83 }
84}
Implements an XMPP concentrator client interface.
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
Definition: XmppClient.cs:58
bool TryGetExtension(Type Type, out IXmppExtension Extension)
Tries to get a registered extension of a specific type from the client.
Definition: XmppClient.cs:7391
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
Scans a concentrator node for its root sources.
Node representing an XMPP concentrator.
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 ...
async Task< ConcentratorClient > GetConcentratorClient()
Gets the concentrator client associated with the XMPP client associated with the node.
override Task< IEnumerable< ICommand > > Commands
Available command objects. If no commands are available, null is returned.
ConcentratorDevice()
Node representing an XMPP concentrator.
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
Base class for nodes in a remote concentrator.
Node representing a data source in an XMPP concentrator.
Node representing a device that is connected to XMPP.
string GetRemoteFullJid(XmppClient Client, out bool HasContact, out bool HasSubscription)
Gets the Full JID of the connected device.
async Task< XmppClient > GetClient()
Gets the XMPP Client associated with node.
Definition: XmppDevice.cs:36
Interface for nodes that are published through the concentrator interface.
Definition: INode.cs:49