Merge pull request #17094 from s-hadinger/berry_udp_stop

Berry add ``udp->stop()`` method
This commit is contained in:
s-hadinger 2022-11-15 23:41:41 +01:00 committed by GitHub
commit 1162c36fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -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

View File

@ -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 */