File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,11 @@ bool ESP8266::joinAP(String ssid, String pwd)
147
147
return sATCWJAP (ssid, pwd);
148
148
}
149
149
150
+ bool ESP8266::enableClientDHCP (uint8_t mode, boolean enabled)
151
+ {
152
+ return sATCWDHCP (mode, enabled);
153
+ }
154
+
150
155
bool ESP8266::leaveAP (void )
151
156
{
152
157
return eATCWQAP ();
@@ -533,6 +538,28 @@ bool ESP8266::sATCWJAP(String ssid, String pwd)
533
538
return false ;
534
539
}
535
540
541
+ bool ESP8266::sATCWDHCP (uint8_t mode, boolean enabled)
542
+ {
543
+ String strEn = " 0" ;
544
+ if (enabled) {
545
+ strEn = " 1" ;
546
+ }
547
+
548
+
549
+ String data;
550
+ rx_empty ();
551
+ m_puart->print (" AT+CWDHCP=" );
552
+ m_puart->print (strEn);
553
+ m_puart->print (" ," );
554
+ m_puart->println (mode);
555
+
556
+ data = recvString (" OK" , " FAIL" , 10000 );
557
+ if (data.indexOf (" OK" ) != -1 ) {
558
+ return true ;
559
+ }
560
+ return false ;
561
+ }
562
+
536
563
bool ESP8266::eATCWLAP (String &list)
537
564
{
538
565
String data;
Original file line number Diff line number Diff line change @@ -132,6 +132,17 @@ class ESP8266 {
132
132
*/
133
133
bool joinAP (String ssid, String pwd);
134
134
135
+
136
+ /* *
137
+ * Enable DHCP for client mode.
138
+ *
139
+ * @param mode - server mode (0=soft AP, 1=station, 2=both
140
+ * @param enabled - true if dhcp should be enabled, otherwise false
141
+ *
142
+ * @note This method will enable DHCP but only for client mode!
143
+ */
144
+ bool enableClientDHCP (uint8_t mode, boolean enabled);
145
+
135
146
/* *
136
147
* Leave AP joined before.
137
148
*
@@ -435,6 +446,7 @@ class ESP8266 {
435
446
bool qATCWMODE (uint8_t *mode);
436
447
bool sATCWMODE (uint8_t mode);
437
448
bool sATCWJAP (String ssid, String pwd);
449
+ bool sATCWDHCP (uint8_t mode, boolean enabled);
438
450
bool eATCWLAP (String &list);
439
451
bool eATCWQAP (void );
440
452
bool sATCWSAP (String ssid, String pwd, uint8_t chl, uint8_t ecn);
You can’t perform that action at this time.
0 commit comments