-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* true/false quote remove * RSSI Support * Info Table Fixes
- Loading branch information
Showing
4 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#ifndef NETWORKDEVICE_H | ||
#define NETWORKDEVICE_H | ||
|
||
#include "Arduino.h" | ||
#include <ESP8266WiFi.h> | ||
#include <EEPROM.h> | ||
#include "WDevice.h" | ||
|
||
class WNetworkDev: public WDevice { | ||
public: | ||
|
||
WNetworkDev(WNetwork* network, String applicationName) | ||
: WDevice(network, "network", "network", network->getIdx(), DEVICE_TYPE_NETWORK) { | ||
|
||
this->providingConfigPage = false; | ||
this->configNeedsReboot = false; | ||
this->stateNotifyInterval = 30000; | ||
this->mainDevice = false; | ||
|
||
lastLongLoop = lastVeryLongLoop = 0; | ||
|
||
/* properties */ | ||
this->rssi = new WProperty("rssi", "rssi", INTEGER); | ||
this->rssi->setReadOnly(true); | ||
this->rssi->setMqttSendChangedValues(true); | ||
this->rssi->setOnValueRequest([this](WProperty* p) {updateRssi();}); | ||
this->addProperty(this->rssi); | ||
|
||
} | ||
|
||
virtual void printConfigPage(WStringStream* page) { | ||
|
||
} | ||
void saveConfigPage(ESP8266WebServer* webServer) { | ||
|
||
} | ||
|
||
void loop(unsigned long now) { | ||
// to tasks only every second | ||
if (lastLongLoop + 1000 < now ){ | ||
lastLongLoop=now; | ||
} | ||
// to tasks only every 30 seconds | ||
if (lastVeryLongLoop + 30000 < now ){ | ||
lastVeryLongLoop=now; | ||
} | ||
|
||
// properties are getting read during stateNotify | ||
} | ||
|
||
void handleUnknownMqttCallback(String stat_topic, String partialTopic, String payload, unsigned int length) { | ||
//logCommand(((String)"handleUnknownMqttCallback " + stat_topic + " / " + partialTopic + " / " + payload).c_str()); | ||
} | ||
|
||
|
||
void updateRssi() { | ||
this->rssi->setInteger(WiFi.RSSI()); | ||
} | ||
|
||
void connectionChange(){ | ||
this->rssi->setInteger(WiFi.RSSI()); | ||
} | ||
|
||
private: | ||
WProperty* rssi; | ||
unsigned long lastLongLoop, lastVeryLongLoop; | ||
}; | ||
|
||
|
||
#endif |