diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel b/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel index 2ebc3beceba..5488bd63368 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/BUILD.bazel @@ -299,6 +299,7 @@ cf_cc_library( deps = [ "//cuttlefish/common/libs/fs", "//cuttlefish/common/libs/utils:files", + "//cuttlefish/host/commands/run_cvd/launch:grpc_socket_creator", "//cuttlefish/host/libs/config:config_utils", "//cuttlefish/host/libs/config:cuttlefish_config", "//cuttlefish/host/libs/config:known_paths", diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.cpp b/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.cpp index 2c538f230b0..b896d9432d8 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.cpp +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.cpp @@ -26,6 +26,7 @@ #include "cuttlefish/common/libs/fs/shared_fd.h" #include "cuttlefish/common/libs/utils/files.h" +#include "cuttlefish/host/commands/run_cvd/launch/grpc_socket_creator.h" #include "cuttlefish/host/libs/config/config_utils.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" #include "cuttlefish/host/libs/config/known_paths.h" @@ -94,8 +95,9 @@ class Device { class NetsimServer : public CommandSource { public: INJECT(NetsimServer(const CuttlefishConfig& config, - const CuttlefishConfig::InstanceSpecific& instance)) - : config_(config), instance_(instance) {} + const CuttlefishConfig::InstanceSpecific& instance, + GrpcSocketCreator& grpc_socket)) + : config_(config), instance_(instance), grpc_socket_(grpc_socket) {} // CommandSource Result> Commands() override { @@ -107,6 +109,11 @@ class NetsimServer : public CommandSource { // Port configuration. netsimd.AddParameter("--hci_port=", config_.rootcanal_hci_port()); + if (config_.netsim_radio_enabled(CuttlefishConfig::NetsimRadio::Nfc)) { + netsimd.AddParameter("--grpc_uds_path=", grpc_socket_.CreateGrpcSocket( + "NetsimControlServer")); + } + // When no connector is requested, add the instance number if (config_.netsim_connector_instance_num() == config_.netsim_instance_num()) { @@ -229,12 +236,14 @@ class NetsimServer : public CommandSource { std::vector devices_; const CuttlefishConfig& config_; const CuttlefishConfig::InstanceSpecific instance_; + GrpcSocketCreator& grpc_socket_; }; } // namespace fruit::Component> + const CuttlefishConfig::InstanceSpecific, + GrpcSocketCreator>> NetsimServerComponent() { return fruit::createComponent() .addMultibinding() diff --git a/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.h b/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.h index 65c0640ffcd..9dcf3e4a54b 100644 --- a/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.h +++ b/base/cvd/cuttlefish/host/commands/run_cvd/launch/netsim_server.h @@ -17,12 +17,14 @@ #include "fruit/fruit.h" +#include "cuttlefish/host/commands/run_cvd/launch/grpc_socket_creator.h" #include "cuttlefish/host/libs/config/cuttlefish_config.h" namespace cuttlefish { fruit::Component> + const CuttlefishConfig::InstanceSpecific, + GrpcSocketCreator>> NetsimServerComponent(); } // namespace cuttlefish