diff --git a/components/truma_inetbox/LinBusListener.cpp b/components/truma_inetbox/LinBusListener.cpp index e20ff59..5a16c0d 100644 --- a/components/truma_inetbox/LinBusListener.cpp +++ b/components/truma_inetbox/LinBusListener.cpp @@ -421,6 +421,16 @@ void LinBusListener::process_log_queue(TickType_t xTicksToWait) { } #ifdef USE_ESP32 +void LinBusListener::stream_send_test(const std::string &line) { + if (!this->stream_enabled_) return; + if (this->udp_sock_ < 0) this->stream_try_init_(); + if (this->udp_sock_ < 0) return; + std::string msg = line; + if (msg.empty()) msg = "STREAM TEST"; + msg.push_back('\n'); + ::sendto(this->udp_sock_, msg.c_str(), msg.size(), 0, (struct sockaddr *) &this->udp_addr_, sizeof(this->udp_addr_)); + this->last_stream_send_ms_ = millis(); +} void LinBusListener::stream_try_init_() { if (!this->stream_enabled_) return; if (this->udp_sock_ >= 0) return; diff --git a/components/truma_inetbox/LinBusListener.h b/components/truma_inetbox/LinBusListener.h index 6e25402..97c8cb0 100644 --- a/components/truma_inetbox/LinBusListener.h +++ b/components/truma_inetbox/LinBusListener.h @@ -48,6 +48,8 @@ class LinBusListener : public PollingComponent, public uart::UARTDevice { void set_fault_pin(GPIOPin *pin) { this->fault_pin_ = pin; } void set_observer_mode(bool val) { this->observer_mode_ = val; } bool get_lin_bus_fault() { return fault_on_lin_bus_reported_ > 3; } + // Send a manual UDP test line (when streaming is enabled) + void stream_send_test(const std::string &line); void process_lin_msg_queue(TickType_t xTicksToWait); void process_log_queue(TickType_t xTicksToWait);