Public Types | |
enum | Type { ISOCHRONOUS = 0x01, BULK = 0x02, INTERRUPT = 0x03, UNKNOWN = 0xFF } |
USB Endpoint Types. More... | |
Public Member Functions | |
Endpoint (Device *pDevice, unsigned char Address) throw (Errors::ResourceError, Errors::DeviceLost) | |
Default constructor. | |
AsyncIO * | FindPacket (unsigned short Status=0xFFF) |
Searches the PacketsDone queue for the next object. | |
void | Flush () throw () |
Cancels all outstanding requests. | |
unsigned char | GetAddress () throw () |
Gets the endpoint address. | |
unsigned int | GetDefaultFlags () throw () |
Gets the default flags for transferring data. | |
unsigned short | GetIsoInterval () |
Gets the ISO interval from the driver. | |
unsigned short | GetMaxPacketSize () |
Gets the maximum packet size for a one-packet-transfer. | |
unsigned long | GetTimeout () |
Gets the current timeout from the driver. | |
Endpoint::Type | GetType () throw () |
Gets the type of this endpoint. | |
bool | IsINEndpoint () throw () |
Check if this EP is an IN EP. | |
bool | IsOUTEndpoint () throw () |
Check if this EP is an OUT EP. | |
unsigned long | NumPacketsDone () throw () |
Gets the number of packets that have been completed. | |
unsigned long | NumPacketsInProgress () throw () |
Gets the number of packets currently in the active queue. | |
Data | Read (unsigned long Length) |
Reads data synchronously. | |
AsyncIO * | ReadAsync (unsigned long Length) |
Reads data asynchronously with default flags. | |
AsyncIO * | ReadAsync (unsigned long Length, unsigned int Flags) |
Reads data asynchronously. | |
void | RemovePacket (AsyncIO *pAIO) |
Removes the AsyncIO object from the PacketsDone queue. | |
AsyncIO * | RetrievePacket (unsigned short Status=0xFFFF) |
This is a combined FindPacket and RetrievePacket function. | |
void | RetrievePacket (AsyncIO *pAIO) |
Retrieves the packet from the PacketsDone queue. | |
void | Run () |
Lets the endpoint process running requests and calls registered callback functions. | |
void | SetDefaultFlags (unsigned int Flags=0) throw () |
Sets the default flags for transferring data. | |
void | SetInterface (IEndpoint *pInterface) throw () |
Sets an interface for asynchronous callbacks. | |
void | SetIsoInterval (unsigned short Interval) |
Defines a new interval for delivering ISO packets. | |
void | SetTimeout (unsigned long Timeout) |
Sets the time until the driver aborts its attempt to deliver the request. | |
AsyncIO * | WriteAsync (Data Data) |
Writes data asynchronously with default flags. | |
AsyncIO * | WriteAsync (Data Data, unsigned int Flags) |
Writes data asynchronously. | |
~Endpoint () | |
Default destructor. | |
Protected Attributes | |
unsigned char | m_Address |
Endpoint address. | |
unsigned int | m_DefaultFlags |
The default flags for transferring data. | |
Descriptors::Endpoint | m_EPDesc |
Endpoint for this EP. | |
IEndpoint * | m_pInterface |
The asynchronous callback interface. |
USB Endpoint Types.
EasyUSB::Endpoint::Endpoint | ( | Device * | pDevice, | |
unsigned char | Address | |||
) | throw (Errors::ResourceError, Errors::DeviceLost) |
Default constructor.
pDevice | The parent device. | |
Address | The endpoint address. |
ResourceError | The endpoint could not be found or there was not enough memory for this operation. | |
- | All exceptions thrown by IoControl |
EasyUSB::Endpoint::~Endpoint | ( | ) |
Default destructor.
AsyncIO* EasyUSB::Endpoint::FindPacket | ( | unsigned short | Status = 0xFFF |
) |
Searches the PacketsDone queue for the next object.
This function does NOT grant you ownership of the object.
Status | If specified, only a packet with the given status is returned. |
void EasyUSB::Endpoint::Flush | ( | ) | throw () |
unsigned char EasyUSB::Endpoint::GetAddress | ( | ) | throw () |
unsigned int EasyUSB::Endpoint::GetDefaultFlags | ( | ) | throw () |
Gets the default flags for transferring data.
unsigned short EasyUSB::Endpoint::GetIsoInterval | ( | ) |
Gets the ISO interval from the driver.
- | Any exception thrown by IoControl. |
unsigned short EasyUSB::Endpoint::GetMaxPacketSize | ( | ) |
Gets the maximum packet size for a one-packet-transfer.
unsigned long EasyUSB::Endpoint::GetTimeout | ( | ) |
Gets the current timeout from the driver.
- | Any exception thrown by IoControl. |
Endpoint::Type EasyUSB::Endpoint::GetType | ( | ) | throw () |
bool EasyUSB::Endpoint::IsINEndpoint | ( | ) | throw () |
Check if this EP is an IN EP.
bool EasyUSB::Endpoint::IsOUTEndpoint | ( | ) | throw () |
Check if this EP is an OUT EP.
unsigned long EasyUSB::Endpoint::NumPacketsDone | ( | ) | throw () |
Gets the number of packets that have been completed.
unsigned long EasyUSB::Endpoint::NumPacketsInProgress | ( | ) | throw () |
Gets the number of packets currently in the active queue.
Data EasyUSB::Endpoint::Read | ( | unsigned long | Length | ) | [virtual] |
Reads data synchronously.
Length | The number of bytes to read from the endpoint. |
DeviceLost | The device is not connected. | |
UnknownError | An unknown (windows) error occured. | |
InvalidParameter | Most likely the length was not a multiple of the endpoint max size. |
Reimplemented from EasyUSB::Detail::IO.
AsyncIO* EasyUSB::Endpoint::ReadAsync | ( | unsigned long | Length | ) |
Reads data asynchronously with default flags.
Length | The number of bytes to read from the endpoint. |
- | Same as WriteAsync. | |
InvalidParameter | Most likely the length was not a multiple of the endpoint max size. |
AsyncIO* EasyUSB::Endpoint::ReadAsync | ( | unsigned long | Length, | |
unsigned int | Flags | |||
) | [virtual] |
Reads data asynchronously.
Length | The number of bytes to read from the endpoint. | |
Flags | Asynchronous send options. |
- | Same as WriteAsync. | |
InvalidParameter | Most likely the length was not a multiple of the endpoint max size. |
Reimplemented from EasyUSB::Detail::IO.
void EasyUSB::Endpoint::RemovePacket | ( | AsyncIO * | pAIO | ) |
AsyncIO* EasyUSB::Endpoint::RetrievePacket | ( | unsigned short | Status = 0xFFFF |
) |
This is a combined FindPacket and RetrievePacket function.
It searches an AsyncIO object with the specified status and grants you ownership of it.
Status | If specified, only a packet with the given status is returned. |
void EasyUSB::Endpoint::RetrievePacket | ( | AsyncIO * | pAIO | ) |
Retrieves the packet from the PacketsDone queue.
This grants you ownership of the AsyncIO object. You are now responsible of destroying it after usage.
pAIO | The AsyncIO object to be retrieved. |
void EasyUSB::Endpoint::Run | ( | ) |
Lets the endpoint process running requests and calls registered callback functions.
void EasyUSB::Endpoint::SetDefaultFlags | ( | unsigned int | Flags = 0 |
) | throw () |
Sets the default flags for transferring data.
Flags | The new default flags. |
void EasyUSB::Endpoint::SetInterface | ( | IEndpoint * | pInterface | ) | throw () |
Sets an interface for asynchronous callbacks.
pInterface | A pointer to the new interface. |
void EasyUSB::Endpoint::SetIsoInterval | ( | unsigned short | Interval | ) |
Defines a new interval for delivering ISO packets.
Interval | The new interval in ms. |
- | Any exception thrown by IoControl. |
void EasyUSB::Endpoint::SetTimeout | ( | unsigned long | Timeout | ) |
Sets the time until the driver aborts its attempt to deliver the request.
Timeout | The new timeout in ms. |
- | Any exception thrown by IoControl. |
Writes data asynchronously with default flags.
- | Same as WriteAsync. |
Writes data asynchronously.
NotEnoughMemory | Not enough memory to complete the operation. | |
DeviceLost | The device is not connected. | |
UnknownError | An unknown (windows) error occured. |
Reimplemented from EasyUSB::Detail::IO.
unsigned char EasyUSB::Endpoint::m_Address [protected] |
Endpoint address.
unsigned int EasyUSB::Endpoint::m_DefaultFlags [protected] |
The default flags for transferring data.
Descriptors::Endpoint EasyUSB::Endpoint::m_EPDesc [protected] |
Endpoint for this EP.
IEndpoint* EasyUSB::Endpoint::m_pInterface [protected] |
The asynchronous callback interface.