aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/diller.h2
-rw-r--r--src/diller/client.h (renamed from src/diller_client.h)2
-rw-r--r--src/diller/core.h (renamed from src/diller_core.h)6
-rw-r--r--src/diller/core_impl.h (renamed from src/impl/diller_core_impl.h)21
-rw-r--r--src/diller/serial.h (renamed from src/diller_serial.h)7
-rw-r--r--src/diller/serial_impl.h (renamed from src/impl/diller_serial_impl.h)5
-rw-r--r--src/diller/utils.h (renamed from src/diller_utils.h)0
7 files changed, 23 insertions, 20 deletions
diff --git a/src/diller.h b/src/diller.h
new file mode 100644
index 0000000..3f59c93
--- /dev/null
+++ b/src/diller.h
@@ -0,0 +1,2 @@
+#pragma once
+
diff --git a/src/diller_client.h b/src/diller/client.h
index 988db98..d10add9 100644
--- a/src/diller_client.h
+++ b/src/diller/client.h
@@ -2,7 +2,7 @@
#include <SoftwareSerial.h>
#include <Arduino.h>
-#include "diller_utils.h"
+#include "diller/utils.h"
namespace diller {
namespace client {
diff --git a/src/diller_core.h b/src/diller/core.h
index a38779c..e9d5c28 100644
--- a/src/diller_core.h
+++ b/src/diller/core.h
@@ -1,8 +1,6 @@
#pragma once
-#include "diller_utils.h"
-#include <Arduino.h>
-#include <ESP8266WiFi.h>
+#include "diller/utils.h"
namespace diller {
namespace core {
@@ -68,4 +66,4 @@ class core {
} // namespace core
} // namespace diller
-#include "impl/diller_core_impl.h"
+#include "diller/core_impl.h"
diff --git a/src/impl/diller_core_impl.h b/src/diller/core_impl.h
index 1246e59..acb367d 100644
--- a/src/impl/diller_core_impl.h
+++ b/src/diller/core_impl.h
@@ -1,9 +1,7 @@
-#include <Arduino.h>
-#include <ESP8266WiFi.h>
-#include <PubSubClient.h>
-
+/*
extern WiFiClient wifi_client;
extern PubSubClient mqtt_client;
+*/
namespace diller {
namespace core {
@@ -11,12 +9,23 @@ namespace core {
using diller::utils::tty_status;
using diller::utils::property;
+class esp_wifi {
+ public:
+ static auto macAddress() -> decltype(WiFi.macAddress()) {
+ return WiFi.macAddress();
+ }
+
+ static auto status() -> decltype(WiFi.status()) {
+ return WiFi.status();
+ }
+};
+
// core::core
template<uint8_t number_of_properties>
core<number_of_properties>::core(const String &mqtt_host, int mqtt_port) :
mqtt_host(mqtt_host), mqtt_port(mqtt_port), property_action_listener_(nullptr) {
- mac = WiFi.macAddress();
+ mac = esp_wifi::macAddress();
mac.toLowerCase();
client_id = "diller-" + mac;
}
@@ -93,7 +102,7 @@ void core<number_of_properties>::setup() {
template<uint8_t number_of_properties>
void core<number_of_properties>::loop() {
- auto wl_status = WiFi.status();
+ auto wl_status = esp_wifi::status();
if (wl_status == WL_CONNECTED) {
if (!mqtt_client.loop()) {
diff --git a/src/diller_serial.h b/src/diller/serial.h
index a9a2de4..f80939e 100644
--- a/src/diller_serial.h
+++ b/src/diller/serial.h
@@ -1,8 +1,7 @@
#pragma once
-#include "diller_utils.h"
-#include <Arduino.h>
-#include <ESP8266WiFi.h>
+#include "diller/utils.h"
+#include "diller/core.h"
namespace diller {
namespace serial {
@@ -42,4 +41,4 @@ class diller_serial : protected diller::core::property_action_listener {
} // namespace serial
} // namespace diller
-#include "impl/diller_serial_impl.h"
+#include "diller/serial_impl.h"
diff --git a/src/impl/diller_serial_impl.h b/src/diller/serial_impl.h
index 47c18b5..e80ed71 100644
--- a/src/impl/diller_serial_impl.h
+++ b/src/diller/serial_impl.h
@@ -1,9 +1,4 @@
-// #include <Arduino.h>
-#include <ESP8266WiFi.h>
-// #include <PubSubClient.h>
-
extern WiFiClient wifi_client;
-extern PubSubClient mqtt_client;
namespace diller {
namespace serial {
diff --git a/src/diller_utils.h b/src/diller/utils.h
index 5b1224d..5b1224d 100644
--- a/src/diller_utils.h
+++ b/src/diller/utils.h