From f7fa09ebbef2728ab7fb3c56b01ce38b4d6eaadc Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 15 Nov 2022 23:28:34 +0100 Subject: [PATCH] Berry add ``udp->stop()`` method --- CHANGELOG.md | 1 + lib/libesp32/berry_tasmota/src/be_udp_lib.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c9543344..6d54b3036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - WS2812 and Light Art-Net DMX control over UDP port 6454 (#17059) - Command ``SwitchMode 16`` sending only MQTT message on inverted switch change (#17028) - Support for HMC5883L 3-Axis Digital Compass sensor by Andreas Achtzehn (#17069) +- Berry add ``udp->stop()`` method ### Breaking Changed diff --git a/lib/libesp32/berry_tasmota/src/be_udp_lib.cpp b/lib/libesp32/berry_tasmota/src/be_udp_lib.cpp index 4186673c5..489be4005 100644 --- a/lib/libesp32/berry_tasmota/src/be_udp_lib.cpp +++ b/lib/libesp32/berry_tasmota/src/be_udp_lib.cpp @@ -37,7 +37,7 @@ extern "C" { return be_call_c_func(vm, (void*) &be_udp_deinit_ntv, "=.p", ""); } - // udp.begin(address:string, port:int) -> nil + // udp.begin(address:string, port:int) -> bool int32_t be_udp_begin_ntv(WiFiUDP *udp, const char *host, int32_t port) { IPAddress addr((uint32_t)0); // if no host or host is "" then we defult to INADDR_ANY (0.0.0.0) @@ -50,6 +50,14 @@ extern "C" { return be_call_c_func(vm, (void*) &be_udp_begin_ntv, "b", ".si"); } + // udp.stop() -> nil + void be_udp_stop_ntv(WiFiUDP *udp) { + udp->stop(); + } + int32_t be_udp_stop(struct bvm *vm) { + return be_call_c_func(vm, (void*) &be_udp_stop_ntv, "b", "."); + } + // udp.begin_multicast(address:string, port:int) -> nil int32_t be_udp_begin_mcast_ntv(WiFiUDP *udp, const char *host, int32_t port) { IPAddress addr((uint32_t)0); @@ -159,6 +167,7 @@ class be_class_udp (scope: global, name: udp) { begin, func(be_udp_begin) begin_multicast, func(be_udp_begin_mcast) read, func(be_udp_read) + stop, func(be_udp_stop) } @const_object_info_end */