Poerting the Xbee library to use teh wifi functionality of the LPC4088.
Dependents: XBee_WiFi_EA_LPC4088
Fork of XBee by
Diff: XBeeWiFi.cpp
- Revision:
- 5:547cfff7adf7
- Parent:
- 4:f6d73acc1f75
- Child:
- 6:6f84e2840408
--- a/XBeeWiFi.cpp Tue Mar 13 09:01:52 2012 +0000 +++ b/XBeeWiFi.cpp Tue Mar 13 09:11:35 2012 +0000 @@ -122,6 +122,9 @@ char val[1] = {0}; AtCommandRequest atRequest; + _nameserver = IpAddr(0,0,0,0); + _nameport = DNS_PORT; + atRequest.setCommand(cmd); atRequest.setCommandValue((uint8_t*)val); atRequest.setCommandValueLength(1); @@ -178,6 +181,7 @@ // name server _nameserver = nameserver; + _nameport = DNS_PORT; return 0; } @@ -306,8 +310,9 @@ } #ifdef USE_WIFIDNS -int XBeeWiFi::setNameserver (IpAddr &nameserver) { +int XBeeWiFi::setNameserver (IpAddr &nameserver, int port = DNS_PORT) { _nameserver = nameserver; + _nameport = port; return 0; } @@ -326,7 +331,7 @@ addr = IpAddr(127, 0, 0, 1); return 0; } -/* + // bind src port val[0] = (DNS_SRC_PORT >> 8) & 0xff; val[1] = DNS_SRC_PORT & 0xff; @@ -337,11 +342,11 @@ send(atRequest); r = getWiResponse(AT_COMMAND_RESPONSE); DBG("wifi C0: %d\r\n", r); -*/ + // send DNS request len = createDnsRequest(name, buf); dnsRequest.setAddress(_nameserver); - dnsRequest.setDstPort(DNS_PORT); + dnsRequest.setDstPort(_nameport); dnsRequest.setSrcPort(DNS_SRC_PORT); dnsRequest.setProtocol(PROTOCOL_UDP); dnsRequest.setPayload((uint8_t*)buf);