RoboidControl-cpp/CoreThing.h
2024-12-16 12:47:47 +01:00

57 lines
1.1 KiB
C++

#pragma once
namespace Passer {
namespace Control {
class CoreThing {
public:
// Participant *client;
unsigned char networkId;
/// @char The id of the thing
unsigned char id;
// CoreThing *parent;
/// @brief The type of Thing
unsigned char type;
const char *name = nullptr;
const char *modelUrl = nullptr;
// protected Sensor sensor;
/// @brief Basic Thing types
enum class Type {
Undetermined,
// Sensor,
Switch,
DistanceSensor,
DirectionalSensor,
TemperatureSensor,
// Motor,
ControlledMotor,
UncontrolledMotor,
Servo,
// Other
Humanoid,
ExternalSensor,
};
public:
CoreThing(unsigned char networkId = 0,
unsigned char thingType = (unsigned char)Type::Undetermined);
void SetName(const char *name);
virtual void SendBytes(unsigned char *buffer, unsigned char *ix) {};
// All things
private:
static CoreThing *allThings[];
static CoreThing *Get(unsigned char networkId, unsigned char thingId);
static int Add(CoreThing *thing);
protected:
virtual void Init();
};
} // namespace Control
} // namespace Passer
using namespace Passer::Control;