Skip to content
Snippets Groups Projects
Commit a6ff9fad authored by Cyril Danilevski's avatar Cyril Danilevski :scooter:
Browse files

Tidy up mpod.cpp

parent 25849d7c
No related branches found
No related tags found
No related merge requests found
......@@ -136,7 +136,7 @@ float MPOD::getFloatFromVarBind(const VarBind *varbind) {
}
String MPOD::toJSON() {
String json = "\"status\":{\n";
String json = "{\n";
json += "\"channel\":" + String(getChannel()) + ",";
json += "\"is_on\":" + String(isOn()) + ",";
json += "\"ramping_up\":" + String(isRampingUp()) + ",";
......@@ -194,7 +194,7 @@ void initializeSNMP() {
/* setChannelAndWait
* Set a channel's parameters and wait until it's settled.
*/
void setChannelAndWait(IPAddress *ipAddr, uint16_t channel, uint8_t output) {
void setChannelAndWait(const IPAddress *ipAddr, const uint16_t channel, const uint8_t output) {
// Send set command
SNMP::Message *snmp_msg = mpod.output(channel, output);
snmp.send(snmp_msg, *ipAddr, SNMP::Port::SNMP);
......
......@@ -95,5 +95,5 @@ extern MPOD mpod;
// Event handler to process SNMP messages
void onSNMPMessage(const SNMP::Message *message, const IPAddress remote, const uint16_t port);
void initializeSNMP();
void setChannelAndWait(IPAddress*, uint16_t, uint8_t);
void setChannelAndWait(const IPAddress*, uint16_t, uint8_t);
......@@ -189,7 +189,8 @@ void pollMPODChannel() {
http_msg += ret;
http_msg += ",\"success\": ";
http_msg += channel ? 1 : 0;
http_msg += ",\"channel\": ";
http_msg +=
",\"channel\": "; // TODO: test with invalid channel (request w/o "ch" arg). JSON invalid.
http_msg += channel;
http_msg += "\n}";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment