Registering our embedded nodes

We are now almost ready to try our concentrator with our controller application. For the controller to find our sensor and actuator, we need to register them in the Thing Registry. To do this, we need to make two different registrations. We create a registration method that takes generic metadata for the concentrator, and then add node-specific information for each node:

private void RegisterDevice(MetaDataTag[] MetaInfo) 
{ 
   Log.Informational("Registering device."); 
 
   MetaDataTag[] SensorTags = this.GetSensorMetaInfo(MetaInfo); 
   MetaDataTag[] ActuatorTags = this.GetActuatorMetaInfo( 
         MetaInfo); 
 
   this.registryClient.RegisterThing(true, ActuatorNode.NodeID, 
         MeteringTopology.ID, ActuatorTags, 
         this.RegistrationResponse, ActuatorNode.NodeID); 
   this.registryClient.RegisterThing(true, SensorNode.NodeID, 
         MeteringTopology.ID, SensorTags, 
         this.RegistrationResponse, SensorNode.NodeID); 
} 

Where the sensor node metadata is modified as follows, for example:

private MetaDataTag[] GetSensorMetaInfo(MetaDataTag[] MetaInfo) 
{ 
   List<MetaDataTag> SensorTags = new List<MetaDataTag>(MetaInfo) 
   { 
         new MetaDataStringTag("CLASS", "Sensor"), 
         new MetaDataStringTag("TYPE", "MIoT Sensor") 
   }; 
 
   return SensorTags.ToArray(); 
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset