mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
emulation on host: missing mock functions, improve host interface handling (#7404)
This commit is contained in:
parent
b26388812a
commit
5d60c55fb2
@ -108,6 +108,11 @@ uint32_t EspClass::getFreeHeap()
|
|||||||
return 30000;
|
return 30000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t EspClass::getMaxFreeBlockSize()
|
||||||
|
{
|
||||||
|
return 20000;
|
||||||
|
}
|
||||||
|
|
||||||
String EspClass::getResetReason()
|
String EspClass::getResetReason()
|
||||||
{
|
{
|
||||||
return "Power on";
|
return "Power on";
|
||||||
|
@ -145,3 +145,8 @@ void WiFiServer::close ()
|
|||||||
::close(pcb2int(_listen_pcb));
|
::close(pcb2int(_listen_pcb));
|
||||||
_listen_pcb = int2pcb(-1);
|
_listen_pcb = int2pcb(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WiFiServer::stop ()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
@ -135,10 +135,9 @@ bool wifi_get_ip_info (uint8 if_index, struct ip_info *info)
|
|||||||
perror("getifaddrs");
|
perror("getifaddrs");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host_interface)
|
if (host_interface)
|
||||||
mockverbose("host: looking for interface '%s':\n", 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)
|
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next)
|
||||||
{
|
{
|
||||||
mockverbose("host: interface: %s", ifa->ifa_name);
|
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;
|
ipv4 = *(uint32_t*) & ((struct sockaddr_in*)ifa->ifa_addr)->sin_addr;
|
||||||
mask = *(uint32_t*) & ((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr;
|
mask = *(uint32_t*) & ((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr;
|
||||||
mockverbose(" (selected)\n");
|
mockverbose(" (selected)\n");
|
||||||
|
if (host_interface)
|
||||||
global_source_address = ntohl(ipv4);
|
global_source_address = ntohl(ipv4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -166,6 +166,7 @@ bool wifi_get_ip_info (uint8 if_index, struct ip_info *info)
|
|||||||
}
|
}
|
||||||
mockverbose("\n");
|
mockverbose("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifAddrStruct != NULL)
|
if (ifAddrStruct != NULL)
|
||||||
freeifaddrs(ifAddrStruct);
|
freeifaddrs(ifAddrStruct);
|
||||||
|
|
||||||
|
@ -8,23 +8,35 @@ pwd
|
|||||||
test -d cores/esp8266
|
test -d cores/esp8266
|
||||||
test -d libraries
|
test -d libraries
|
||||||
|
|
||||||
#all="cores/esp8266 libraries"
|
# should be: all="cores/esp8266 libraries"
|
||||||
|
|
||||||
all="
|
all="
|
||||||
libraries/ESP8266mDNS
|
libraries/ESP8266mDNS
|
||||||
libraries/Wire
|
libraries/Wire
|
||||||
cores/esp8266/core_esp8266_si2c.cpp
|
cores/esp8266/core_esp8266_si2c.cpp
|
||||||
"
|
"
|
||||||
|
|
||||||
|
# core
|
||||||
|
|
||||||
for d in $all; do
|
for d in $all; do
|
||||||
|
if [ -d "$d" ]; then
|
||||||
|
echo "-------- directory $d:"
|
||||||
for e in c cpp h; do
|
for e in c cpp h; do
|
||||||
find $d -name "*.$e" -exec \
|
find $d -name "*.$e" -exec \
|
||||||
astyle \
|
astyle \
|
||||||
--suffix=none \
|
--suffix=none \
|
||||||
--options=${org}/astyle_core.conf {} \;
|
--options=${org}/astyle_core.conf {} \;
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
echo "-------- file $d:"
|
||||||
|
astyle --suffix=none --options=${org}/astyle_core.conf "$d"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# examples
|
||||||
|
|
||||||
for d in libraries; do
|
for d in libraries; do
|
||||||
|
echo "-------- examples in $d:"
|
||||||
find $d -name "*.ino" -exec \
|
find $d -name "*.ino" -exec \
|
||||||
astyle \
|
astyle \
|
||||||
--suffix=none \
|
--suffix=none \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user