diff --git a/ControlCore/CoreThing.cpp b/ControlCore/CoreThing.cpp index 7ead074..26a8740 100644 --- a/ControlCore/CoreThing.cpp +++ b/ControlCore/CoreThing.cpp @@ -17,6 +17,9 @@ CoreThing::CoreThing(unsigned char networkId, unsigned char thingType) { void CoreThing::Init() {} +void CoreThing::SetName(const char *name) { this->name = name; } + +// All things CoreThing *CoreThing::allThings[256] = {nullptr}; CoreThing *CoreThing::Get(unsigned char networkId, unsigned char thingId) { diff --git a/ControlCore/CoreThing.h b/ControlCore/CoreThing.h index bcbf463..691110a 100644 --- a/ControlCore/CoreThing.h +++ b/ControlCore/CoreThing.h @@ -32,13 +32,16 @@ public: ExternalSensor, }; -private: - static CoreThing *allThings[]; - public: CoreThing(unsigned char networkId = 0, unsigned char thingType = (unsigned char)Type::Undetermined); + void SetName(const char *name); + + // All things +private: + static CoreThing *allThings[]; + static CoreThing *Get(unsigned char networkId, unsigned char thingId); static int Add(CoreThing *thing); diff --git a/Thing.cpp b/Thing.cpp index 93fe1ed..6c17485 100644 --- a/Thing.cpp +++ b/Thing.cpp @@ -14,8 +14,6 @@ Thing::Thing() : CoreThing() { this->children = nullptr; } -void Thing::SetName(const char *name) { this->name = name; } - const unsigned int Thing::SwitchType = SensorType | (unsigned int)Type::Switch; const unsigned int Thing::DistanceSensorType = SensorType | (unsigned int)Type::DistanceSensor; diff --git a/Thing.h b/Thing.h index 1bed1d5..5933a5e 100644 --- a/Thing.h +++ b/Thing.h @@ -15,10 +15,6 @@ public: /// @brief Default constructor for a Thing Thing(); - // unsigned char id; - - void SetName(const char *name); - // I hate this, better is to have an additional field stating the thing // classificaton Motor, Sensor etc. /// @brief The type of a switch sensor @@ -117,23 +113,6 @@ protected: static const unsigned int RoboidType = 0x2000; static const unsigned char CustomType = 0x80; - /// @brief Basic Thing types - // enum class Type { - // Undetermined, - // // Sensor, - // Switch, - // DistanceSensor, - // DirectionalSensor, - // TemperatureSensor, - // // Motor, - // ControlledMotor, - // UncontrolledMotor, - // Servo, - // // Other - // Humanoid, - // ExternalSensor, - // }; - Thing *parent = nullptr; Thing **children = nullptr;