Defining trigger intervals for observable resources

Object instances and their readable resources are, by default observable, in LWM2M. All we need to do is tell the framework when event notifications should be triggered. As in the previous chapter, we will first define a long interval with which the resources are triggered by default. This will allow subscribers to keep track of what subscriptions are still alive. Defining trigger intervals must be done after the resources have been registered with the CoapEndpoint class. For this reason, it cannot be done in the constructor. We therefore override the AfterRegister() method to define trigger intervals:

public override void AfterRegister(Lwm2mClient Client) 
{ 
  base.AfterRegister(Client); 
 
  this.TriggerAll(new TimeSpan(0, 1, 0)); 
  this.state.TriggerAll(new TimeSpan(0, 1, 0)); 
  this.counter.TriggerAll(new TimeSpan(0, 1, 0)); 
} 
..................Content has been hidden....................

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