mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 13:16:45 +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"
|
#include "ArduinoJson.h"
|
||||||
|
|
||||||
#define STR_LEN_HOSTNAME 64
|
#define STR_LEN_HOSTNAME 64
|
||||||
|
#define Q(x) #x
|
||||||
|
#define QUOTE(x) Q(x)
|
||||||
|
|
||||||
namespace dev {
|
namespace dev {
|
||||||
|
|
||||||
@ -31,8 +33,14 @@ class BaseDevice {
|
|||||||
|
|
||||||
virtual void reboot()
|
virtual void reboot()
|
||||||
{}
|
{}
|
||||||
const char* get_hostname();
|
const char* get_hostname()
|
||||||
void set_hostname(const char*);
|
{
|
||||||
|
return _hostname; //.c_str();
|
||||||
|
}
|
||||||
|
void set_hostname(const char* hostname)
|
||||||
|
{
|
||||||
|
strncpy(_hostname, hostname, STR_LEN_HOSTNAME);
|
||||||
|
}
|
||||||
const char* get_core_version()
|
const char* get_core_version()
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
@ -41,8 +49,18 @@ class BaseDevice {
|
|||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
virtual const char* get_model();
|
const char* get_model()
|
||||||
virtual const char* get_version();
|
{
|
||||||
|
#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()
|
virtual const char* get_hardware_id()
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user