pw_rpc: Remove the public interface to ServerContext

ServerContext is unnecessary and will be removed. All information in the
ServerContext is available in the ServerReader/Writer object.

Remove the only public method on ServerContext& to simplify the eventual
deprecation and removal.

Change-Id: I1dc5b60a0b1f54da0c87cbdab3985bc41a2c064d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/60442
Reviewed-by: Alexei Frolov <frolv@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_log_rpc/log_service.cc b/pw_log_rpc/log_service.cc
index 509f512..1da5471 100644
--- a/pw_log_rpc/log_service.cc
+++ b/pw_log_rpc/log_service.cc
@@ -19,10 +19,10 @@
 
 namespace pw::log_rpc {
 
-void LogService::Listen(ServerContext& context,
+void LogService::Listen(ServerContext&,
                         ConstByteSpan,
                         rpc::RawServerWriter& writer) {
-  uint32_t channel_id = context.channel_id();
+  uint32_t channel_id = writer.channel_id();
   Result<RpcLogDrain*> drain = drains_.GetDrainFromChannelId(channel_id);
   if (!drain.ok()) {
     return;
diff --git a/pw_rpc/docs.rst b/pw_rpc/docs.rst
index 5e1a512..031582d 100644
--- a/pw_rpc/docs.rst
+++ b/pw_rpc/docs.rst
@@ -194,14 +194,14 @@
 
   class TheService : public generated::TheService<TheService> {
    public:
-    pw::Status MethodOne(ServerContext& ctx,
+    pw::Status MethodOne(ServerContext&,
                          const foo_bar_Request& request,
                          foo_bar_Response& response) {
       // implementation
       return pw::OkStatus();
     }
 
-    void MethodTwo(ServerContext& ctx,
+    void MethodTwo(ServerContext&,
                    const foo_bar_Request& request,
                    ServerWriter<foo_bar_Response>& response) {
       // implementation
diff --git a/pw_rpc/nanopb/docs.rst b/pw_rpc/nanopb/docs.rst
index 876a95b..0d8f20e 100644
--- a/pw_rpc/nanopb/docs.rst
+++ b/pw_rpc/nanopb/docs.rst
@@ -91,7 +91,7 @@
 
 .. code:: c++
 
-  pw::Status GetRoomInformation(pw::rpc::ServerContext& ctx,
+  pw::Status GetRoomInformation(pw::rpc::ServerContext&,
                                 const RoomInfoRequest& request,
                                 RoomInfoResponse& response);
 
@@ -102,7 +102,7 @@
 
 .. code:: c++
 
-  void ListUsersInRoom(pw::rpc::ServerContext& ctx,
+  void ListUsersInRoom(pw::rpc::ServerContext&,
                        const ListUsersRequest& request,
                        pw::rpc::ServerWriter<ListUsersResponse>& writer);
 
diff --git a/pw_rpc/public/pw_rpc/server_context.h b/pw_rpc/public/pw_rpc/server_context.h
index 300ba2e..0578931 100644
--- a/pw_rpc/public/pw_rpc/server_context.h
+++ b/pw_rpc/public/pw_rpc/server_context.h
@@ -20,18 +20,15 @@
 
 namespace pw::rpc {
 
-// The ServerContext collects context for an RPC being invoked on a server. The
-// ServerContext is passed into RPC functions and is user-facing.
+// The ServerContext class is DEPRECATED and will be removed from pw_rpc. All
+// information in the ServerContext is accessible through the
+// ServerReader/Writer object.
 //
-// The ServerContext is a public-facing view of the internal::CallContext class.
-// It uses inheritance to avoid copying or creating an extra reference to the
-// underlying CallContext. Private inheritance prevents exposing the
-// internal-facing CallContext interface.
+// The only case where the information in a ServerContext is not available is
+// synchronous unary RPCs. If information like channel_id() is needed in a unary
+// RPC, just use an asynchronous unary RPC.
 class ServerContext : private internal::CallContext {
  public:
-  // Returns the ID for the channel this RPC is using.
-  uint32_t channel_id() const { return channel().id(); }
-
   constexpr ServerContext() = delete;
 
   constexpr ServerContext(const ServerContext&) = delete;
diff --git a/pw_unit_test/public/pw_unit_test/unit_test_service.h b/pw_unit_test/public/pw_unit_test/unit_test_service.h
index 7d7708b..4df005d 100644
--- a/pw_unit_test/public/pw_unit_test/unit_test_service.h
+++ b/pw_unit_test/public/pw_unit_test/unit_test_service.h
@@ -24,7 +24,7 @@
  public:
   UnitTestService() : handler_(*this), verbose_(false) {}
 
-  void Run(ServerContext& ctx, ConstByteSpan request, RawServerWriter& writer);
+  void Run(ServerContext&, ConstByteSpan request, RawServerWriter& writer);
 
  private:
   friend class internal::RpcEventHandler;