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

Limiting the search domain

If we have already a sensor connection defined, we skip to the subscription of sensor data directly. There's no need to perform an actual search:

if (!string.IsNullOrEmpty(this.sensorJid)) 
   this.SubscribeToSensorData(); 

If, on the other hand, a sensor connection is not defined, or if an actuator connection is not defined, we need to perform a search. We want to find appropriate devices near where the controller is. We do this by preparing the search and aggregating search operators (defined in the Waher.Networking.XMPP.Provisioning.SearchOperators namespace) corresponding to the location-based metadata tags we are using in our registration:

if (string.IsNullOrEmpty(this.sensorJid) || string.IsNullOrEmpty(this.actuatorJid)) ...

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