Anniversary Sale · up to 80% off all librariesEnds Nov 9Shop now
SOFTTDocs

Statistics

Show application-specific key-value pairs on the home page of the NetWizard captive portal.

NetWizard Pro feature. This functionality is available only in the commercial edition of NetWizard.

Statistics display key-value pairs on the home page of the captive portal, below the built-in connection details. Use them to show application-specific information during setup, such as the firmware version, a serial number or sensor readings. Statistics appear in declaration order, and you can add as many as you need.

Statistics in the NetWizard captive portal

Constructor

NetWizardStatistic(NetWizard* parent, const char* label, const char* value = "");

Prop

Type

NetWizard NW(&server);

NetWizardStatistic nw_stat(&NW, "Firmware", "v1.0.0");

The label and value are copied, so you can pass temporary strings. A statistic removes itself from the portal when it is destroyed.

Methods

setLabel()

void setLabel(const char* label);

Changes the key.

setValue()

void setValue(const char* value);

Changes the value.

Example

main.cpp
#include <WebServer.h>
#include <NetWizardPro.h>

WebServer server(80);
NetWizard NW(&server);

NetWizardStatistic nw_firmware(&NW, "Firmware", "v1.0.0");
NetWizardStatistic nw_uptime(&NW, "Uptime");

void setup() {
  NW.setStrategy(NetWizardStrategy::NON_BLOCKING);
  NW.autoConnect("NetWizard Demo", "");
  server.begin();
}

void loop() {
  static unsigned long last = 0;
  if (millis() - last > 1000) {
    last = millis();
    nw_uptime.setValue(String(millis() / 1000).c_str());
  }
  NW.loop();
}

On this page