55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
#pragma once
|
|
|
|
namespace Passer::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 Passer::Control
|
|
using namespace Passer::Control; |