From eef12d57d6b9f885293f0483f56b12e065318639 Mon Sep 17 00:00:00 2001 From: Sasha Kovar Date: Sat, 27 Apr 2024 22:51:43 -1000 Subject: [PATCH 1/3] Add more MDNS functions --- common/forth_namespace_tests.fs | 3 +++ esp32/builtins.h | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/forth_namespace_tests.fs b/common/forth_namespace_tests.fs index efd6312..4a8da26 100644 --- a/common/forth_namespace_tests.fs +++ b/common/forth_namespace_tests.fs @@ -688,6 +688,9 @@ e: check-esp32-builtins check-files-dir-reverse out: dacWrite out: MDNS.begin + out: MDNS.addService + out: MDNS.setInstanceName + out: MDNS.addServiceTxt ;e e: check-esp32-bindings diff --git a/esp32/builtins.h b/esp32/builtins.h index 74b37a6..ac353f2 100644 --- a/esp32/builtins.h +++ b/esp32/builtins.h @@ -425,5 +425,9 @@ static cell_t FromIP(IPAddress ip) { # endif # define OPTIONAL_MDNS_SUPPORT \ /* mDNS */ \ - X("MDNS.begin", MDNS_BEGIN, n0 = MDNS.begin(c0)) + X("MDNS.begin", MDNS_BEGIN, n0 = MDNS.begin(c0)) \ + X("MDNS.addService", MDNS_ADD_SERVICE, n0 = MDNS.addService(c2, c1, n0); NIPn(2)) \ + X("MDNS.setInstanceName", MDNS_SET_INSTANCE_NAME, MDNS.setInstanceName(c0); DROP) \ + X("MDNS.addServiceTxt", MDNS_ADD_SERVICE_TXT, MDNS.addServiceTxt(c3, c2, c1, c0); DROPn(4)) + /* alx */ #endif From e3ddba4ce811d594c75c0b760b210da129b30484 Mon Sep 17 00:00:00 2001 From: Sasha Kovar Date: Sun, 28 Apr 2024 18:13:19 -1000 Subject: [PATCH 2/3] Convert Arduino bool values to forth flags --- esp32/builtins.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esp32/builtins.h b/esp32/builtins.h index ac353f2..6ce4199 100644 --- a/esp32/builtins.h +++ b/esp32/builtins.h @@ -425,8 +425,8 @@ static cell_t FromIP(IPAddress ip) { # endif # define OPTIONAL_MDNS_SUPPORT \ /* mDNS */ \ - X("MDNS.begin", MDNS_BEGIN, n0 = MDNS.begin(c0)) \ - X("MDNS.addService", MDNS_ADD_SERVICE, n0 = MDNS.addService(c2, c1, n0); NIPn(2)) \ + X("MDNS.begin", MDNS_BEGIN, n0 = MDNS.begin(c0) ? -1 : 0) \ + X("MDNS.addService", MDNS_ADD_SERVICE, n0 = MDNS.addService(c2, c1, n0) ? -1 : 0; NIPn(2)) \ X("MDNS.setInstanceName", MDNS_SET_INSTANCE_NAME, MDNS.setInstanceName(c0); DROP) \ X("MDNS.addServiceTxt", MDNS_ADD_SERVICE_TXT, MDNS.addServiceTxt(c3, c2, c1, c0); DROPn(4)) /* alx */ From d76eec1a6911b7bd918448e471c431f9b608dacc Mon Sep 17 00:00:00 2001 From: Sasha Kovar Date: Sun, 28 Apr 2024 18:14:01 -1000 Subject: [PATCH 3/3] Update documentation --- site/ESP32forth.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site/ESP32forth.html b/site/ESP32forth.html index 507ef53..6ede5a0 100644 --- a/site/ESP32forth.html +++ b/site/ESP32forth.html @@ -472,7 +472,10 @@
WiFi
mDNS
-MDNS.begin ( name-z -- )   Start multicast dns
+MDNS.begin ( hostname-z -- f )   Start multicast dns
+MDNS.setInstanceName ( name-z -- )   Set the instance (friendly) name
+MDNS.addService ( service-z protocol-z port-n -- f )   Advertise a service (such as "http") using a protocol ("tcp" or "udp") and a port number.
+MDNS.addServiceTxt ( service-z protocol-z key-z value-z -- )   Add a service key/value pair
 
SPIFFS