Changes required by X-NUCLEO-IDWM01M1 and mbed-os 5.2.2
Dependents: X_NUCLEO_IDW01M1v2-lapi-1
Fork of SPWF01SA by
Revision 5:f17d6351e942, committed 2016-06-30
- Comitter:
- mridup
- Date:
- Thu Jun 30 08:54:08 2016 +0000
- Parent:
- 4:042d5b9bb6e7
- Child:
- 6:258b093eec08
- Commit message:
- SPWF DHCP config support
Changed in this revision
SPWFSA01.cpp | Show annotated file Show diff for this revision Revisions of this file |
SPWFSA01.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SPWFSA01.cpp Thu Jun 30 08:42:47 2016 +0000 +++ b/SPWFSA01.cpp Thu Jun 30 08:54:08 2016 +0000 @@ -183,14 +183,15 @@ return true; } -bool SPWFSA01::dhcp(bool enabled, int mode) +bool SPWFSA01::dhcp(int mode) { //only 3 valid modes + //0->off(ip_addr must be set by user), 1->on(auto set by AP), 2->on&customize(miniAP ip_addr can be set by user) if(mode < 0 || mode > 2) { return false; } - - return _parser.send("AT+CWDHCP=%d,%d", enabled?1:0, mode) + + return _parser.send("AT+S.SCFG=ip_use_dhcp,%d\r", mode) && _parser.recv("OK"); }
--- a/SPWFSA01.h Thu Jun 30 08:42:47 2016 +0000 +++ b/SPWFSA01.h Thu Jun 30 08:54:08 2016 +0000 @@ -48,11 +48,10 @@ /** * Enable/Disable DHCP * - * @param enabled DHCP enabled when true - * @param mode mode of DHCP 0-softAP, 1-station, 2-both + * @param mode mode of DHCP 2-softAP, 1-on, 0-off * @return true only if SPWFSA01 enables/disables DHCP successfully */ - bool dhcp(bool enabled, int mode); + bool dhcp(int mode); /** * Connect SPWFSA01 to AP @@ -95,8 +94,8 @@ /** * Open a socketed connection * - * @param type the type of socket to open "UDP" or "TCP" - * @param id id to give the new socket, valid 0-4 + * @param type the type of socket to open "u" (UDP) or "t" (TCP) + * @param id id to get the new socket number, valid 0-7 * @param port port to open connection with * @param addr the IP address of the destination * @return true only if socket opened successfully