Skip to content

Commit 6b886d4

Browse files
committed
fix: revert examples with new getValueStr API
1 parent 33ae9e1 commit 6b886d4

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

examples/AsyncDemo/AsyncDemo.ino

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,10 @@ void setup(void) {
138138

139139
NW.onConfig([&]() {
140140
Serial.println("NW onConfig Received");
141-
142-
String host, port;
143-
// Get values
144-
nw_mqtt_host.getValue(host);
145-
nw_mqtt_port.getValue(port);
146-
// Print values
147-
Serial.printf("Host: %s\n", host.c_str());
148-
Serial.printf("Port: %s\n", port.c_str());
141+
142+
// Print new parameter values
143+
Serial.printf("Host: %s\n", nw_mqtt_host.getValueStr().c_str());
144+
Serial.printf("Port: %s\n", nw_mqtt_port.getValueStr().c_str());
149145
return true; // <-- return true to approve request, false to reject
150146
});
151147

examples/Demo/Demo.ino

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,10 @@ void setup(void) {
128128

129129
NW.onConfig([&]() {
130130
Serial.println("NW onConfig Received");
131-
132-
String host, port;
133-
// Get values
134-
nw_mqtt_host.getValue(host);
135-
nw_mqtt_port.getValue(port);
136-
// Print values
137-
Serial.printf("Host: %s\n", host.c_str());
138-
Serial.printf("Port: %s\n", port.c_str());
131+
132+
// Print new parameter values
133+
Serial.printf("Host: %s\n", nw_mqtt_host.getValueStr().c_str());
134+
Serial.printf("Port: %s\n", nw_mqtt_port.getValueStr().c_str());
139135
return true; // <-- return true to approve request, false to reject
140136
});
141137

src/NetWizardParameter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const String& NetWizardParameter::getValue() {
2424
return _value;
2525
}
2626

27+
const String& NetWizardParameter::getValueStr() {
28+
return _value;
29+
}
30+
2731
void NetWizardParameter::getValue(String& value) {
2832
value = _value;
2933
}

src/NetWizardParameter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ class NetWizardParameter {
2626

2727
const int getType();
2828

29-
[[deprecated("Replaced by void getValue(String& value)")]]
29+
[[deprecated("getValue has been replaced by getValueStr()")]]
3030
const String& getValue();
3131

32+
const String& getValueStr();
33+
3234
void getValue(String& value);
3335

3436
void setValue(const String& value);

0 commit comments

Comments
 (0)