Mbed OS Reference
Loading...
Searching...
No Matches
AsyncOp Class Referenceabstract

Base class for asynchronous operations in the USB stack. More...

#include <AsyncOp.h>

Inheritance diagram for AsyncOp:
LinkEntry

Public Member Functions

 AsyncOp ()
 Construct a new AsyncOp object. More...
 
 AsyncOp (mbed::Callback< void()> &callback)
 Construct a new AsyncOp object. More...
 
virtual ~AsyncOp ()
 Cleanup resources used by this AsyncOp. More...
 
void wait (rtos::Mutex *host_mutex, rtos::Kernel::Clock::duration_u32 rel_time=rtos::Kernel::wait_for_u32_forever)
 Wait for this asynchronous operation to complete. More...
 
void abort ()
 Abort this asynchronous operation. More...
 
bool timeout ()
 Check if this operation timed out. More...
 
bool aborted ()
 Check if this operation was aborted. More...
 

Protected Member Functions

virtual bool process ()=0
 Callback indicating that something changed. More...
 
virtual void complete ()
 Callback indicating that this event finished. More...
 

Detailed Description

Base class for asynchronous operations in the USB stack.

Classes such as USBCDC use this to submit operations to be processed by an ISR.

Definition at line 48 of file AsyncOp.h.

Constructor & Destructor Documentation

◆ AsyncOp() [1/2]

AsyncOp ( )

Construct a new AsyncOp object.

◆ AsyncOp() [2/2]

AsyncOp ( mbed::Callback< void()> &  callback)

Construct a new AsyncOp object.

Parameters
callbackCompletion callback

◆ ~AsyncOp()

virtual ~AsyncOp ( )
virtual

Cleanup resources used by this AsyncOp.

Member Function Documentation

◆ wait()

void wait ( rtos::Mutex host_mutex,
rtos::Kernel::Clock::duration_u32  rel_time = rtos::Kernel::wait_for_u32_forever 
)

Wait for this asynchronous operation to complete.

If the timeout expires then this asynchronous operation is aborted and the timeout flag is set.

Note
- the host object's lock MUST NOT be held when this call is made

◆ abort()

void abort ( )

Abort this asynchronous operation.

This function has no effect if the operation is complete. Otherwise the aborted flag is set.

Note
- the host object's lock MUST be held when this call is made

◆ timeout()

bool timeout ( )

Check if this operation timed out.

Returns
true if this operation timed out, false otherwise

◆ aborted()

bool aborted ( )

Check if this operation was aborted.

Returns
true if this operation was aborted, false otherwise

◆ process()

virtual bool process ( )
protectedpure virtual

Callback indicating that something changed.

Returns
true if finished false if not

◆ complete()

virtual void complete ( )
protectedvirtual

Callback indicating that this event finished.