Looping through available components

The first step is to find the thing registry. We assume that it is made available as a component of the same broker that we are connected to. To avoid searching the broker every time the device is restarted, we first check if we already know the address of the registry:

private async Task RegisterDevice() 
{ 
   string ThingRegistryJid = await RuntimeSettings.GetAsync( 
         "ThingRegistry.JID", string.Empty); 
 
   if (!string.IsNullOrEmpty(ThingRegistryJid)) 
         await this.RegisterDevice(ThingRegistryJid); 
   else 
   { 
         Log.Informational("Searching for Thing Registry."); 

Our search begins by looping through all items on the broker. These items publish a set of features. These items and features are accessed through Service Discovery:

this.xmppClient.SendServiceItemsDiscoveryRequest( 
   this.xmppClient.Domain, (sender, e) => 
{ 
   foreach (Item Item in e.Items) 
   { 
         this.xmppClient.SendServiceDiscoveryRequest( 
               Item.JID, async (sender2, e2) => 
         { 
Service Discovery is an extension to XMPP, and is defined in XEP-0030. Service Discovery classes are defined in the Waher.Networking.XMPP.ServiceDiscovery namespace.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset