Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
Diff: NetworkInterface.cpp
- Branch:
- api-changes
- Revision:
- 39:47138420ea42
- Parent:
- 31:7f15b95f2a1d
- Child:
- 41:3ec1c97e9bbf
diff -r 157fb2ab965f -r 47138420ea42 NetworkInterface.cpp
--- a/NetworkInterface.cpp Mon Feb 22 20:51:09 2016 -0600
+++ b/NetworkInterface.cpp Mon Feb 22 21:50:15 2016 -0600
@@ -26,6 +26,13 @@
memset(_gateway, 0, SOCK_IP_SIZE);
}
+void NetworkInterface::useDHCP()
+{
+ memset(_ip_address, 0, SOCK_IP_SIZE);
+ memset(_network_mask, 0, SOCK_IP_SIZE);
+ memset(_gateway, 0, SOCK_IP_SIZE);
+}
+
void NetworkInterface::setIPAddress(const char *ip)
{
strcpy(_ip_address, ip);
@@ -43,17 +50,29 @@
const char *NetworkInterface::getIPAddress()
{
- return _ip_address;
+ if (_ip_address[0]) {
+ return _ip_address;
+ } else {
+ return 0;
+ }
}
const char *NetworkInterface::getNetworkMask()
{
- return _network_mask;
+ if (_network_mask[0]) {
+ return _network_mask;
+ } else {
+ return 0;
+ }
}
const char *NetworkInterface::getGateway()
{
- return _gateway;
+ if (_gateway[0]) {
+ return _gateway;
+ } else {
+ return 0;
+ }
}
bool NetworkInterface::isConnected()
