1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-10-19 21:09:48 +03:00

LEAmDNS - Multicast DNS Responder (#5442)

* LEAmDNS Responder (II)

Created a new branch to solve commit conflicts with recent changes to ESP8266mDNSResponder.cpp by d-a-v.

* Removed millis() roll-over issues

* fix LEA-mDNS

* astyle on lea-mdns examples

* add compatibility with lwIP-v1

* ditto

* use strncasecmp instead of lwip's strnicmp from lwIP-v2 (thanks @devyte)

* ditto

* fixes

* Update mDNS_Clock.ino

unindent

* Update mDNS_ServiceMonitor.ino

unindent

* Update LEAmDNS.h

Add setInstanceName() forwarder for compat

* Disable DEBUG_ESP_MDNS_RESPONDER by default

* [Fixed] Debug output line

DEBUG_OUTPUT needs to go inside DEBUG_EX_ function otherwise throw error if DEBUG_ESP_MDNS_RESPONDER is not defined
This commit is contained in:
LaborEtArs
2018-12-05 20:51:01 +01:00
committed by Develo
parent e043806065
commit 58a044b254
17 changed files with 9663 additions and 7 deletions

View File

@@ -0,0 +1,62 @@
/*
* LEATimeFlag.h
*/
#ifndef __LEATIMEFLAG_H
#define __LEATIMEFLAG_H
#include <Arduino.h>
/**
* clsLEATimeFlag
*/
class clsLEATimeFlag {
public:
// constructor
clsLEATimeFlag(unsigned long p_ulTimeout = (unsigned long)(-1))
: m_ulStart(millis()),
m_ulTimeout(p_ulTimeout) {
}
// operator bool
operator bool(void) const {
return flagged();
}
// flagged
bool flagged(void) const {
return ((millis() - m_ulStart) > m_ulTimeout);
}
// restart
void restart(unsigned long p_ulNewTimeout = (unsigned long)(-1)) {
if ((unsigned long)(-1) != p_ulNewTimeout) {
m_ulTimeout = p_ulNewTimeout;
}
m_ulStart = millis();
}
void reset(void) {
m_ulTimeout = (unsigned long)(-1);
m_ulStart = millis();
}
unsigned long start(void) const {
return m_ulStart;
}
unsigned long timeout(void) const {
return m_ulTimeout;
}
bool hypotheticalTimeout(unsigned long p_ulHypotheticalTimeout) const {
return ((millis() - m_ulStart) > p_ulHypotheticalTimeout);
}
protected:
unsigned long m_ulStart;
unsigned long m_ulTimeout;
};
#endif // __LEATIMEFLAG_H