aboutsummaryrefslogtreecommitdiff
path: root/src/diller_core.h
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-04-11 08:24:56 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-04-11 08:24:56 +0200
commit1aee39b3b4048ad8fc6e442cc5d0d79be1b6f233 (patch)
tree335211feec9512ad2b44ad65376715d6f0bcb58b /src/diller_core.h
parent1effc988e95a7c39ed673bbcc840ff20cec4bb75 (diff)
downloaddiller-master.tar.gz
diller-master.tar.bz2
diller-master.tar.xz
diller-master.zip
o Initial import of Diller library.HEADmaster
Diffstat (limited to 'src/diller_core.h')
-rw-r--r--src/diller_core.h71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/diller_core.h b/src/diller_core.h
deleted file mode 100644
index a38779c..0000000
--- a/src/diller_core.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#pragma once
-
-#include "diller_utils.h"
-#include <Arduino.h>
-#include <ESP8266WiFi.h>
-
-namespace diller {
-namespace core {
-
-using diller::utils::property;
-
-template<uint8_t max_property_count>
-using props = diller::utils::properties<max_property_count>;
-
-enum class diller_error : uint8_t {
- OK, INVAL, NOMEM
-};
-
-static
-const char * to_string(diller_error err) {
- switch (err) {
- case diller_error::OK:
- return "ok";
- case diller_error::INVAL:
- return "inval";
- case diller_error::NOMEM:
- return "nomem";
- default:
- return "unknown";
- }
-}
-
-enum class property_action : uint8_t {
- VALUE,
- NAME,
- DESCRIPTION,
-};
-
-class property_action_listener {
- public:
- virtual void on_property_action(const property *, property_action) = 0;
-};
-
-template<uint8_t number_of_properties>
-class core {
- public:
- core(const String &mqtt_host, int mqtt_port);
- void set_property_action_listener(property_action_listener *);
-
- void setup();
- void loop();
-
- bool connected() const;
-
- diller_error cmd_property(const char *id, const char *value, const char *name);
- props<number_of_properties> properties;
-
- const String mqtt_host;
- const int mqtt_port = 1883;
- String mac;
- String client_id;
-
- private:
- void callback(char* topic_, byte* payload, unsigned int length);
- property_action_listener *property_action_listener_;
-};
-
-} // namespace core
-} // namespace diller
-
-#include "impl/diller_core_impl.h"