Reacting to being disowned

Similarly, we must detect if the device becomes disowned while it is online. This is done by listening to the Disowned event on the ThingRegistry instance:

this.registryClient.Disowned += async (sender, e) => 
{ 
   try 
   { 
         await RuntimeSettings.SetAsync("ThingRegistry.Owner", 
               string.Empty); 
         await this.RegisterDevice(); 
   } 
   catch (Exception ex) 
   { 
         Log.Critical(ex); 
   } 
}; 
There are some other minor changes made in the code between SensorXmpp2 and ActuatorXmpp2 compared to SensorXmpp and ActuatorXmpp that reflect the asynchronous nature of initializing the devices with provisioning. You can view the changes in the GitHub project source code, by comparing the App.xaml.cs files of the corresponding projects.
..................Content has been hidden....................

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