1 // Copyright 2020 The Pigweed Authors
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
7 // https://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
19 #include "pw_assert/assert.h"
20 #include "pw_rpc/internal/channel.h"
32 // Collects information for an ongoing RPC being processed by the server.
33 // The Server creates a ServerCall object to represent a method invocation. The
34 // ServerCall is copied into a ServerWriter or ServerReader for streaming RPCs.
36 // ServerCall is a strictly internal class. ServerContext is the public
37 // interface to the internal::ServerCall.
40 constexpr ServerCall()
46 constexpr ServerCall(Server& server,
49 const internal::Method& method)
55 constexpr ServerCall(const ServerCall&) = default;
56 constexpr ServerCall& operator=(const ServerCall&) = default;
58 // Access the ServerContext for this call. Defined in pw_rpc/server_context.h.
59 ServerContext& context();
61 Server& server() const {
62 PW_DCHECK_NOTNULL(server_);
66 Channel& channel() const {
67 PW_DCHECK_NOTNULL(channel_);
71 Service& service() const {
72 PW_DCHECK_NOTNULL(service_);
76 const internal::Method& method() const {
77 PW_DCHECK_NOTNULL(method_);
85 const internal::Method* method_;
88 } // namespace internal
89 } // namespace pw::rpc