Add external sensing support

This commit is contained in:
Pascal Serrarens 2023-12-30 09:28:09 +01:00
parent 4f7e911be1
commit fe16f25859
2 changed files with 11 additions and 13 deletions

View File

@ -2,9 +2,7 @@
using namespace Passer::RoboidControl;
Thing::Thing() {
this->type = (unsigned int)Type::Undetermined;
}
Thing::Thing() { this->type = (unsigned int)Type::Undetermined; }
const unsigned int Thing::SwitchType = SensorType | (unsigned int)Type::Switch;
const unsigned int Thing::DistanceSensorType =
@ -13,11 +11,8 @@ const unsigned int Thing::ControlledMotorType =
MotorType | (unsigned int)Type::ControlledMotor;
const unsigned int Thing::UncontrolledMotorType =
MotorType | (unsigned int)Type::UncontrolledMotor;
const unsigned int Thing::ExternalType = (unsigned int)Type::ExternalSensor;
bool Thing::IsMotor() {
return (type & Thing::MotorType) != 0;
}
bool Thing::IsMotor() { return (type & Thing::MotorType) != 0; }
bool Thing::IsSensor() {
return (type & Thing::SensorType) != 0;
}
bool Thing::IsSensor() { return (type & Thing::SensorType) != 0; }

View File

@ -16,6 +16,7 @@ class Thing {
static const unsigned int DistanceSensorType;
static const unsigned int ControlledMotorType;
static const unsigned int UncontrolledMotorType;
static const unsigned int ExternalType;
/// @brief Check if the Thing is a Motor
/// @returns True when the Thing is a Motor and False otherwise
@ -39,6 +40,8 @@ class Thing {
// Motor,
ControlledMotor,
UncontrolledMotor,
// Other
ExternalSensor,
};
};