mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-26 04:36:38 +00:00
Simplify device class files
This commit is contained in:
parent
0350f86c35
commit
b7a2103899
@ -1,35 +0,0 @@
|
||||
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie
|
||||
For full license information read the LICENSE file in the project folder */
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#define Q(x) #x
|
||||
#define QUOTE(x) Q(x)
|
||||
|
||||
namespace dev {
|
||||
|
||||
const char* BaseDevice::get_model()
|
||||
{
|
||||
#ifdef HASP_MODEL
|
||||
return QUOTE(HASP_MODEL);
|
||||
#else
|
||||
return PIOENV;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* BaseDevice::get_version()
|
||||
{
|
||||
return (QUOTE(HASP_VER_MAJ) "." QUOTE(HASP_VER_MIN) "." QUOTE(HASP_VER_REV));
|
||||
}
|
||||
|
||||
const char* BaseDevice::get_hostname()
|
||||
{
|
||||
return _hostname; //.c_str();
|
||||
}
|
||||
|
||||
void BaseDevice::set_hostname(const char* hostname)
|
||||
{
|
||||
strncpy(_hostname, hostname, STR_LEN_HOSTNAME);
|
||||
}
|
||||
|
||||
} // namespace dev
|
@ -21,6 +21,8 @@
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
#define STR_LEN_HOSTNAME 64
|
||||
#define Q(x) #x
|
||||
#define QUOTE(x) Q(x)
|
||||
|
||||
namespace dev {
|
||||
|
||||
@ -31,8 +33,14 @@ class BaseDevice {
|
||||
|
||||
virtual void reboot()
|
||||
{}
|
||||
const char* get_hostname();
|
||||
void set_hostname(const char*);
|
||||
const char* get_hostname()
|
||||
{
|
||||
return _hostname; //.c_str();
|
||||
}
|
||||
void set_hostname(const char* hostname)
|
||||
{
|
||||
strncpy(_hostname, hostname, STR_LEN_HOSTNAME);
|
||||
}
|
||||
const char* get_core_version()
|
||||
{
|
||||
return "";
|
||||
@ -41,8 +49,18 @@ class BaseDevice {
|
||||
{
|
||||
return "";
|
||||
}
|
||||
virtual const char* get_model();
|
||||
virtual const char* get_version();
|
||||
const char* get_model()
|
||||
{
|
||||
#ifdef HASP_MODEL
|
||||
return QUOTE(HASP_MODEL);
|
||||
#else
|
||||
return PIOENV;
|
||||
#endif
|
||||
}
|
||||
const char* get_version()
|
||||
{
|
||||
return (QUOTE(HASP_VER_MAJ) "." QUOTE(HASP_VER_MIN) "." QUOTE(HASP_VER_REV));
|
||||
}
|
||||
virtual const char* get_hardware_id()
|
||||
{
|
||||
return "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user