I'm using ESP8266Ping lib inside my iot lib which hanldes Wifi connectivity and MQTT messages. Since it create its own instance called Ping when calling #include <ESP8266Ping.h>- it had to be place in iot.cpp.
I writing another library, IPmonitor which checks clients on the network (using pings), I wanted to use ESP8266Ping again.
My sketch file, create an instance of iot and IPmonitor for check/ log errors on monitored clients.
But I get error of using the same library twice.
I guess that since ESP8366Ping.h library is defined it creates an instance of the class ( see mark below ):
class PingClass {
public:
PingClass();
bool ping(IPAddress dest, byte count = 5);
bool ping(const char* host, byte count = 5);
int averageTime();
protected:
static void _ping_sent_cb(void *opt, void *pdata);
static void _ping_recv_cb(void *opt, void *pdata);
IPAddress _dest;
ping_option _options;
static byte _expected_count, _errors, _success;
static int _avg_time;
};
#include "ESP8266Ping.impl.h"
PingClass Ping; // <----- This
#endif
How can it be solved ?