Constructs and owns a pw_rpc service as a pw::rpc2::Service, and registers it with the adapter's pw::rpc::Server.
By default, finishing a pw_rpc call with a non-OK status ends the pw_rpc2 call with kCancelled. Pass DeliverNonOkResponses() as the second constructor argument to deliver response payloads for unary or client streaming methods that finish with a non-OK status.
Public Member Functions | |
| template<typename... Args, typename = std::enable_if_t< !internal::kStartsWithDeliverNonOkTag<Args...>>> | |
| Rpc2ServiceFor (Rpc2ServerAdapter &adapter, Args &&... args) | |
| template<auto... kNonOkResponseMethods, typename... Args> | |
| Rpc2ServiceFor (Rpc2ServerAdapter &adapter, internal::DeliverNonOkResponsesTag< kNonOkResponseMethods... > policy, Args &&... args) | |
| ~Rpc2ServiceFor () | |
| LegacyService & | service () |
Returns the wrapped pw_rpc service. | |
| const LegacyService & | service () const |
Returns the wrapped pw_rpc service. | |
Public Member Functions inherited from pw::rpc::Rpc2ServiceAdapter | |
| 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 |
Additional Inherited Members | |
Protected Member Functions inherited from pw::rpc::Rpc2ServiceAdapter | |
| 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 |
|
inlineexplicit |
Constructs the wrapped LegacyService from args and registers it with the adapter's pw::rpc::Server.
| [in] | adapter | The adapter that runs the service's handlers. Must outlive this object. |
| [in] | args | Arguments forwarded to LegacyService's constructor. |
|
inline |
Constructs the wrapped LegacyService from args, registers it with the adapter's pw::rpc::Server, and delivers 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 the service's handlers. Must outlive this object. |
| [in] | policy | DeliverNonOkResponses<Methods...>() for specific methods, or DeliverNonOkResponses() for all unary and client streaming methods of LegacyService. |
| [in] | args | Arguments forwarded to LegacyService's constructor. |
|
inline |
Unregisters the service from the adapter's pw::rpc::Server.
pw::rpc2::Server this service was registered with must be closed, and Rpc2ServerAdapter::Stop() must have been called.
|
inline |
Returns the wrapped pw_rpc service.