Add external sensing support
This commit is contained in:
		
							parent
							
								
									4f7e911be1
								
							
						
					
					
						commit
						fe16f25859
					
				
							
								
								
									
										13
									
								
								Thing.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Thing.cpp
									
									
									
									
									
								
							@ -2,9 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
using namespace Passer::RoboidControl;
 | 
					using namespace Passer::RoboidControl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Thing::Thing() {
 | 
					Thing::Thing() { this->type = (unsigned int)Type::Undetermined; }
 | 
				
			||||||
  this->type = (unsigned int)Type::Undetermined;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const unsigned int Thing::SwitchType = SensorType | (unsigned int)Type::Switch;
 | 
					const unsigned int Thing::SwitchType = SensorType | (unsigned int)Type::Switch;
 | 
				
			||||||
const unsigned int Thing::DistanceSensorType =
 | 
					const unsigned int Thing::DistanceSensorType =
 | 
				
			||||||
@ -13,11 +11,8 @@ const unsigned int Thing::ControlledMotorType =
 | 
				
			|||||||
    MotorType | (unsigned int)Type::ControlledMotor;
 | 
					    MotorType | (unsigned int)Type::ControlledMotor;
 | 
				
			||||||
const unsigned int Thing::UncontrolledMotorType =
 | 
					const unsigned int Thing::UncontrolledMotorType =
 | 
				
			||||||
    MotorType | (unsigned int)Type::UncontrolledMotor;
 | 
					    MotorType | (unsigned int)Type::UncontrolledMotor;
 | 
				
			||||||
 | 
					const unsigned int Thing::ExternalType = (unsigned int)Type::ExternalSensor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Thing::IsMotor() {
 | 
					bool Thing::IsMotor() { return (type & Thing::MotorType) != 0; }
 | 
				
			||||||
  return (type & Thing::MotorType) != 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Thing::IsSensor() {
 | 
					bool Thing::IsSensor() { return (type & Thing::SensorType) != 0; }
 | 
				
			||||||
  return (type & Thing::SensorType) != 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										3
									
								
								Thing.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Thing.h
									
									
									
									
									
								
							@ -16,6 +16,7 @@ class Thing {
 | 
				
			|||||||
  static const unsigned int DistanceSensorType;
 | 
					  static const unsigned int DistanceSensorType;
 | 
				
			||||||
  static const unsigned int ControlledMotorType;
 | 
					  static const unsigned int ControlledMotorType;
 | 
				
			||||||
  static const unsigned int UncontrolledMotorType;
 | 
					  static const unsigned int UncontrolledMotorType;
 | 
				
			||||||
 | 
					  static const unsigned int ExternalType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// @brief Check if the Thing is a Motor
 | 
					  /// @brief Check if the Thing is a Motor
 | 
				
			||||||
  /// @returns True when the Thing is a Motor and False otherwise
 | 
					  /// @returns True when the Thing is a Motor and False otherwise
 | 
				
			||||||
@ -39,6 +40,8 @@ class Thing {
 | 
				
			|||||||
    // Motor,
 | 
					    // Motor,
 | 
				
			||||||
    ControlledMotor,
 | 
					    ControlledMotor,
 | 
				
			||||||
    UncontrolledMotor,
 | 
					    UncontrolledMotor,
 | 
				
			||||||
 | 
					    // Other
 | 
				
			||||||
 | 
					    ExternalSensor,
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user