template <class DeviceType>
class EndpointClient
Defined at line 133 of file ../../src/devices/usb/lib/usb-endpoint/include/usb-endpoint/usb-endpoint-client.h
EndpointClient helps manage common functionality for the client side of
`fuchsia_hardware_usb_endpoint::Endpoint`. Most notably, EndpointClient binds a client to make
calls such as `QueueRequest` and `RegisterVmos` and implements the corresponding
`fidl::AsyncEventHandler
<fuchsia
_hardware_usb_endpoint::Endpoint>` required to handle
`OnCompletion` events. EndpointClient is templated on `DeviceType` which should have a `void
(fuchsia_hardware_usb_endpoint::Completion)` function, which will be called for each completion
event received. All other common functionality implemented by EndpointClient are described in
detail in the `EndpointClientBase` class, which EndpointClient inherits from.
Example Usage:
class SampleDeviceType {
public:
private:
void RequestComplete(fuchsia_hardware_usb_endpoint::Completion completion);
usb_endpoint::EndpointClient
<SampleDeviceType
> ep_{usb_endpoint::EndpointType::BULK, this,
std::mem_fn(
&SampleDeviceType
::RequestComplete)};
};
Public Methods
void EndpointClient<DeviceType> (usb::EndpointType ep_type, DeviceType * device, OnCompletionFuncType on_completion)
Defined at line 139 of file ../../src/devices/usb/lib/usb-endpoint/include/usb-endpoint/usb-endpoint-client.h
void OnCompletion (fidl::Event<fuchsia_hardware_usb_endpoint::Endpoint::OnCompletion> & event)
fidl::AsyncEventHandler implementation.
OnCompletion: handles completed requests by calling on_completion_ for each request completed.
Defined at line 152 of file ../../src/devices/usb/lib/usb-endpoint/include/usb-endpoint/usb-endpoint-client.h
void on_fidl_error (fidl::UnbindInfo error)
Defined at line 159 of file ../../src/devices/usb/lib/usb-endpoint/include/usb-endpoint/usb-endpoint-client.h
template <typename ProtocolType>
zx_status_t Init (uint8_t ep_addr, fidl::ClientEnd<ProtocolType> & client, async_dispatcher_t * dispatcher)
Init is templated on `ProtocolType`, which declares `ConnectToEndpoint(uint8_t ep_addr,
fidl::ServerEnd
<fuchsia
_hardware_usb_endpoint::Endpoint>)`--either `fuchsia_hardware_usb::Usb`
or `fuchsia_hardware_usb_function::UsbFunction`. Init creates a connection between the server
side endpoint and binds the client side to this.
Defined at line 171 of file ../../src/devices/usb/lib/usb-endpoint/include/usb-endpoint/usb-endpoint-client.h