diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index e49dd677e9..a8eacc18cb 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -1573,9 +1573,9 @@ static enums::SerialProxyStatus serial_proxy_result_to_status(serial_proxy::Seri case serial_proxy::SerialProxyResult::SERIAL_PROXY_RESULT_NOT_SUPPORTED: return enums::SERIAL_PROXY_STATUS_NOT_SUPPORTED; case serial_proxy::SerialProxyResult::SERIAL_PROXY_RESULT_ERROR: - default: return enums::SERIAL_PROXY_STATUS_ERROR; } + return enums::SERIAL_PROXY_STATUS_ERROR; // Unreachable; all enum values handled above } static void send_serial_proxy_ack(APIConnection *conn, uint32_t instance, enums::SerialProxyRequestType type, diff --git a/tests/benchmarks/components/api/__init__.py b/tests/benchmarks/components/api/__init__.py index 0d02e0b054..0565bc5330 100644 --- a/tests/benchmarks/components/api/__init__.py +++ b/tests/benchmarks/components/api/__init__.py @@ -15,6 +15,7 @@ def override_manifest(manifest: ComponentManifestOverride) -> None: # components have hardware dependencies (BLE/UART/RMT); lightweight # stub headers in tests/benchmarks/stubs/ satisfy the includes. cg.add_define("USE_BLUETOOTH_PROXY") + cg.add_define("USE_BLUETOOTH_PROXY_CONNECTIONS") cg.add_define("BLUETOOTH_PROXY_MAX_CONNECTIONS", 3) cg.add_define("BLUETOOTH_PROXY_ADVERTISEMENT_BATCH_SIZE", 16) cg.add_define("USE_ZWAVE_PROXY") diff --git a/tests/benchmarks/stubs/esphome/components/serial_proxy/serial_proxy.h b/tests/benchmarks/stubs/esphome/components/serial_proxy/serial_proxy.h index d8b068fb36..56cb37250d 100644 --- a/tests/benchmarks/stubs/esphome/components/serial_proxy/serial_proxy.h +++ b/tests/benchmarks/stubs/esphome/components/serial_proxy/serial_proxy.h @@ -24,6 +24,16 @@ enum class UARTFlushResult : uint8_t { namespace serial_proxy { +enum class SerialProxyResult : uint8_t { + SERIAL_PROXY_RESULT_OK, + SERIAL_PROXY_RESULT_ASSUMED_SUCCESS, + SERIAL_PROXY_RESULT_PORT_IN_USE, + SERIAL_PROXY_RESULT_INVALID_ARGUMENT, + SERIAL_PROXY_RESULT_ERROR, + SERIAL_PROXY_RESULT_TIMEOUT, + SERIAL_PROXY_RESULT_NOT_SUPPORTED, +}; + class SerialProxy { public: void set_instance_index(uint32_t index) { this->instance_index_ = index; } @@ -31,13 +41,20 @@ class SerialProxy { const char *get_name() const { return ""; } api::enums::SerialProxyPortType get_port_type() const { return {}; } api::APIConnection *get_api_connection() { return nullptr; } - void serial_proxy_request(api::APIConnection *conn, api::enums::SerialProxyRequestType type) {} - void configure(api::APIConnection *api_connection, uint32_t baudrate, bool flow_control, uint8_t parity, - uint32_t stop_bits, uint32_t data_size) {} + SerialProxyResult serial_proxy_request(api::APIConnection *conn, api::enums::SerialProxyRequestType type) { + return SerialProxyResult::SERIAL_PROXY_RESULT_OK; + } + SerialProxyResult configure(api::APIConnection *api_connection, uint32_t baudrate, bool flow_control, uint8_t parity, + uint32_t stop_bits, uint32_t data_size) { + return SerialProxyResult::SERIAL_PROXY_RESULT_OK; + } void write_from_client(api::APIConnection *api_connection, const uint8_t *data, size_t len) {} - void set_modem_pins(api::APIConnection *api_connection, uint32_t line_states) {} + SerialProxyResult set_modem_pins(api::APIConnection *api_connection, uint32_t line_states) { + return SerialProxyResult::SERIAL_PROXY_RESULT_OK; + } uint32_t get_modem_pins() const { return 0; } - uart::UARTFlushResult flush_port() { return uart::UARTFlushResult::UART_FLUSH_RESULT_SUCCESS; } + uint32_t get_configured_modem_pins() const { return 0; } + SerialProxyResult flush_port(api::APIConnection *api_connection) { return SerialProxyResult::SERIAL_PROXY_RESULT_OK; } protected: uint32_t instance_index_{0}; diff --git a/tests/benchmarks/stubs/esphome/components/zwave_proxy/zwave_proxy.h b/tests/benchmarks/stubs/esphome/components/zwave_proxy/zwave_proxy.h index b4ccd8fd00..3abbf7d257 100644 --- a/tests/benchmarks/stubs/esphome/components/zwave_proxy/zwave_proxy.h +++ b/tests/benchmarks/stubs/esphome/components/zwave_proxy/zwave_proxy.h @@ -15,7 +15,9 @@ namespace zwave_proxy { class ZWaveProxy { public: api::APIConnection *get_api_connection() { return nullptr; } - void zwave_proxy_request(api::APIConnection *conn, api::enums::ZWaveProxyRequestType type) {} + api::enums::ZWaveProxyStatus zwave_proxy_request(api::APIConnection *conn, api::enums::ZWaveProxyRequestType type) { + return api::enums::ZWAVE_PROXY_STATUS_OK; + } void send_frame(api::APIConnection *api_connection, const uint8_t *data, size_t length) {} void api_connection_authenticated(api::APIConnection *conn) {} uint32_t get_feature_flags() const { return 0; }