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

Performing control action

We are now ready to perform the control action. First, we need to get the full JID of the actuator. This is done by checking the last presence sent by the actuator. This is stored in the corresponding roster item. Note that we can only perform the control action if the actuator is online:

if (!string.IsNullOrEmpty(this.actuatorJid) && 
   (!this.output.HasValue || this.output.Value != Output)) 
{ 
   RosterItem Actuator = this.xmppClient[this.actuatorJid]; 
 
   if (Actuator != null && 
         Actuator.HasLastPresence && 
         Actuator.LastPresence.IsOnline) 
   { 

Performing a control operation on an actuator is done by calling the Set() method on the ControlClient object instance. As when subscribing to events, we must differentiate between an ...

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