Fork of NTPClient from ST, modified to work with GCC and Mbed OS5

Fork of NTPClient by ST

Files at this revision

API Documentation at this revision

Comitter:
Vergil Cola
Date:
Wed Feb 15 10:48:52 2017 +0800
Parent:
7:2ac816b0f4ab
Commit message:
Update for Mbed OS 5

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 0b96fbd7cfca NTPClient.cpp
--- a/NTPClient.cpp	Tue Jan 03 13:28:59 2017 +0000
+++ b/NTPClient.cpp	Wed Feb 15 10:48:52 2017 +0800
@@ -33,7 +33,7 @@
 #define ERR(x, ...) 
 
 #endif
-#include "NetworkStack.h"
+#include "NetworkInterface.h"
 #include "NTPClient.h"
 
 #include "UDPSocket.h"
@@ -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) {
diff -r 2ac816b0f4ab -r 0b96fbd7cfca NTPClient.h
--- a/NTPClient.h	Tue Jan 03 13:28:59 2017 +0000
+++ b/NTPClient.h	Wed Feb 15 10:48:52 2017 +0800
@@ -24,13 +24,14 @@
 #ifndef NTPCLIENT_H_
 #define NTPCLIENT_H_
 
-#include <cstdint>
+#include <stdint.h>
 
-using std::uint8_t;
-using std::uint16_t;
-using std::uint32_t;
+//using std::uint8_t;
+//using std::uint16_t;
+//using std::uint32_t;
 
 #include "UDPSocket.h"
+#include "NetworkInterface.h"
 
 #define NTP_DEFAULT_PORT 123
 #define NTP_DEFAULT_TIMEOUT 4000
@@ -55,7 +56,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 +95,7 @@
     uint32_t txTm_f;
   } __attribute__ ((packed));
   
-  NetworkStack & m_intf;  // WiFi interface  
+  NetworkInterface & m_intf;  // WiFi interface  
   UDPSocket m_sock;
 };