Moved setname to corething
This commit is contained in:
parent
df8e065003
commit
fec44b0397
@ -17,6 +17,9 @@ CoreThing::CoreThing(unsigned char networkId, unsigned char thingType) {
|
|||||||
|
|
||||||
void CoreThing::Init() {}
|
void CoreThing::Init() {}
|
||||||
|
|
||||||
|
void CoreThing::SetName(const char *name) { this->name = name; }
|
||||||
|
|
||||||
|
// All things
|
||||||
CoreThing *CoreThing::allThings[256] = {nullptr};
|
CoreThing *CoreThing::allThings[256] = {nullptr};
|
||||||
|
|
||||||
CoreThing *CoreThing::Get(unsigned char networkId, unsigned char thingId) {
|
CoreThing *CoreThing::Get(unsigned char networkId, unsigned char thingId) {
|
||||||
|
@ -32,13 +32,16 @@ public:
|
|||||||
ExternalSensor,
|
ExternalSensor,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
|
||||||
static CoreThing *allThings[];
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CoreThing(unsigned char networkId = 0,
|
CoreThing(unsigned char networkId = 0,
|
||||||
unsigned char thingType = (unsigned char)Type::Undetermined);
|
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 CoreThing *Get(unsigned char networkId, unsigned char thingId);
|
||||||
static int Add(CoreThing *thing);
|
static int Add(CoreThing *thing);
|
||||||
|
|
||||||
|
@ -14,8 +14,6 @@ Thing::Thing() : CoreThing() {
|
|||||||
this->children = nullptr;
|
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::SwitchType = SensorType | (unsigned int)Type::Switch;
|
||||||
const unsigned int Thing::DistanceSensorType =
|
const unsigned int Thing::DistanceSensorType =
|
||||||
SensorType | (unsigned int)Type::DistanceSensor;
|
SensorType | (unsigned int)Type::DistanceSensor;
|
||||||
|
21
Thing.h
21
Thing.h
@ -15,10 +15,6 @@ public:
|
|||||||
/// @brief Default constructor for a Thing
|
/// @brief Default constructor for a Thing
|
||||||
Thing();
|
Thing();
|
||||||
|
|
||||||
// unsigned char id;
|
|
||||||
|
|
||||||
void SetName(const char *name);
|
|
||||||
|
|
||||||
// I hate this, better is to have an additional field stating the thing
|
// I hate this, better is to have an additional field stating the thing
|
||||||
// classificaton Motor, Sensor etc.
|
// classificaton Motor, Sensor etc.
|
||||||
/// @brief The type of a switch sensor
|
/// @brief The type of a switch sensor
|
||||||
@ -117,23 +113,6 @@ protected:
|
|||||||
static const unsigned int RoboidType = 0x2000;
|
static const unsigned int RoboidType = 0x2000;
|
||||||
static const unsigned char CustomType = 0x80;
|
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 *parent = nullptr;
|
||||||
Thing **children = nullptr;
|
Thing **children = nullptr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user