2using System.Collections.Generic;
3using System.Threading.Tasks;
16 : base(
Parent, Client, BareJid, SupportsRdp)
20 public override string TypeName
22 get {
return "Other"; }
25 public override bool CanReadSensorData
36 return !(
Item is
null) &&
Item.HasLastPresence &&
Item.LastPresence.IsOnline;
53 string Id = Guid.NewGuid().ToString();
56 string Jid =
Item.LastPresenceFullJid;
59 Types,
null, DateTime.MinValue, DateTime.MaxValue, DateTime.Now,
string.Empty,
string.Empty,
string.Empty);
61 await Request.
Accept(
false);
68 List<Waher.Things.SensorData.Field> Fields = new List<Waher.Things.SensorData.Field>();
69 DateTime Now = DateTime.Now;
71 foreach (KeyValuePair<string, bool> Feature in e.Features)
73 Fields.Add(new Waher.Things.SensorData.BooleanField(Waher.Things.ThingReference.Empty, Now,
74 Feature.Key, Feature.Value, Waher.Things.SensorData.FieldType.Momentary, Waher.Things.SensorData.FieldQoS.AutomaticReadout));
77 bool VersionDone =
false;
81 foreach (Identity Identity in e.Identities)
83 Fields.Add(new Waher.Things.SensorData.StringField(Waher.Things.ThingReference.Empty, Now,
84 Identity.Type, Identity.Category + (string.IsNullOrEmpty(Identity.Name) ? string.Empty :
" (" + Identity.Name +
")"),
85 Waher.Things.SensorData.FieldType.Identity,
86 Waher.Things.SensorData.FieldQoS.AutomaticReadout));
91 Client.SendSoftwareVersionRequest(Jid, (sender2, e2) =>
97 Request.LogFields(new Waher.Things.SensorData.Field[]
99 new Waher.Things.SensorData.StringField(Waher.Things.ThingReference.Empty, Now,
"Client, Name", e2.Name,
100 Waher.Things.SensorData.FieldType.Identity, Waher.Things.SensorData.FieldQoS.AutomaticReadout),
101 new Waher.Things.SensorData.StringField(Waher.Things.ThingReference.Empty, Now,
"Client, OS", e2.OS,
102 Waher.Things.SensorData.FieldType.Identity, Waher.Things.SensorData.FieldQoS.AutomaticReadout),
103 new Waher.Things.SensorData.StringField(Waher.Things.ThingReference.Empty, Now,
"Client, Version", e2.Version,
104 Waher.Things.SensorData.FieldType.Identity, Waher.Things.SensorData.FieldQoS.AutomaticReadout),
109 Request.LogErrors(new Waher.Things.ThingError[]
111 new Waher.Things.ThingError(Waher.Things.ThingReference.Empty, Now,
"Unable to read software version.")
120 return Task.CompletedTask;
136 Request.
Fail(
"Unable to perform a service discovery.");
138 return Task.CompletedTask;
145 public override bool CanRecycle
149 if (!this.XmppAccountNode.IsOnline)
153 if (
Item is
null || !
Item.HasLastPresence || !
Item.LastPresence.IsOnline)
163 return Task.CompletedTask;
166 if (
Item is
null || !
Item.HasLastPresence || !
Item.LastPresence.IsOnline)
167 return Task.CompletedTask;
171 return Task.CompletedTask;
Interaction logic for xaml
Abstract base class for tree nodes in the connection view.
TreeNode Parent
Parent node. May be null if a root node.
Class representing a normal XMPP account.
Represents an unspecialized XMPP contact.
override Task< SensorDataClientRequest > StartSensorDataMomentaryReadout()
Starts readout of momentary sensor data values.
override Task Recycle(MainWindow Window)
Is called when the user wants to recycle the node.
override Task< SensorDataClientRequest > StartSensorDataFullReadout()
Starts readout of all sensor data values.
Maintains information about an item in the roster.
Manages a sensor data client request.
new Task LogFields(IEnumerable< Field > Fields)
Fields logged.
new Task Started()
Readout started.
new Task Fail(string Reason)
Readout failed.
new Task Accept(bool Queued)
Readout accepted.
new void Done()
Readout complete.
Contains information about an item of an entity.
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
const string NamespaceSoftwareVersion
jabber:iq:version
Task SendServiceDiscoveryRequest(string To, EventHandlerAsync< ServiceDiscoveryEventArgs > Callback, object State)
Sends a service discovery request