pw_rpc: Nanopb implementation of pw_rpc
- Provide a method implementation that uses Nanopb structs for requests
and responses.
- Start the initial pw_rpc docs.
Change-Id: I868d58edb03290c756496a188dff9c1f8f03547a
diff --git a/pw_rpc/BUILD.gn b/pw_rpc/BUILD.gn
index 99ef678..c8512e1 100644
--- a/pw_rpc/BUILD.gn
+++ b/pw_rpc/BUILD.gn
@@ -61,7 +61,7 @@
"service_registry.cc",
]
allow_circular_includes_from = [ implementation ]
- friend = [ ":*" ]
+ friend = [ "./*" ]
}
}
@@ -81,17 +81,29 @@
"public/pw_rpc/internal/base_method.h",
"public/pw_rpc/internal/packet.h",
]
- friend = [ ":*" ]
- visibility = [ ":*" ]
+ friend = [ "./*" ]
+ visibility = [ "./*" ]
+}
+
+# RPC server that uses Nanopb to encode and decode protobufs. RPCs use Nanopb
+# structs as their requests and responses.
+_pw_rpc_server_library("nanopb_server") {
+ implementation = "nanopb"
+}
+
+config("private_includes") {
+ include_dirs = [ "." ]
+ visibility = [ ":test_utils" ]
}
source_set("test_utils") {
public = [ "pw_rpc_private/test_utils.h" ]
+ public_configs = [ ":private_includes" ]
public_deps = [
":common",
dir_pw_span,
]
- visibility = [ ":*" ]
+ visibility = [ "./*" ]
}
pw_proto_library("protos") {
@@ -105,6 +117,7 @@
pw_test_group("tests") {
tests = [
":base_server_writer_test",
+ "nanopb:method_test",
":packet_test",
":server_test",
]
@@ -112,20 +125,13 @@
# RPC server for tests only. A mock method implementation is used.
_pw_rpc_server_library("test_server") {
- implementation = ":test_method"
+ implementation = "test_impl"
visibility = [ ":*" ]
}
-config("test_config") {
- include_dirs = [ "test_public" ]
- visibility = [ ":test_method" ]
-}
-
-source_set("test_method") {
- public_configs = [ ":test_config" ]
- public = [ "test_public/pw_rpc/internal/method.h" ]
- public_deps = [ ":common" ]
- visibility = [ ":test_server" ]
+pw_proto_library("test_protos") {
+ sources = [ "pw_rpc_test_protos/test.proto" ]
+ visibility = [ "./*" ]
}
pw_test("base_server_writer_test") {