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

Defining our embedded sensor node

To define a node class, we need to determine which of the interfaces, ISensor or IActuator, to implement. Implementing ISensor and IActuator automatically implements INode, which is a requirement. But the node can also choose to implement both. For our sensor node, we will only implement the ISensor interface, however. We base our class on the ThingReference class, defined in Waher.Things. The sensor node will have a static identity. And we do not use partitions in our example:

public class SensorNode : ThingReference, ISensor 
{ 
   public const string NodeID = "Sensor"; 
 
   public SensorNode() 
         : base(NodeID, MeteringTopology.ID, string.Empty) 
   { 
   } 

The ThingReference class defines the NodeId property, which we define ...

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