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

Instantiating the digital input object

We are now almost done with our digital input smart object. In our application class, we create a field member digitalInput0 to hold a reference to our digital input object instance. We instantiate it, by adding it to the list of LWM2M objects supported by our LWM2M client:

this.lwm2mClient = new Lwm2mClient("MIoT:Sensor:" + this.deviceId, 
  this.coapEndpoint, 
  new Lwm2mSecurityObject(), 
  new Lwm2mServerObject(), 
  new Lwm2mAccessControlObject(), 
  new Lwm2mDeviceObject("Waher Data AB", "SensorLwm2m", 
    this.deviceId, "1.0", "Sensor", "1.0", "1.0"), 
  new DigitalInput( 
    this.digitalInput0 = new DigitalInputInstance(0, 
      this.lastMotion, "Motion Detector", "PIR"))); 

The last thing we need to do, to get our digital ...

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