Skip to content

Commit

Permalink
library:Net:code cleanup remove unsupported APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Ajay Bhargav <[email protected]>
  • Loading branch information
ajaybhargav committed Apr 8, 2023
1 parent 6d8e028 commit 9a0a1c8
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 51 deletions.
7 changes: 0 additions & 7 deletions libraries/Net/Net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,6 @@ bool NetworkClass::isDataReady(void)
return network_isready();
}

IPAddress NetworkClass::localIP(void)
{
const uint8_t *ip = network_getlocalip();

return IPAddress(ip[0], ip[1], ip[2], ip[3]);
}

IPAddress NetworkClass::resolve(const char *domain)
{
struct hostent *h = gethostbyname(domain);
Expand Down
1 change: 0 additions & 1 deletion libraries/Net/Net.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class NetworkClass
bool isGprsEnable(void);
bool GprsWaitForActivation(int timeout = 60000);
bool isGprsActive(void);
IPAddress localIP(void);
bool isDataEnable(void);
int DataEnable(void);
int DataDisable(void);
Expand Down
30 changes: 0 additions & 30 deletions libraries/Net/NetClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,36 +697,6 @@ uint16_t NetClient::remotePort() const
return remotePort(fd());
}

#if 0 /* TODO */
IPAddress NetClient::localIP(int fd) const
{
struct sockaddr_storage addr;
socklen_t len = sizeof addr;
getsockname(fd, (struct sockaddr *)&addr, &len);
struct sockaddr_in *s = (struct sockaddr_in *)&addr;
return IPAddress((uint32_t)(s->sin_addr.s_addr));
}

uint16_t NetClient::localPort(int fd) const
{
struct sockaddr_storage addr;
socklen_t len = sizeof addr;
getsockname(fd, (struct sockaddr *)&addr, &len);
struct sockaddr_in *s = (struct sockaddr_in *)&addr;
return ntohs(s->sin_port);
}

IPAddress NetClient::localIP() const
{
return localIP(fd());
}

uint16_t NetClient::localPort() const
{
return localPort(fd());
}
#endif

bool NetClient::operator==(const NetClient &rhs)
{
return clientSocketHandle == rhs.clientSocketHandle && remotePort() == rhs.remotePort() && remoteIP() == rhs.remoteIP();
Expand Down
6 changes: 0 additions & 6 deletions libraries/Net/NetClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ class NetClient : public LogicromClient
IPAddress remoteIP(int fd) const;
uint16_t remotePort() const;
uint16_t remotePort(int fd) const;
#if 0 /* TODO */
IPAddress localIP() const;
IPAddress localIP(int fd) const;
uint16_t localPort() const;
uint16_t localPort(int fd) const;
#endif

// friend class WiFiServer;
using Print::write;
Expand Down
3 changes: 0 additions & 3 deletions libraries/Net/examples/DomainResolve/DomainResolve.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ void setup()
/* Resolve if data connection ok */
if (Net.isDataReady())
{
IPAddress devip = Net.localIP();
printf("Device IP Address: %d.%d.%d.%d\n", devip[0], devip[1], devip[2], devip[3]);

/* Resolve google.com domain */
IPAddress ip = Net.resolve("google.com");
if (ip != IPADDR_NONE)
Expand Down
4 changes: 0 additions & 4 deletions libraries/Net/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ DataDisable KEYWORD2
isDataEnable KEYWORD2
waitDataReady KEYWORD2
isDataReady KEYWORD2
localIP KEYWORD2
getIMEI KEYWORD2
getIMSI KEYWORD2
getICCID KEYWORD2

#######################################
# Constants (LITERAL1)
Expand Down

0 comments on commit 9a0a1c8

Please sign in to comment.