Remove stuff that came from a different app when this was derived.

Prepare to add DNSServer for captive portal.
This commit is contained in:
David
2021-11-02 14:46:37 +00:00
parent 4597350845
commit a0825b629e
10 changed files with 602 additions and 208 deletions

View File

@@ -7,23 +7,51 @@
#include "Utility.h"
static String macToStr(const uint8_t * mac);
static String macToStr(const uint8_t * mac, char padd = ':');
String GetMacString() {
String GetMacString(char padd) {
unsigned char mac[6];
WiFi.macAddress(mac);
String clientMac(macToStr(mac));
String clientMac(macToStr(mac, padd));
return clientMac;
}
String macToStr(const uint8_t * mac) {
static String macToStr(const uint8_t * mac, char padd) {
String result;
for (int i = 0; i < 6; ++i) {
result += String(mac[i], 16);
if (i < 5)
result += ':';
if (i < 5) {
if (padd)
result += padd;
}
}
return result;
}
void HexDump(const char * title, const uint8_t * p, int count)
{
int i;
char buf[100] = "0000: ";
char asc[17] = " ";
if (*title) {
printf("%s [@%08X]\n", title, (uint32_t)p);
}
for (i=0; i<count; ) {
sprintf(buf + strlen(buf), "%02X ", *(p+i));
asc[i % 16] = isprint(*(p+i)) ? *(p+i) : '.';
if ((++i & 0x0F) == 0x00) {
printf("%-55s | %s |\n", buf, asc);
if (i < count) {
sprintf(buf, "%04X: ", i);
} else {
buf[0] = '\0';
asc[0] = '\0';
}
}
}
if (strlen(buf)) {
printf("%-55s | %s |\n", buf, asc);
}
}