Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

LOW_portUsbDevice Class Reference

Abstract base class for a device on a USB port. More...

#include <LOW_portUsbDevice.h>

Inheritance diagram for LOW_portUsbDevice:

Inheritance graph
[legend]
List of all members.

Public Types

typedef uint16_t usbVendorID_t
 Type for USB vendor ID.

typedef uint16_t usbProductID_t
 Type for USB product ID.

typedef uint8_t usbConfig_t
 Type for USB configuration.

typedef uint8_t usbInterface_t
 Type for USB interface.

typedef uint8_t usbSetting_t
 Type for USB setting.

typedef uint8_t bmRequestType_t
 Corresponds to type defined in USB 1.1 specification.

typedef uint8_t bRequest_t
 Corresponds to type defined in USB 1.1 specification.

typedef uint16_t wValue_t
 Corresponds to type defined in USB 1.1 specification.

typedef uint16_t wIndex_t
 Corresponds to type defined in USB 1.1 specification.

typedef uint16_t wLength_t
 Corresponds to type defined in USB 1.1 specification.

typedef uint8_t * msgData_t
 Pointer type for I/O methods.

typedef uint16_t usbTimeout_t
 Type for timeout on USB operations in ms.

typedef uint8_t usbEndpoint_t
 Type for USB endpoint.


Public Member Functions

 class_DERIVE_FROM_EXCEPTION (portUsbDevice_error, LOW_exception)
 Exception base class for all exceptions thrown by LOW_portUsbDevice.

 class_DERIVE_FROM_EXCEPTION (noSuchDevice_error, portUsbDevice_error)
 Exception class when a device could not be found.

virtual ~LOW_portUsbDevice ()
 Destructor.

virtual usbVendorID_t getVendorID ()=0
 Get vendor ID of USB device.

virtual usbProductID_t getProductID ()=0
 Get product ID of USB device.

virtual void setConfiguration (const usbConfig_t inConfig)=0
 Sets the active configuration of a device.

virtual void claimInterface (const usbInterface_t inInterface)=0
 Claim an interface of a device.

virtual void releaseInterface (const usbInterface_t inInterface)=0
 Releases a previously claimed interface.

virtual void setIfaceAltSetting (const usbSetting_t inAltSetting)=0
 Sets the active alternate setting of the current interface.

virtual void controlMsg (const bmRequestType_t inReqType, const bRequest_t inRequest, const wValue_t inValue, const wIndex_t inIndex, const wLength_t inLength, msgData_t inOutData, const usbTimeout_t inTimeout)=0
 Send a control message to a device.

virtual void controlMsg (const bmRequestType_t inReqType, const bRequest_t inRequest, const wValue_t inValue, const wIndex_t inIndex, byteVec_t &inOutData, const usbTimeout_t inTimeout)=0
 Send a control message to a device.

virtual void clearHalt (const usbEndpoint_t inEP)=0
 Clears any halt status on an endpoint.

virtual unsigned int bulkWrite (const usbEndpoint_t inEP, const wLength_t inLength, const msgData_t inData, const usbTimeout_t inTimeout)=0
 Write data to a bulk endpoint.

virtual unsigned int bulkWrite (const usbEndpoint_t inEP, const byteVec_t &inData, const usbTimeout_t inTimeout)=0
 Write data to a bulk endpoint.

virtual unsigned int bulkRead (const usbEndpoint_t inEP, const wLength_t inLength, msgData_t outData, const usbTimeout_t inTimeout)=0
 Read data from a bulk endpoint.

virtual unsigned int bulkRead (const usbEndpoint_t inEP, byteVec_t &outData, const usbTimeout_t inTimeout)=0
 Read data from a bulk endpoint.


Detailed Description

Abstract base class for a device on a USB port.

Each instance represents one USB device.

Specific platforms dereive their implementation classes from this class.

The instances are created by LOW_portUsb_Factory, following the factory design pattern.

Note: There is no prescribed constructor. A class deriving from this one should have two constructors. One which requires to specify some kind of address identifying the device, the other a USB vendor/product ID pair returning the first device of that kind found.

This class is far away from beeing generic, it just contains stuff needed for the DS2490.

This class is thread-safe.

See also:
LOW_portUsb_Factory

USB Specification Version 1.1

Author:
Harald Roelle

Parts of the documentation taken from libusb.

Definition at line 50 of file LOW_portUsbDevice.h.


Member Typedef Documentation

typedef uint8_t LOW_portUsbDevice::bmRequestType_t
 

Corresponds to type defined in USB 1.1 specification.

Definition at line 78 of file LOW_portUsbDevice.h.

typedef uint8_t LOW_portUsbDevice::bRequest_t
 

Corresponds to type defined in USB 1.1 specification.

Definition at line 79 of file LOW_portUsbDevice.h.

typedef uint8_t* LOW_portUsbDevice::msgData_t
 

Pointer type for I/O methods.

Definition at line 83 of file LOW_portUsbDevice.h.

Referenced by LOW_portUsbDevice_Linux::bulkRead(), LOW_portUsbDevice_Linux::bulkWrite(), and LOW_portUsbDevice_Linux::controlMsg().

typedef uint8_t LOW_portUsbDevice::usbConfig_t
 

Type for USB configuration.

Definition at line 75 of file LOW_portUsbDevice.h.

typedef uint8_t LOW_portUsbDevice::usbEndpoint_t
 

Type for USB endpoint.

Definition at line 85 of file LOW_portUsbDevice.h.

typedef uint8_t LOW_portUsbDevice::usbInterface_t
 

Type for USB interface.

Definition at line 76 of file LOW_portUsbDevice.h.

typedef uint16_t LOW_portUsbDevice::usbProductID_t
 

Type for USB product ID.

Definition at line 74 of file LOW_portUsbDevice.h.

Referenced by LOW_portUsbDevice_Linux::getProductID().

typedef uint8_t LOW_portUsbDevice::usbSetting_t
 

Type for USB setting.

Definition at line 77 of file LOW_portUsbDevice.h.

typedef uint16_t LOW_portUsbDevice::usbTimeout_t
 

Type for timeout on USB operations in ms.

Definition at line 84 of file LOW_portUsbDevice.h.

typedef uint16_t LOW_portUsbDevice::usbVendorID_t
 

Type for USB vendor ID.

Definition at line 73 of file LOW_portUsbDevice.h.

Referenced by LOW_portUsbDevice_Linux::getVendorID().

typedef uint16_t LOW_portUsbDevice::wIndex_t
 

Corresponds to type defined in USB 1.1 specification.

Definition at line 81 of file LOW_portUsbDevice.h.

Referenced by LOW_linkDS2490::comCmd_blockIO(), LOW_linkDS2490::comCmd_byteIO(), LOW_linkDS2490::comCmd_doAndRelease(), LOW_linkDS2490::comCmd_matchAccess(), LOW_linkDS2490::comCmd_oneWireReset(), LOW_linkDS2490::comCmd_readCrcProtPage(), LOW_linkDS2490::comCmd_readRedirectPageCrc(), LOW_linkDS2490::comCmd_readStraight(), LOW_linkDS2490::comCmd_searchAccess(), LOW_linkDS2490::comCmd_setDuration(), LOW_linkDS2490::comCmd_setPath(), LOW_linkDS2490::comCmd_writeEprom(), LOW_linkDS2490::comCmd_writeSramPage(), LOW_linkDS2490::modCmd_setDsoW0RecoveryTime(), LOW_linkDS2490::modCmd_setEnablePulse(), LOW_linkDS2490::modCmd_setEnableSpeedChange(), LOW_linkDS2490::modCmd_setOneWireSpeed(), LOW_linkDS2490::modCmd_setProgPulseDuration(), LOW_linkDS2490::modCmd_setPulldownSlewRate(), LOW_linkDS2490::modCmd_setStrongPullupDuration(), and LOW_linkDS2490::modCmd_setWrite1LowTime().

typedef uint16_t LOW_portUsbDevice::wLength_t
 

Corresponds to type defined in USB 1.1 specification.

Definition at line 82 of file LOW_portUsbDevice.h.

Referenced by LOW_linkDS2490::comCmd_readStraight().

typedef uint16_t LOW_portUsbDevice::wValue_t
 

Corresponds to type defined in USB 1.1 specification.

Definition at line 80 of file LOW_portUsbDevice.h.

Referenced by LOW_linkDS2490::comCmd_bitIO(), LOW_linkDS2490::comCmd_blockIO(), LOW_linkDS2490::comCmd_byteIO(), LOW_linkDS2490::comCmd_doAndRelease(), LOW_linkDS2490::comCmd_matchAccess(), LOW_linkDS2490::comCmd_oneWireReset(), LOW_linkDS2490::comCmd_pulse(), LOW_linkDS2490::comCmd_readCrcProtPage(), LOW_linkDS2490::comCmd_readRedirectPageCrc(), LOW_linkDS2490::comCmd_readStraight(), LOW_linkDS2490::comCmd_searchAccess(), LOW_linkDS2490::comCmd_setDuration(), LOW_linkDS2490::comCmd_setPath(), LOW_linkDS2490::comCmd_writeEprom(), and LOW_linkDS2490::comCmd_writeSramPage().


Constructor & Destructor Documentation

LOW_portUsbDevice::~LOW_portUsbDevice  )  [virtual]
 

Destructor.

Definition at line 28 of file LOW_portUsbDevice.cpp.


Member Function Documentation

virtual unsigned int LOW_portUsbDevice::bulkRead const usbEndpoint_t  inEP,
byteVec_t outData,
const usbTimeout_t  inTimeout
[pure virtual]
 

Read data from a bulk endpoint.

Parameters:
inEP The endpoint.
outData Data that was read. Preset length of the array determines amount of bytes to read.
inTimeout Timeout to wait for completion.
Returns:
Number of bytes actually read.

Implemented in LOW_portUsbDevice_Linux.

virtual unsigned int LOW_portUsbDevice::bulkRead const usbEndpoint_t  inEP,
const wLength_t  inLength,
msgData_t  outData,
const usbTimeout_t  inTimeout
[pure virtual]
 

Read data from a bulk endpoint.

Parameters:
inEP The endpoint.
inLength Number of bytes to read.
outData Pointer to memory to write data to. Memory must be already allocated!
inTimeout Timeout to wait for completion.
Returns:
Number of bytes actually read.

Implemented in LOW_portUsbDevice_Linux.

Referenced by LOW_linkDS2490::readDeviceStatus(), LOW_linkDS2490::searchDevices(), LOW_linkDS2490::touchBit(), LOW_linkDS2490::touchBlock(), and LOW_linkDS2490::touchByte().

virtual unsigned int LOW_portUsbDevice::bulkWrite const usbEndpoint_t  inEP,
const byteVec_t inData,
const usbTimeout_t  inTimeout
[pure virtual]
 

Write data to a bulk endpoint.

Parameters:
inEP The endpoint.
inData Data to write.
inTimeout Timeout to wait for completion.
Returns:
Number of bytes actually written.

Implemented in LOW_portUsbDevice_Linux.

virtual unsigned int LOW_portUsbDevice::bulkWrite const usbEndpoint_t  inEP,
const wLength_t  inLength,
const msgData_t  inData,
const usbTimeout_t  inTimeout
[pure virtual]
 

Write data to a bulk endpoint.

Parameters:
inEP The endpoint.
inLength Number of bytes to write.
inData Pointer to data to write.
inTimeout Timeout to wait for completion.
Returns:
Number of bytes actually written.

Implemented in LOW_portUsbDevice_Linux.

Referenced by LOW_linkDS2490::searchDevices(), and LOW_linkDS2490::touchBlock().

virtual void LOW_portUsbDevice::claimInterface const usbInterface_t  inInterface  )  [pure virtual]
 

Claim an interface of a device.

Claims the interface with the Operating System.

Note: The method must be called before you perform any operations related to this interface (like setIfaceAltSetting(), bulkWrite(), etc).

Parameters:
inInterface The value as specified in the USB descriptor field bInterfaceNumber.

Implemented in LOW_portUsbDevice_Linux.

Referenced by LOW_linkDS2490::commonConstructorActions().

LOW_portUsbDevice::class_DERIVE_FROM_EXCEPTION noSuchDevice_error  ,
portUsbDevice_error 
 

Exception class when a device could not be found.

LOW_portUsbDevice::class_DERIVE_FROM_EXCEPTION portUsbDevice_error  ,
LOW_exception 
 

Exception base class for all exceptions thrown by LOW_portUsbDevice.

virtual void LOW_portUsbDevice::clearHalt const usbEndpoint_t  inEP  )  [pure virtual]
 

Clears any halt status on an endpoint.

Parameters:
inEOP The value specified in the USB descriptor field bEndpointAddress.

Implemented in LOW_portUsbDevice_Linux.

virtual void LOW_portUsbDevice::controlMsg const bmRequestType_t  inReqType,
const bRequest_t  inRequest,
const wValue_t  inValue,
const wIndex_t  inIndex,
byteVec_t inOutData,
const usbTimeout_t  inTimeout
[pure virtual]
 

Send a control message to a device.

Performs a control request to the default control pipe on a device.

The parameters mirror the types of the same name in the USB specification.

Implemented in LOW_portUsbDevice_Linux.

virtual void LOW_portUsbDevice::controlMsg const bmRequestType_t  inReqType,
const bRequest_t  inRequest,
const wValue_t  inValue,
const wIndex_t  inIndex,
const wLength_t  inLength,
msgData_t  inOutData,
const usbTimeout_t  inTimeout
[pure virtual]
 

Send a control message to a device.

Performs a control request to the default control pipe on a device.

The parameters mirror the types of the same name in the USB specification.

Implemented in LOW_portUsbDevice_Linux.

Referenced by LOW_linkDS2490::comCmd_bitIO(), LOW_linkDS2490::comCmd_blockIO(), LOW_linkDS2490::comCmd_byteIO(), LOW_linkDS2490::comCmd_doAndRelease(), LOW_linkDS2490::comCmd_matchAccess(), LOW_linkDS2490::comCmd_oneWireReset(), LOW_linkDS2490::comCmd_pulse(), LOW_linkDS2490::comCmd_readCrcProtPage(), LOW_linkDS2490::comCmd_readRedirectPageCrc(), LOW_linkDS2490::comCmd_readStraight(), LOW_linkDS2490::comCmd_searchAccess(), LOW_linkDS2490::comCmd_setDuration(), LOW_linkDS2490::comCmd_setPath(), LOW_linkDS2490::comCmd_writeEprom(), LOW_linkDS2490::comCmd_writeSramPage(), LOW_linkDS2490::ctlCmd_flushCommCmds(), LOW_linkDS2490::ctlCmd_flushDataRcvBuffer(), LOW_linkDS2490::ctlCmd_flushDataXmtBuffer(), LOW_linkDS2490::ctlCmd_getCommCmds(), LOW_linkDS2490::ctlCmd_haltExecutionWhenDone(), LOW_linkDS2490::ctlCmd_haltExecutionWhenIdle(), LOW_linkDS2490::ctlCmd_resetDevice(), LOW_linkDS2490::ctlCmd_resumeExecution(), LOW_linkDS2490::ctlCmd_startExecution(), LOW_linkDS2490::modCmd_setDsoW0RecoveryTime(), LOW_linkDS2490::modCmd_setEnablePulse(), LOW_linkDS2490::modCmd_setEnableSpeedChange(), LOW_linkDS2490::modCmd_setOneWireSpeed(), LOW_linkDS2490::modCmd_setProgPulseDuration(), LOW_linkDS2490::modCmd_setPulldownSlewRate(), LOW_linkDS2490::modCmd_setStrongPullupDuration(), and LOW_linkDS2490::modCmd_setWrite1LowTime().

virtual usbProductID_t LOW_portUsbDevice::getProductID  )  [pure virtual]
 

Get product ID of USB device.

Implemented in LOW_portUsbDevice_Linux.

Referenced by LOW_linkDS2490::LOW_linkDS2490().

virtual usbVendorID_t LOW_portUsbDevice::getVendorID  )  [pure virtual]
 

Get vendor ID of USB device.

Implemented in LOW_portUsbDevice_Linux.

Referenced by LOW_linkDS2490::LOW_linkDS2490().

virtual void LOW_portUsbDevice::releaseInterface const usbInterface_t  inInterface  )  [pure virtual]
 

Releases a previously claimed interface.

Releases an interface previously claimed with claimInterface().

Parameters:
inInterface The value as specified in the USB descriptor field bInterfaceNumber.

Implemented in LOW_portUsbDevice_Linux.

Referenced by LOW_linkDS2490::~LOW_linkDS2490().

virtual void LOW_portUsbDevice::setConfiguration const usbConfig_t  inConfig  )  [pure virtual]
 

Sets the active configuration of a device.

Parameters:
inConfig The value as specified in the USB descriptor field bConfigurationValue.

Implemented in LOW_portUsbDevice_Linux.

virtual void LOW_portUsbDevice::setIfaceAltSetting const usbSetting_t  inAltSetting  )  [pure virtual]
 

Sets the active alternate setting of the current interface.

Parameters:
inAltInterface The value as specified in the USB descriptor field bAlternateSetting.

Implemented in LOW_portUsbDevice_Linux.


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 11:31:07 2004 for OneWireLibrary++ by doxygen 1.3.2