For our purposes, we start with the device set of interfaces for provisioning. We add a member variable that will hold our provisioning client to both our SensorXmpp2 and ActuatorXmpp2 projects:
private ProvisioningClient provisioningClient = null;
When we search the components made available by the server to find a Thing Registry, we make sure to check for provisioning support as well:
if (e2.HasFeature(ProvisioningClient.NamespaceProvisioningDevice)) { Log.Informational("Provisioning server found.", Item2.JID); this.UseProvisioningServer(Item2.JID, OwnerJid); await RuntimeSettings.SetAsync("ProvisioningServer.JID", Item2.JID); }
Here, the OwnerJid contains the JID to the device's owner, if known. If not, it is simply empty.