mbed os 5 & accept pointer interface for ethernet and wifi
Revision 8:f31bb718d362, committed 2018-12-10
- Comitter:
- ibiltari
- Date:
- Mon Dec 10 22:35:07 2018 +0000
- Parent:
- 7:2ac816b0f4ab
- Commit message:
- mbed 5 gcc & pointer interface
Changed in this revision
NTPClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
NTPClient.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2ac816b0f4ab -r f31bb718d362 NTPClient.cpp --- a/NTPClient.cpp Tue Jan 03 13:28:59 2017 +0000 +++ b/NTPClient.cpp Mon Dec 10 22:35:07 2018 +0000 @@ -49,7 +49,7 @@ }*/ -NTPClient::NTPClient(NetworkStack & _m_intf) : m_intf(_m_intf) +NTPClient::NTPClient(NetworkInterface *m_intf) : m_intf( m_intf) { } @@ -97,7 +97,7 @@ #endif SocketAddress address(0, port); - int r = m_intf.gethostbyname(&address, host); + int r = m_intf->gethostbyname(host, &address); if (r) { printf("error: 'gethostbyname(\"%s\")' failed with code %d\r\n", host, r); } else if (!address) { @@ -106,7 +106,7 @@ //printf ("address: %s\n\r",address.get_ip_address()); //Create & bind socket - if (m_sock.open(&m_intf) < 0) printf ("ERROR sock open \n\r"); + if (m_sock.open(m_intf) < 0) printf ("ERROR sock open \n\r"); m_sock.set_timeout(timeout); struct NTPPacket pkt;
diff -r 2ac816b0f4ab -r f31bb718d362 NTPClient.h --- a/NTPClient.h Tue Jan 03 13:28:59 2017 +0000 +++ b/NTPClient.h Mon Dec 10 22:35:07 2018 +0000 @@ -55,7 +55,7 @@ Instantiate the NTP client */ // NTPClient(); - NTPClient(NetworkStack & _m_intf); + NTPClient(NetworkInterface *m_intf); /**Get current time (blocking) Update the time using the server host Blocks until completion @@ -94,7 +94,7 @@ uint32_t txTm_f; } __attribute__ ((packed)); - NetworkStack & m_intf; // WiFi interface + NetworkInterface *m_intf; // WiFi interface UDPSocket m_sock; };