29
29
#include " SoftwareSerial.h"
30
30
#endif
31
31
32
- #define VERSION_18 0X18
33
- #define VERSION_22 0X22
32
+ #define VERSION_18 0X18
33
+ #define VERSION_22 0X22
34
+ #define DEFAULT_PATTERN 3
34
35
35
36
/* *
36
37
* You can modify the macro to choose a different version
@@ -153,7 +154,7 @@ class ESP8266 {
153
154
* @retval false - failure.
154
155
*
155
156
*/
156
- bool setOprToStation (uint8_t pattern1=3 ,uint8_t pattern2=3 );
157
+ bool setOprToStation (uint8_t pattern1=DEFAULT_PATTERN ,uint8_t pattern2=DEFAULT_PATTERN );
157
158
158
159
/* *
159
160
* Get the model values list.
@@ -170,7 +171,7 @@ class ESP8266 {
170
171
* @retval true - success.
171
172
* @retval false - failure.
172
173
*/
173
- bool setOprToSoftAP (uint8_t pattern1=3 ,uint8_t pattern2=3 );
174
+ bool setOprToSoftAP (uint8_t pattern1=DEFAULT_PATTERN ,uint8_t pattern2=DEFAULT_PATTERN );
174
175
175
176
/* *
176
177
* Set operation mode to station + softap.
@@ -180,7 +181,18 @@ class ESP8266 {
180
181
* @retval true - success.
181
182
* @retval false - failure.
182
183
*/
183
- bool setOprToStationSoftAP (uint8_t pattern1=3 ,uint8_t pattern2=3 );
184
+ bool setOprToStationSoftAP (uint8_t pattern1=DEFAULT_PATTERN,uint8_t pattern2=DEFAULT_PATTERN);
185
+
186
+ /* *
187
+ * Get the operation mode.
188
+ * @param pattern1 -1, send "AT+CWMODE_DEF?",-2,send "AT+CWMODE_CUR?",-3,send "AT+CWMODE?".
189
+ *
190
+ * @retval 0 - failure.
191
+ * @retval 1 - mode Station.
192
+ * @retval 2 - mode AP.
193
+ * @retval 3 - mode AP + station.
194
+ */
195
+ uint8_t getOprMode (uint8_t pattern1=DEFAULT_PATTERN);
184
196
185
197
/* *
186
198
* Search available AP list and return it.
@@ -197,7 +209,7 @@ class ESP8266 {
197
209
* @param pattern -1, send "AT+CWJAP_DEF?",-2,send "AT+CWJAP_CUR?",-3,send "AT+CWJAP?".
198
210
* @return the ssid of AP connected now.
199
211
*/
200
- String getNowConecAp (uint8_t pattern=3 );
212
+ String getNowConecAp (uint8_t pattern=DEFAULT_PATTERN );
201
213
202
214
/* *
203
215
* Join in AP.
@@ -209,7 +221,7 @@ class ESP8266 {
209
221
* @retval false - failure.
210
222
* @note This method will take a couple of seconds.
211
223
*/
212
- bool joinAP (String ssid, String pwd,uint8_t pattern=3 );
224
+ bool joinAP (String ssid, String pwd,uint8_t pattern=DEFAULT_PATTERN );
213
225
214
226
/* *
215
227
* Leave AP joined before.
@@ -232,15 +244,15 @@ class ESP8266 {
232
244
* @retval false - failure.
233
245
* @note This method should not be called when station mode.
234
246
*/
235
- bool setSoftAPParam (String ssid, String pwd, uint8_t chl = 7 , uint8_t ecn = 4 ,uint8_t pattern=3 );
247
+ bool setSoftAPParam (String ssid, String pwd, uint8_t chl = 7 , uint8_t ecn = 4 ,uint8_t pattern=DEFAULT_PATTERN );
236
248
237
249
/* *
238
250
* get SoftAP parameters.
239
251
*
240
252
* @param pattern -1 send "AT+CWSAP_DEF?" -2 send "AT+CWSAP_CUR?" -3 send "AT+CWSAP?".
241
253
* @note This method should not be called when station mode.
242
254
*/
243
- String getSoftAPParam (uint8_t pattern=3 );
255
+ String getSoftAPParam (uint8_t pattern=DEFAULT_PATTERN );
244
256
245
257
/* *
246
258
* Get the IP list of devices connected to SoftAP.
@@ -257,7 +269,7 @@ class ESP8266 {
257
269
* @return the state of DHCP.
258
270
*
259
271
*/
260
- String getDHCP (uint8_t pattern=3 );
272
+ String getDHCP (uint8_t pattern=DEFAULT_PATTERN );
261
273
262
274
/* *
263
275
* Set the state of DHCP.
@@ -267,7 +279,7 @@ class ESP8266 {
267
279
* @retval true - success.
268
280
* @retval false - failure.
269
281
*/
270
- bool setDHCP (uint8_t mode, uint8_t en, uint8_t pattern=3 );
282
+ bool setDHCP (uint8_t mode, uint8_t en, uint8_t pattern=DEFAULT_PATTERN );
271
283
272
284
/* *
273
285
* make boot automatically connected.
@@ -283,7 +295,7 @@ class ESP8266 {
283
295
* @return mac address.
284
296
* @note This method should not be called when ap mode.
285
297
*/
286
- String getStationMac (uint8_t pattern=3 );
298
+ String getStationMac (uint8_t pattern=DEFAULT_PATTERN );
287
299
288
300
/* *
289
301
* Set the station's MAC address.
@@ -292,15 +304,15 @@ class ESP8266 {
292
304
* @retval true - success.
293
305
* @retval false - failure.
294
306
*/
295
- bool setStationMac (String mac,uint8_t pattern=3 );
307
+ bool setStationMac (String mac,uint8_t pattern=DEFAULT_PATTERN );
296
308
297
309
/* *
298
310
* Get the station's IP.
299
311
* @param pattern -1 send "AT+CIPSTA_DEF?" -2 send "AT+CIPSTA_CUR?" -3 send "AT+CIPSTA?".
300
312
* @return the station's IP.
301
313
* @note This method should not be called when ap mode.
302
314
*/
303
- String getStationIp (uint8_t pattern=3 );
315
+ String getStationIp (uint8_t pattern=DEFAULT_PATTERN );
304
316
305
317
/* *
306
318
* Set the station's IP.
@@ -312,7 +324,7 @@ class ESP8266 {
312
324
* @retval false - failure.
313
325
* @note This method should not be called when ap mode.
314
326
*/
315
- bool setStationIp (String ip,String gateway,String netmask,uint8_t pattern=3 );
327
+ bool setStationIp (String ip,String gateway,String netmask,uint8_t pattern=DEFAULT_PATTERN );
316
328
317
329
/* *
318
330
* Get the AP's IP.
@@ -321,7 +333,7 @@ class ESP8266 {
321
333
* @note This method should not be called when station mode.
322
334
*
323
335
*/
324
- String getAPIp (uint8_t pattern=3 );
336
+ String getAPIp (uint8_t pattern=DEFAULT_PATTERN );
325
337
326
338
/* *
327
339
* Set the AP IP.
@@ -331,7 +343,7 @@ class ESP8266 {
331
343
* @retval false - failure.
332
344
* @note This method should not be called when station mode.
333
345
*/
334
- bool setAPIp (String ip,uint8_t pattern=3 );
346
+ bool setAPIp (String ip,uint8_t pattern=DEFAULT_PATTERN );
335
347
336
348
/* *
337
349
* start smartconfig.
0 commit comments