Skip to content

Commit 55e5cdd

Browse files
Merge pull request #7 from ayushsharma82/dev
fix: parameter value getter-setters
2 parents 82c7b20 + 6b886d4 commit 55e5cdd

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

examples/AsyncDemo/AsyncDemo.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ void setup(void) {
140140
Serial.println("NW onConfig Received");
141141

142142
// Print new parameter values
143-
Serial.printf("Host: %s\n", nw_mqtt_host.getValue().c_str());
144-
Serial.printf("Port: %s\n", nw_mqtt_port.getValue().c_str());
143+
Serial.printf("Host: %s\n", nw_mqtt_host.getValueStr().c_str());
144+
Serial.printf("Port: %s\n", nw_mqtt_port.getValueStr().c_str());
145145
return true; // <-- return true to approve request, false to reject
146146
});
147147

examples/Demo/Demo.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ void setup(void) {
130130
Serial.println("NW onConfig Received");
131131

132132
// Print new parameter values
133-
Serial.printf("Host: %s\n", nw_mqtt_host.getValue().c_str());
134-
Serial.printf("Port: %s\n", nw_mqtt_port.getValue().c_str());
133+
Serial.printf("Host: %s\n", nw_mqtt_host.getValueStr().c_str());
134+
Serial.printf("Port: %s\n", nw_mqtt_port.getValueStr().c_str());
135135
return true; // <-- return true to approve request, false to reject
136136
});
137137

library.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"platforms": ["espressif8266", "raspberrypi"]
3636
}
3737
],
38-
"version": "1.0.5",
38+
"version": "1.0.6",
3939
"frameworks": "arduino",
4040
"platforms": ["espressif32", "raspberrypi"]
4141
}

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=NetWizard
2-
version=1.0.5
2+
version=1.0.6
33
author=Ayush Sharma
44
category=Communication
55
maintainer=Ayush Sharma <[email protected]>

src/NetWizardParameter.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,22 @@ const int NetWizardParameter::getType() {
2020
return _type;
2121
}
2222

23-
String NetWizardParameter::getValue() {
23+
const String& NetWizardParameter::getValue() {
2424
return _value;
2525
}
2626

27+
const String& NetWizardParameter::getValueStr() {
28+
return _value;
29+
}
30+
31+
void NetWizardParameter::getValue(String& value) {
32+
value = _value;
33+
}
34+
35+
void NetWizardParameter::setValue(const String& value) {
36+
_value = value;
37+
}
38+
2739
void NetWizardParameter::setValue(const char* value) {
2840
_value = value;
2941
}

src/NetWizardParameter.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ class NetWizardParameter {
2626

2727
const int getType();
2828

29-
String getValue();
29+
[[deprecated("getValue has been replaced by getValueStr()")]]
30+
const String& getValue();
31+
32+
const String& getValueStr();
33+
34+
void getValue(String& value);
35+
36+
void setValue(const String& value);
3037
void setValue(const char* value);
3138

3239
String getPlaceholder();

0 commit comments

Comments
 (0)