Merge branch 'feature/example_netbios' into 'master'

add netbios support in restful server example

Closes IDF-1070

See merge request espressif/esp-idf!6346
This commit is contained in:
Angus Gratton 2019-10-17 12:54:01 +08:00
commit 89d2e2a5e3
4 changed files with 8 additions and 1 deletions

View File

@ -20,6 +20,7 @@ set(srcs
"lwip/src/api/sockets.c"
"lwip/src/api/tcpip.c"
"lwip/src/apps/sntp/sntp.c"
"lwip/src/apps/netbiosns/netbiosns.c"
"lwip/src/core/def.c"
"lwip/src/core/dns.c"
"lwip/src/core/inet_chksum.c"

View File

@ -16,6 +16,7 @@ COMPONENT_SRCDIRS := \
apps/sntp \
lwip/src/api \
lwip/src/apps/sntp \
lwip/src/apps/netbiosns \
lwip/src/core \
lwip/src/core/ipv4 \
lwip/src/core/ipv6 \

View File

@ -108,6 +108,8 @@ openocd-esp32/bin/openocd -s openocd-esp32/share/openocd/scripts -f interface/ft
In your browser, enter the URL where the website located (e.g. `http://esp-home.local`). You can also enter the IP address that ESP32 obtained if your operating system currently don't have support for mDNS service.
Besides that, this example also enables the NetBIOS feature with the domain name `esp-home`. If your OS supports NetBIOS and has enabled it (e.g. Windows has native support for NetBIOS), then the URL `http://esp-home` should also work.
![esp_home_local](https://dl.espressif.com/dl/esp-idf/docs/_static/esp_home_local.gif)
### ESP monitor output

View File

@ -6,6 +6,7 @@
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "sdkconfig.h"
#include "driver/sdmmc_host.h"
#include "driver/gpio.h"
#include "esp_vfs_semihost.h"
@ -17,8 +18,8 @@
#include "esp_event.h"
#include "esp_log.h"
#include "mdns.h"
#include "lwip/apps/netbiosns.h"
#include "protocol_examples_common.h"
#include "sdkconfig.h"
#define MDNS_INSTANCE "esp home web server"
@ -126,6 +127,8 @@ void app_main(void)
tcpip_adapter_init();
ESP_ERROR_CHECK(esp_event_loop_create_default());
initialise_mdns();
netbiosns_init();
netbiosns_set_name(CONFIG_EXAMPLE_MDNS_HOST_NAME);
ESP_ERROR_CHECK(example_connect());
ESP_ERROR_CHECK(init_fs());