diff options
Diffstat (limited to 'pw_rpc/public/pw_rpc/internal/call.h')
-rw-r--r-- | pw_rpc/public/pw_rpc/internal/call.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/pw_rpc/public/pw_rpc/internal/call.h b/pw_rpc/public/pw_rpc/internal/call.h index 4a26a618d..26f76fbfc 100644 --- a/pw_rpc/public/pw_rpc/internal/call.h +++ b/pw_rpc/public/pw_rpc/internal/call.h @@ -106,7 +106,7 @@ class Call : public IntrusiveList<Call>::Item { Status CloseAndSendResponseLocked(ConstByteSpan response, Status status) PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) { return CloseAndSendFinalPacketLocked( - PacketType::RESPONSE, response, status); + pwpb::PacketType::RESPONSE, response, status); } Status CloseAndSendResponse(Status status) PW_LOCKS_EXCLUDED(rpc_lock()) { @@ -115,7 +115,8 @@ class Call : public IntrusiveList<Call>::Item { Status CloseAndSendServerErrorLocked(Status error) PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) { - return CloseAndSendFinalPacketLocked(PacketType::SERVER_ERROR, {}, error); + return CloseAndSendFinalPacketLocked( + pwpb::PacketType::SERVER_ERROR, {}, error); } // Public call that ends the client stream for a client call. @@ -127,7 +128,7 @@ class Call : public IntrusiveList<Call>::Item { // Internal call that closes the client stream. Status CloseClientStreamLocked() PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) { client_stream_state_ = kClientStreamInactive; - return SendPacket(PacketType::CLIENT_STREAM_END, {}, {}); + return SendPacket(pwpb::PacketType::CLIENT_STREAM_END, {}, {}); } // Sends a payload in either a server or client stream packet. @@ -145,7 +146,7 @@ class Call : public IntrusiveList<Call>::Item { PW_UNLOCK_FUNCTION(rpc_lock()) { // TODO(b/234876851): Ensure the call object is locked before releasing the // RPC mutex. - if (const Status status = SendPacket(PacketType::REQUEST, payload); + if (const Status status = SendPacket(pwpb::PacketType::REQUEST, payload); !status.ok()) { HandleError(status); } else { @@ -276,14 +277,15 @@ class Call : public IntrusiveList<Call>::Item { Status CloseAndSendResponseLocked(Status status) PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) { - return CloseAndSendFinalPacketLocked(PacketType::RESPONSE, {}, status); + return CloseAndSendFinalPacketLocked( + pwpb::PacketType::RESPONSE, {}, status); } // Cancels an RPC. For client calls only. Status Cancel() PW_LOCKS_EXCLUDED(rpc_lock()) { LockGuard lock(rpc_lock()); return CloseAndSendFinalPacketLocked( - PacketType::CLIENT_ERROR, {}, Status::Cancelled()); + pwpb::PacketType::CLIENT_ERROR, {}, Status::Cancelled()); } // Unregisters the RPC from the endpoint & marks as closed. The call may be @@ -307,7 +309,7 @@ class Call : public IntrusiveList<Call>::Item { MethodType type, CallType call_type); - Packet MakePacket(PacketType type, + Packet MakePacket(pwpb::PacketType type, ConstByteSpan payload, Status status = OkStatus()) const PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) { @@ -330,12 +332,12 @@ class Call : public IntrusiveList<Call>::Item { // previously acquired buffer or in a standalone buffer. // // Returns FAILED_PRECONDITION if the call is not active(). - Status SendPacket(PacketType type, + Status SendPacket(pwpb::PacketType type, ConstByteSpan payload, Status status = OkStatus()) PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()); - Status CloseAndSendFinalPacketLocked(PacketType type, + Status CloseAndSendFinalPacketLocked(pwpb::PacketType type, ConstByteSpan response, Status status) PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()); |