Wraps a pw_rpc service as a pw::rpc2::Service.
pw_rpc2 calls are forwarded to the adapter's pw::rpc::Server, which dispatches them to whichever service with this service's ID is registered there. The wrapper does not register or reference service. To construct, own, and register the service in one object, use Rpc2ServiceFor.
If no service with this ID is registered with the adapter's server, calls fail with pw::rpc2::RpcStatus::Unimplemented().
Public Member Functions | |
| template<typename LegacyService > | |
| Rpc2ServiceAdapter (Rpc2ServerAdapter &adapter, LegacyService &service) | |
| template<auto... kNonOkResponseMethods, typename LegacyService > | |
| Rpc2ServiceAdapter (Rpc2ServerAdapter &adapter, internal::DeliverNonOkResponsesTag< kNonOkResponseMethods... > policy, LegacyService &service) | |
| Rpc2ServiceAdapter (const Rpc2ServiceAdapter &)=delete | |
| Rpc2ServiceAdapter & | operator= (const Rpc2ServiceAdapter &)=delete |
Protected Member Functions | |
| Rpc2ServerAdapter & | adapter () const |
Protected Member Functions inherited from pw::rpc2::Service | |
| constexpr | Service (uint32_t service_id, span< const internal::Method > methods) |
| ~Service () | |
Protected Member Functions inherited from pw::IntrusiveForwardList< T >::Item | |
| constexpr | Item ()=default |
Friends | |
| class | internal::Rpc2LegacyCall |
|
inline |
Wraps service for registration with a pw::rpc2::Server.
| [in] | adapter | The adapter that runs service's handlers. Must outlive this object. |
| [in] | service | The pw_rpc service implementation to serve. Register it with the adapter's pw::rpc::Server. |
|
inline |
Wraps service for registration with a pw::rpc2::Server, delivering the response payload (with kOk) for selected unary or client streaming methods even when their pw_rpc handler finishes with a non-OK status.
See DeliverNonOkResponses() for usage and caveats regarding early error returns.
| [in] | adapter | The adapter that runs service's handlers. Must outlive this object. |
| [in] | policy | DeliverNonOkResponses<Methods...>() for specific methods, or DeliverNonOkResponses() for all unary and client streaming methods of service. |
| [in] | service | The pw_rpc service implementation to serve. Register it with the adapter's pw::rpc::Server. |