OSDN Git Service

Add stub for rusty-gd facade service
authorZach Johnson <zachoverflow@google.com>
Sat, 31 Oct 2020 19:58:49 +0000 (12:58 -0700)
committerZach Johnson <zachoverflow@google.com>
Wed, 4 Nov 2020 04:40:20 +0000 (20:40 -0800)
Only parses command line args for now, but will
be expanded gradually in future patches.

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --host
Change-Id: I122f110db529b065ed8c47b9c61e25704746360a

gd/rust/facade/Android.bp [new file with mode: 0644]
gd/rust/facade/src/main.rs [new file with mode: 0644]

diff --git a/gd/rust/facade/Android.bp b/gd/rust/facade/Android.bp
new file mode 100644 (file)
index 0000000..2384124
--- /dev/null
@@ -0,0 +1,10 @@
+rust_binary {
+    name: "rusty_bluetooth_stack_with_facade",
+    crate_name: "rusty_bt_stack_with_facade",
+    srcs: ["src/main.rs"],
+    edition: "2018",
+    rustlibs: [
+      "libclap",
+    ],
+    host_supported: true,
+}
diff --git a/gd/rust/facade/src/main.rs b/gd/rust/facade/src/main.rs
new file mode 100644 (file)
index 0000000..43f598e
--- /dev/null
@@ -0,0 +1,38 @@
+//! Starts the facade services that allow us to test the Bluetooth stack
+
+#[macro_use]
+extern crate clap;
+use clap::{App, Arg};
+
+fn main() {
+    let matches = App::new("rusty_bluetooth_stack_with_facade")
+        .about("The bluetooth stack, with testing facades enabled and exposed via gRPC.")
+        .arg(
+            Arg::with_name("root-server-port")
+                .long("root-server-port")
+                .default_value("8897")
+                .takes_value(true),
+        )
+        .arg(
+            Arg::with_name("grpc-port")
+                .long("grpc-port")
+                .default_value("8899")
+                .takes_value(true),
+        )
+        .arg(
+            Arg::with_name("signal-port")
+                .long("signal-port")
+                .default_value("8895")
+                .takes_value(true),
+        )
+        .get_matches();
+
+    let root_server_port = value_t!(matches, "root-server-port", u16).unwrap();
+    let grpc_port = value_t!(matches, "grpc-port", u16).unwrap();
+    let signal_port = value_t!(matches, "signal-port", u16).unwrap();
+
+    println!(
+        "root server port: {}, grpc port: {}, signal port {}",
+        root_server_port, grpc_port, signal_port
+    );
+}