36 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include "Thing.h"
 | |
| 
 | |
| namespace RoboidControl {
 | |
| 
 | |
| /// @brief A temperature sensor
 | |
| class TemperatureSensor : public Thing {
 | |
|  public:
 | |
|   /// @brief The default constructor
 | |
|   //TemperatureSensor();
 | |
|   /// @brief Create a temperature sensor with the given ID
 | |
|   /// @param networkId The network ID of the sensor
 | |
|   /// @param thingId The ID of the thing
 | |
|   TemperatureSensor(Participant* participant); //, unsigned char thingId);
 | |
|   // TemperatureSensor(Thing* parent);
 | |
|   TemperatureSensor(Thing& parent = Thing::Root);
 | |
| 
 | |
|       /// @brief The measured temperature
 | |
|       float temperature = 0;
 | |
| 
 | |
|   /// @brief Manually override the measured temperature
 | |
|   /// @param temperature The new temperature
 | |
|   virtual void SetTemperature(float temperature);
 | |
| 
 | |
|   /// @brief Function to create a binary message with the temperature
 | |
|   /// @param buffer The byte array for thw binary data
 | |
|   /// @param ix The starting position for writing the binary data
 | |
|   int GenerateBinary(char* bytes, unsigned char* ix) override;
 | |
|   /// @brief Function to extract the temperature received in the binary message
 | |
|   /// @param bytes The binary data
 | |
|   virtual void ProcessBinary(char* bytes) override;
 | |
| };
 | |
| 
 | |
| }  // namespace RoboidControl
 | 
