|
co_usb
|
Low-level awaitable primitive for strapping hotplug callbacks to a coroutine ecosystem. More...
#include <hotplug_awaitable.hpp>

Classes | |
| struct | op_result |
| struct | resumption_t |
Public Member Functions | |
| hotplug_awaitable (libusb_context *ctx, libusb_hotplug_callback_handle *handle, op_result *op_res, resumption_t *res, int events, int flags, int vid, int pid, int dev_class) | |
| bool | await_ready () noexcept |
| std::coroutine_handle | await_suspend (std::coroutine_handle<> h, boost::capy::io_env const *env) |
| suspends and registers the callback | |
| boost::capy::io_result< event_type, device_ref > | await_resume () |
Public Attributes | |
| libusb_context * | ctx |
| libusb_hotplug_callback_handle * | handle |
| op_result * | op_res |
| resumption_t * | res |
| int | events |
| int | flags |
| int | vid |
| int | pid |
| int | dev_class |
Low-level awaitable primitive for strapping hotplug callbacks to a coroutine ecosystem.
This is the lowest possible layer of abstraction over libusb's hotplug API. It should be used for maximum flexibility or when the behaviour of device_acceptor is unacceptable, e.g. when no heap allocation is acceptable.
Objects of this type are copyable since an awaitable object itself does not own any resource and operates on handles, pointers and integers instead. It it safe to copy and to move in any state.
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
suspends and registers the callback
| h | std::coroutine_handle to the awaiting coroutine |
| env | boost::capy::io_env* as per boost::capy::IoAwaitable concept |
h on submission error or on cancellation | libusb_context* co_usb::hotplug::detail::hotplug_awaitable::ctx |
| int co_usb::hotplug::detail::hotplug_awaitable::dev_class |
| int co_usb::hotplug::detail::hotplug_awaitable::events |
| int co_usb::hotplug::detail::hotplug_awaitable::flags |
| libusb_hotplug_callback_handle* co_usb::hotplug::detail::hotplug_awaitable::handle |
| op_result* co_usb::hotplug::detail::hotplug_awaitable::op_res |
| int co_usb::hotplug::detail::hotplug_awaitable::pid |
| resumption_t* co_usb::hotplug::detail::hotplug_awaitable::res |
| int co_usb::hotplug::detail::hotplug_awaitable::vid |