Public Member Functions | |
void | Close () |
Closes the device. | |
void | CyclePort () |
Power cycles the USB port the device is attached to. | |
Device () | |
Default constructor. | |
char | GetConfiguration () |
Gets the current configuration ID. | |
Descriptors::Configuration | GetConfigurationDescriptor () |
Gets the configuration descriptor of the current configuration. | |
Descriptors::Configuration | GetConfigurationDescriptor (unsigned char ConfigID) |
Gets a configuration descriptor. | |
Descriptors::Device | GetDeviceDescriptor () |
Gets the USB device descriptor. | |
std::wstring | GetDevicePath () |
Gets the unique device path. | |
Endpoint * | GetEndpoint (unsigned char InterfaceID, unsigned char Index) |
Gets a configured endpoint. | |
Endpoint * | GetEndpoint (unsigned char Address) |
Gets a configured endpoint. | |
Descriptors::Endpoint | GetEndpointDescriptor (unsigned char InterfaceID, unsigned char EndpointID) |
Gets an endpoint descriptor. | |
Descriptors::Endpoint | GetEndpointDescriptor (unsigned char InterfaceID, unsigned char SettingID, unsigned char EndpointID) |
Gets an endpoint descriptor. | |
Descriptors::Interface | GetInterfaceDescriptor (unsigned char InterfaceID) |
Gets an interface descriptor. | |
Descriptors::Interface | GetInterfaceDescriptor (unsigned char InterfaceID, unsigned char SettingID) |
Gets an interface descriptor. | |
std::vector< unsigned short > | GetLangIDs () |
Gets a list of all available languages. | |
char | GetSetting (unsigned char InterfaceID) |
Gets the current setting of an interface. | |
std::wstring | GetString (unsigned char StringID, unsigned short LangID=0x0409) |
Gets a unicode string from the device. | |
unsigned char | NumConfigurations () throw (Errors::DeviceNotAvailable) |
Gets the number of avaiable USB configurations. | |
unsigned char | NumEndpointsActive () |
Retrieves the number of active (that means selected) endpoints. | |
unsigned char | NumSettings (unsigned char InterfaceID) |
Gets the number of settings available for an interface. | |
bool | Open (unsigned short Index) |
Tries to open a USB device connected to the system. | |
bool | Restore () |
Tries to restore the USB device to full functionality. | |
void | SetConfiguration (unsigned char ConfigID) throw (Errors::InvalidParameter, Errors::IOError, Errors::ResourceError) |
Sets the current configuration. | |
void | SetSetting (unsigned char InterfaceID, unsigned char SettingID) |
Sets a new active setting on an interface. | |
bool | Validate () |
Checks every endpoint and validates the device. | |
~Device () | |
Default destructor. | |
Protected Attributes | |
Descriptors::Device | m_DeviceDescriptor |
The USB device descriptor. |
EasyUSB::Device::Device | ( | ) |
Default constructor.
EasyUSB::Device::~Device | ( | ) |
Default destructor.
void EasyUSB::Device::Close | ( | ) |
Closes the device.
void EasyUSB::Device::CyclePort | ( | ) |
Power cycles the USB port the device is attached to.
FileNotFound | The device could not be found 1 second after cycling the port. |
char EasyUSB::Device::GetConfiguration | ( | ) |
Gets the current configuration ID.
Descriptors::Configuration EasyUSB::Device::GetConfigurationDescriptor | ( | ) |
Gets the configuration descriptor of the current configuration.
- | All exceptions thrown by SendIOCTL. | |
NotEnoughMemory | Not enough memory to complete this operation. |
Descriptors::Configuration EasyUSB::Device::GetConfigurationDescriptor | ( | unsigned char | ConfigID | ) |
Gets a configuration descriptor.
ConfigID | The configuration index usually starting with 1. |
- | All exceptions thrown by SendIOCTL. | |
NotEnoughMemory | Not enough memory to complete this operation. |
Descriptors::Device EasyUSB::Device::GetDeviceDescriptor | ( | ) |
std::wstring EasyUSB::Device::GetDevicePath | ( | ) |
Gets the unique device path.
Endpoint* EasyUSB::Device::GetEndpoint | ( | unsigned char | InterfaceID, | |
unsigned char | Index | |||
) |
Gets a configured endpoint.
InterfaceID | The parent interface of the endpoint. | |
Index | The index of the endpoint in the list of all endpoints of the specific interface. |
Endpoint* EasyUSB::Device::GetEndpoint | ( | unsigned char | Address | ) |
Gets a configured endpoint.
Address | The endpoint address. |
Descriptors::Endpoint EasyUSB::Device::GetEndpointDescriptor | ( | unsigned char | InterfaceID, | |
unsigned char | EndpointID | |||
) |
Gets an endpoint descriptor.
InterfaceID | The requested interface. | |
EndpointID | The requested endpoint index. |
- | All exceptions thrown by SendIOCTL. |
Descriptors::Endpoint EasyUSB::Device::GetEndpointDescriptor | ( | unsigned char | InterfaceID, | |
unsigned char | SettingID, | |||
unsigned char | EndpointID | |||
) |
Gets an endpoint descriptor.
InterfaceID | The requested interface. | |
SettingID | The requested alternate setting. | |
EndpointID | The requested endpoint index. |
- | All exceptions thrown by SendIOCTL. |
Descriptors::Interface EasyUSB::Device::GetInterfaceDescriptor | ( | unsigned char | InterfaceID | ) |
Gets an interface descriptor.
InterfaceID | The requested interface starting with 0. |
- | All exceptions thrown by SendIOCTL. |
Descriptors::Interface EasyUSB::Device::GetInterfaceDescriptor | ( | unsigned char | InterfaceID, | |
unsigned char | SettingID | |||
) |
Gets an interface descriptor.
InterfaceID | The requested interface starting with 0. | |
SettingID | The requested alternate setting ID starting with 0. |
- | All exceptions thrown by SendIOCTL. |
std::vector<unsigned short> EasyUSB::Device::GetLangIDs | ( | ) |
Gets a list of all available languages.
char EasyUSB::Device::GetSetting | ( | unsigned char | InterfaceID | ) |
Gets the current setting of an interface.
InterfaceID | The interface to retrieve the setting from. |
InvalidParameter | The interface ID was invalid. |
std::wstring EasyUSB::Device::GetString | ( | unsigned char | StringID, | |
unsigned short | LangID = 0x0409 | |||
) |
Gets a unicode string from the device.
StringID | The string ID to be retrieved. These IDs can be found in various USB descriptors. | |
LangID | The language of the returned string. Default is 0x0409 English (USA). |
- | All exceptions thrown by SendIOCTL. | |
NotEnoughMemory | Not enough memory to complete this operation. |
unsigned char EasyUSB::Device::NumConfigurations | ( | ) | throw (Errors::DeviceNotAvailable) |
Gets the number of avaiable USB configurations.
DeviceNotAvailable | The device is not conencted. |
unsigned char EasyUSB::Device::NumEndpointsActive | ( | ) |
Retrieves the number of active (that means selected) endpoints.
unsigned char EasyUSB::Device::NumSettings | ( | unsigned char | InterfaceID | ) |
Gets the number of settings available for an interface.
InterfaceID | The interface to get the information from. |
- | All exceptions thrown by SendIOCTL. | |
InvalidParameter | An invalid parameter was specified. |
bool EasyUSB::Device::Open | ( | unsigned short | Index | ) |
Tries to open a USB device connected to the system.
Index | The device index if multiple EasyUSB devices are connected to the system. |
- | Every exception thrown by SendIOCTL. | |
ResourceError | The control endpoint could not be found. | |
NotEnoughMemory | Not enough memory for internal functions. |
bool EasyUSB::Device::Restore | ( | ) |
Tries to restore the USB device to full functionality.
void EasyUSB::Device::SetConfiguration | ( | unsigned char | ConfigID | ) | throw (Errors::InvalidParameter, Errors::IOError, Errors::ResourceError) |
Sets the current configuration.
ConfigID | The new configuration to load. |
- | All exceptions thrown by SendIOCTL. | |
InvalidParameter | An invalid parameter was specified. | |
NotEnoughMemory | Not enough memory to complete this operation. |
void EasyUSB::Device::SetSetting | ( | unsigned char | InterfaceID, | |
unsigned char | SettingID | |||
) |
Sets a new active setting on an interface.
InterfaceID | The interface to manipulate. | |
SettingID | The new setting. |
- | All exceptions thrown by SendIOCTL. | |
InvalidParameter | An invalid parameter was specified. | |
NotEnoughMemory | Not enough memory to complete this operation. |
bool EasyUSB::Device::Validate | ( | ) |
Checks every endpoint and validates the device.
The USB device descriptor.