Re-subscribing to sensor data

Our first test is to compute the number of seconds since we got some information from our subscription. If it's more than 70 seconds (remember that we configured a maximum interval of 60 seconds), we draw the conclusion that the subscription is no longer active. So we make a new subscription request:

private void SecondTimerCallback(object State) 
{ 
   DateTime Now = DateTime.Now; 
   double SecondsSinceLastEvent = Math.Min( 
         (Now - this.lastEventFields).TotalSeconds, 
         (Now - this.lastEventErrors).TotalSeconds); 
   double SecondsSinceLastOutput =  
         (Now - this.lastOutput).TotalSeconds; 
   RosterItem Item; 
   bool Search = false; 
 
   if (this.subscription != null && SecondsSinceLastEvent > 70) 
         this.SubscribeToSensorData(); 
..................Content has been hidden....................

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