diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2024-04-22 16:26:50 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2024-04-22 16:26:50 +0200 |
commit | 2da71ab755d1f444f2867b4dd75fe3e21e2c7395 (patch) | |
tree | 37ffdda6c59746dc9980b90b7bcab950e9577a47 /main/relay.cpp | |
parent | accf08f86a636f59dad3af110a8e914f12f59498 (diff) | |
download | ShelSP-2da71ab755d1f444f2867b4dd75fe3e21e2c7395.tar.gz ShelSP-2da71ab755d1f444f2867b4dd75fe3e21e2c7395.zip |
cleanup
Diffstat (limited to 'main/relay.cpp')
-rw-r--r-- | main/relay.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/main/relay.cpp b/main/relay.cpp new file mode 100644 index 0000000..701701f --- /dev/null +++ b/main/relay.cpp @@ -0,0 +1,29 @@ +#include "esp_check.h" + +#include "relay.h" + +static const char *TAG = "relay"; + +int state = 0; + +char* relay_json(void) +{ + char* resp = NULL; + + int rc = asprintf( + &resp, + "{" + "\"ison\":%s," + "\"has_timer\":false," + "\"timer_started\":0," + "\"timer_duration\":0," + "\"timer_remaining\":0," + "\"source\":\"http\"" + "}", + state ? "true" : "false" + ); + + ESP_RETURN_ON_FALSE(resp && rc, NULL, TAG, "buffer alloc failed"); + + return resp; +} |