Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
XmppDevice.cs
1using System;
2using System.Threading.Tasks;
6
7namespace Waher.Things.Xmpp
8{
12 public abstract class XmppDevice : ProvisionedMeteringNode
13 {
17 public XmppDevice()
18 : base()
19 {
20 }
21
26 public Task<XmppBrokerNode> GetBrokerNode()
27 {
28 return this.GetAncestor<XmppBrokerNode>();
29 }
30
36 public async Task<XmppClient> GetClient()
37 {
38 XmppBrokerNode BrokerNode = await this.GetBrokerNode();
39
40 if (!(BrokerNode is null))
41 return (await BrokerNode.GetBroker()).Client;
42 else if (Types.TryGetModuleParameter("XMPP", out object Obj) && Obj is XmppClient Client)
43 return Client;
44 else
45 throw new Exception("No XMPP Client associated with node.");
46 }
47 }
48}
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
Definition: XmppClient.cs:59
Static class that dynamically manages types and interfaces available in the runtime environment.
Definition: Types.cs:14
static bool TryGetModuleParameter(string Name, out object Value)
Tries to get a module parameter value.
Definition: Types.cs:583
Base class for all provisioned metering nodes.
Node representing an XMPP broker.
Abstract base class for devices on the XMPP network.
Definition: XmppDevice.cs:13
async Task< XmppClient > GetClient()
Gets the XMPP Client associated with node.
Definition: XmppDevice.cs:36
XmppDevice()
Abstract base class for devices on the XMPP network.
Definition: XmppDevice.cs:17
Task< XmppBrokerNode > GetBrokerNode()
Tries to get the broker node, if one exists.
Definition: XmppDevice.cs:26