I am adding some methods to the NTPClient by creating a derived class MyNTP.
But now, I can't figure out how to invoke the new class. That is, I can't figure out how to write the constructor for this.
NTPClient.h contains a bunch of constructors...
1 2 3 4 5 6 7 8
|
NTPClient(UDP &udp);
NTPClient(UDP &udp, long timeOffset);
NTPClient(UDP &udp, const char *poolServerName);
NTPClient(UDP &udp, const char *poolServerName, long timeOffset);
NTPClient(UDP &udp, const char *poolServerName, long timeOffset, unsigned long updateInterval);
NTPClient(UDP &udp, IPAddress poolServerIP);
NTPClient(UDP &udp, IPAddress poolServerIP, long timeOffset);
NTPClient(UDP &udp, IPAddress poolServerIP, long timeOffset, unsigned long updateInterval);
|
But lets just focus on the first, and simplist of these constructors.
In NTPClient.cpp it is defined as:
1 2 3
|
NTPClient::NTPClient(UDP& udp) {
this->_udp = &udp;
}
|
So, I create MyNPT.cpp with the following constructor:
1 2 3 4 5 6 7 8
|
#include "Arduino.h"
#include "NTPClient.h"
#include "MYNPT.h"
void MyNPT(UDP& udp)
: NTPClient(udp)
{
}
|
and MyNPT.h as follows
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#ifndef _MY_NTP_H_
#define _MY_NTP_H_
#include "Arduino.h"
#include "NTPClient.h"
#include <Udp.h>
class MyNTP : public NTPClient
{
public:
void MyNPT(UDP& udp);
};
#endif //_MY_NTP_H_
|
and I get the following errors...
1: MyNPT.h " Function definition for 'MyNPT' not found. "
2: MyNPT.cpp At the ":" " expected a '{' "
This shouldn't be this hard.. What am I missing?
THANKS!