If more than a day has passed, and we still do not get data from the sensor, we invalidate the connection, and remove the annotations we have stored for the corresponding roster item:
else if (SecondsSinceLastEvent > 60 * 60 * 24) { if (!string.IsNullOrEmpty(this.sensorJid)) { Item = this.xmppClient[this.sensorJid]; this.sensor = null; this.sensorJid = null; if (Item != null) { this.xmppClient.UpdateRosterItem(this.sensorJid, Item.Name, this.RemoveReference(Item.Groups, "Sensor")); } } Search = true; }
Here, the RemoveReference() method removes the groups used for annotating the roster item, and that is used by the AddReference() and GetReference() methods. See the GitHub repository for details.