@@ -29,9 +29,13 @@ The namespace for IotWebConf become ```iotwebconf::```. From now on
2929you should use this prefix for each type defined by the library
3030except for the IotWebConf class itself.
3131
32+ There are more ways to update your code. Let's see some variations!
33+
3234### Migration steps: easy way
3335For easy migration IotWebConf has provided a header file prepared
34- with predefined aliases to hide namespaces.
36+ with predefined aliases to hide namespaces, so you can still use
37+ the legacy types.
38+
3539Include helper header file as follows.
3640
3741Code before:
@@ -46,34 +50,40 @@ Code after:
4650```
4751
4852### Migration steps: proper way
49- Use namespace prefixes as follows .
53+ Use namespace prefixes before every type name .
5054
5155Code before:
5256``` C++
53- class CustomHtmlFormatProvider :
54- public IotWebConfHtmlFormatProvider
55- {
56- protected:
57- ...
57+ IotWebConfParameter mqttServerParam =
58+ IotWebConfParameter ("MQTT server", "mqttServer", mqttServerValue, STRING_LEN);
5859```
5960
6061Code after:
6162```C++
62- class CustomHtmlFormatProvider :
63- public iotwebconf::HtmlFormatProvider
64- {
65- protected:
63+ iotwebconf::Parameter mqttServerParam =
64+ iotwebconf::Parameter("MQTT server", "mqttServer", mqttServerValue, STRING_LEN);
65+ ```
66+
67+ ### Migration steps: optimist way
68+ Define namespaces at the beginning of the code and use simple type name.
69+ Everywhere later on. This works only until name-collision with other
70+ library occur.
71+
72+ Code after:
73+ ``` C++
74+ using namespace iotwebconf ;
6675...
76+ Parameter mqttServerParam =
77+ Parameter ("MQTT server", "mqttServer", mqttServerValue, STRING_LEN);
6778```
6879
6980## Parameter classes
7081
7182Previously there was just the ```IotWebConfParameter``` and the
72- parameter was provided as an argument. Now it turned out, that
73- it is a better idea to use specific classes for each individual
74- types. So from now on you must specify the
75- type of
76- the parameter by creating that very type e.g. using
83+ actual type was provided as an argument of this one-and-only type.
84+ Now it turned out, that it is a better idea to use specific classes
85+ for each individual types. So from now on you must specify the type
86+ of the parameter by creating that very type e.g. using
7787```IotWebConfTextParameter```.
7888
7989For compatibility reasons the signature is the same before, except
@@ -109,6 +119,10 @@ Note, that ```IotWebConfTextParameter``` and
109119should use ```iotwebconf::TextParameter```,
110120```iotwebconf::PasswordParameter```, etc.
111121
122+ _Note, that with version 3.0.0 a new typed parameter approach is introduced,
123+ you might want to immediately migrate to this parameter types, but
124+ typed-parameters are still in testing phase and might be a subject of
125+ change._
112126
113127## Grouping parameters
114128
@@ -168,9 +182,10 @@ should use ```iotwebconf::ParameterGroup```,
168182
169183For the Parameters you could always specify "defaultValue". In v2.x
170184.x this value was intended to be appeared in the config portal, if no
171- values are specified. On the other hand in v3.0.0 defaultValue is
172- automatically assigned to the parameter, when this is the first
173- time configuration is loading.
185+ values are specified. Now with v3.0.0, defaultValue has a different
186+ meaning. Now it is
187+ automatically assigned to the parameter, when this is the **first
188+ time** configuration is loading.
174189
175190This means you do not have to set these values manually.
176191
@@ -200,28 +215,49 @@ iotWebConf.addHiddenParameter(&myHiddenParameter);
200215
201216## UpdateServer changes
202217
203- In prior versions, IotWebConf switched on HTTP Update server. With
204- version 3.0.0, IotWebConf dropped the dependency to UpdateServer. The
205- switching will still be triggered, but implementations should be provided
206- to do the actual switching .
218+ In prior versions, IotWebConf activated HTTP Update server automatically.
219+ With version 3.0.0, IotWebConf dropped the dependency to UpdateServer. The
220+ activation will still be triggered, but the actual switching action
221+ should be provided externally (at your code) .
207222
208- A quite complicated code needs to introduced because of this, and you
209- need to manually include UpdateServer to your code. See example:
223+ A quite complicated code needs to introduced because of this change , and
224+ you need to manually include UpdateServer to your code. See example:
210225 ```IotWebConf04UpdateServer``` for details!
211226
227+ Changed lines:
228+
212229```
230+ // Include Update server
231+ #ifdef ESP8266
232+ # include <ESP8266HTTPUpdateServer.h>
233+ #elif defined(ESP32)
234+ # include <IotWebConfESP32HTTPUpdateServer.h>
235+ #endif
236+
237+ // Create Update Server
238+ #ifdef ESP8266
239+ ESP8266HTTPUpdateServer httpUpdater;
240+ #elif defined(ESP32)
241+ HTTPUpdateServer httpUpdater;
242+ #endif
243+
244+ // In setup register callbacks performing Update Server hooks.
213245 iotWebConf.setupUpdateServer(
214246 [ ] (const char* updatePath) { httpUpdater.setup(&server, updatePath); },
215247 [ ] (const char* userName, char* password) { httpUpdater.updateCredentials(userName, password); });
216248```
217249
218250Note, that ESP32 still doesn't provide Update Server solution out of the
219251box. IotWebConf still provides an implementation for that, but it is now
220- completely independent from the core codes.
252+ completely independent of the core codes.
221253
222254## configSave
223255Method configSave is renamed to saveConfig.
224256
225257## formValidator
226- The formValidator() methods from now on will have a WebRequestWrapper*
227- parameter.
258+ The formValidator() methods from now on will have a
259+ ```webRequestWrapper``` parameter.
260+
261+ ```
262+ bool formValidator(iotwebconf::WebRequestWrapper* webRequestWrapper);
263+ ```
0 commit comments