1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-06 05:21:22 +03:00

emulation on host: missing mock functions, improve host interface handling (#7404)

This commit is contained in:
david gauchard 2020-06-24 19:05:57 +02:00 committed by GitHub
parent b26388812a
commit 5d60c55fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 411 additions and 388 deletions

View File

@ -108,6 +108,11 @@ uint32_t EspClass::getFreeHeap()
return 30000;
}
uint16_t EspClass::getMaxFreeBlockSize()
{
return 20000;
}
String EspClass::getResetReason()
{
return "Power on";

View File

@ -145,3 +145,8 @@ void WiFiServer::close ()
::close(pcb2int(_listen_pcb));
_listen_pcb = int2pcb(-1);
}
void WiFiServer::stop ()
{
close();
}

View File

@ -135,10 +135,9 @@ bool wifi_get_ip_info (uint8 if_index, struct ip_info *info)
perror("getifaddrs");
exit(EXIT_FAILURE);
}
if (host_interface)
mockverbose("host: looking for interface '%s':\n", host_interface);
else
mockverbose("host: looking the first for non-local IPv4 interface:\n");
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next)
{
mockverbose("host: interface: %s", ifa->ifa_name);
@ -159,6 +158,7 @@ bool wifi_get_ip_info (uint8 if_index, struct ip_info *info)
ipv4 = *(uint32_t*) & ((struct sockaddr_in*)ifa->ifa_addr)->sin_addr;
mask = *(uint32_t*) & ((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr;
mockverbose(" (selected)\n");
if (host_interface)
global_source_address = ntohl(ipv4);
break;
}
@ -166,6 +166,7 @@ bool wifi_get_ip_info (uint8 if_index, struct ip_info *info)
}
mockverbose("\n");
}
if (ifAddrStruct != NULL)
freeifaddrs(ifAddrStruct);

View File

@ -8,23 +8,35 @@ pwd
test -d cores/esp8266
test -d libraries
#all="cores/esp8266 libraries"
# should be: all="cores/esp8266 libraries"
all="
libraries/ESP8266mDNS
libraries/Wire
cores/esp8266/core_esp8266_si2c.cpp
"
# core
for d in $all; do
if [ -d "$d" ]; then
echo "-------- directory $d:"
for e in c cpp h; do
find $d -name "*.$e" -exec \
astyle \
--suffix=none \
--options=${org}/astyle_core.conf {} \;
done
else
echo "-------- file $d:"
astyle --suffix=none --options=${org}/astyle_core.conf "$d"
fi
done
# examples
for d in libraries; do
echo "-------- examples in $d:"
find $d -name "*.ino" -exec \
astyle \
--suffix=none \