O'Reilly logo

Mastering Internet of Things by Peter Waher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting remotely updated output values

We then only need to trap these events from our main application. We instantiate the IPSO Digital Output smart object as follows:

this.lwm2mClient = new Lwm2mClient("MIoT:Actuator:" + 
  this.deviceId, this.coapEndpoint, 
  new Lwm2mSecurityObject(), 
  new Lwm2mServerObject(), 
  new Lwm2mAccessControlObject(), 
  new Lwm2mDeviceObject("Waher Data AB", "ActuatorLwm2m", 
    this.deviceId, "1.0", "Actuator", "1.0", "1.0"), 
  new DigitalOutput( 
    this.digitalOutput0 = new DigitalOutputInstance(0, 
    this.output.HasValue && this.output.Value, "Relay"))); 

It's then easy to forward incoming changes to the rest of the application by attaching an event handler on the OnRemoteUpdate event we just created:

this.digitalOutput0.OnRemoteUpdate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required