truma_inetbox: add stream_send_test() helper to trigger a UDP test line
This commit is contained in:
parent
9e07fb6953
commit
99249dfaa9
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user