libusb++ API Documentation

USB::Interface Class Reference

Class representing an interface of a Device. More...

#include <usbpp.h>

Collaboration diagram for USB::Interface:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Interface ()
int driverName (std::string &driver)
 get the current driver for an interface
u_int8_t numAltSettings (void)
 Number of Alternative Settings that this interface has.
AltSettingfirstAltSetting (void)
 First AltSetting for the Interface.
AltSettingnextAltSetting (void)
 Next AltSetting for the Interface.
AltSettinglastAltSetting (void)
 Last AltSetting for the Interface.

Friends

class Busses
 Busses is a friend because it fills in the descriptor type information on initialisation and rescan.

Detailed Description

Class representing an interface of a Device.

The Interface class represents a USB interface for a device attached to a Universal Serial Bus.

Interfaces are the main element of the USB class structure.

Author:
Brad Hards

Definition at line 165 of file usbpp.h.


Member Function Documentation

int USB::Interface::driverName ( std::string &  driver  ) 

get the current driver for an interface

Parameters:
driver a string containing the name of the current driver for the interface. You can typically pass in an empty string for this.
Returns:
length of string, or 0 on error.

Definition at line 386 of file usbpp.cpp.

References USB::Device::handle().

u_int8_t USB::Interface::numAltSettings ( void   ) 

Number of Alternative Settings that this interface has.

This is a simple accessor method that specifies the number alternative settings that this device interface has.

Definition at line 418 of file usbpp.cpp.

Referenced by USB::Busses::rescan().

AltSetting * USB::Interface::firstAltSetting ( void   ) 

First AltSetting for the Interface.

This method returns a pointer to the first AltSetting for the Interface.

See nextAltSetting() for an example of how it might be used.

See also:
nextAltSetting(), lastAltSetting(), numAltSettings()

Definition at line 438 of file usbpp.cpp.

AltSetting * USB::Interface::nextAltSetting ( void   ) 

Next AltSetting for the Interface.

This method returns a pointer to the next AltSetting for the Interface.

If you want to iterate through each AltSetting on a device, you can use something like the following:

 USB::Configuration *this_Configuration;
 this_Configuration = device->firstConfiguration();
 for (i=0; i < device->numConfigurations(); i++) {
     this_Configuration->dumpDescriptor();
   USB::Interface *this_Interface;
   this_Interface = this_Configuration->firstInterface();
   for (j=0; j < this_Configuration->numInterfaces(); j++) {
     USB::AltSetting *this_AltSetting;
     this_AltSetting = this_Interface->firstAltSetting();
     for (k=0; k < this_Interface->numAltSettings(); k++) {
       // do something with this_AltSetting
       this_AltSetting = this_Interface->nextAltSetting();
     }
   this_Interface = this_Configuration->nextInterface();
   }
   this_Configuration = device->nextConfiguration();
 }

See also:
firstAltSetting(), lastAltSetting(), numAltSettings()

Definition at line 444 of file usbpp.cpp.

AltSetting * USB::Interface::lastAltSetting ( void   ) 

Last AltSetting for the Interface.

This method returns a pointer to the last AltSetting for the Interface.

See also:
firstAltSetting(), nextAltSetting(), numAltSettings()

Definition at line 452 of file usbpp.cpp.


Friends And Related Function Documentation

friend class Busses [friend]

Busses is a friend because it fills in the descriptor type information on initialisation and rescan.

Definition at line 170 of file usbpp.h.


The documentation for this class was generated from the following files:
This file is part of the documentation for libusb++ .
Documentation copyright © 2004 Brad Hards.
Generated on Mon Jan 22 23:19:30 2007 by doxygen 1.5.1 written by Dimitri van Heesch.