XnUSB.h File Reference
`#include "XnOS.h"`

Go to the source code of this file.

## Classes

struct | XnUSBEventArgs

## Typedefs

typedef XnChar | XnUSBConnectionString[XN_FILE_MAX_PATH]
typedef XnUSBDeviceHandle * | XN_USB_DEV_HANDLE
typedef XnUSBEndPointHandle * | XN_USB_EP_HANDLE
typedef XnBool(* | XnUSBReadCallbackFunctionPtr) (XnUChar *pBuffer, XnUInt32 nBufferSize, void *pCallbackData)
typedef XnBool(* | XnUSBEventCallbackFunctionPtr) (XnUSBEventType USBEventType, XnChar *cpDevPath, void *pCallbackData)
typedef struct XnUSBEventArgs | XnUSBEventArgs
typedef void(* | XnUSBDeviceCallbackFunctionPtr) (XnUSBEventArgs *pArgs, void *pCookie)

## Enumerations

enum | XnUSBDeviceSpeed { XN_USB_DEVICE_LOW_SPEED = 0 , XN_USB_DEVICE_FULL_SPEED , XN_USB_DEVICE_HIGH_SPEED }
enum | XnUSBEndPointType { XN_USB_EP_BULK = 0 , XN_USB_EP_ISOCHRONOUS , XN_USB_EP_INTERRUPT }
enum | XnUSBDirectionType { XN_USB_DIRECTION_IN = 0 , XN_USB_DIRECTION_OUT }
enum | XnUSBControlType { XN_USB_CONTROL_TYPE_STANDARD = 0 , XN_USB_CONTROL_TYPE_CLASS , XN_USB_CONTROL_TYPE_VENDOR }
enum | XnUSBEventType { XN_USB_EVENT_DEVICE_CONNECT = 0 , XN_USB_EVENT_DEVICE_DISCONNECT }

## Functions

XN_C_API XnStatus XN_C_DECL | xnUSBInit ()
XN_C_API XnStatus XN_C_DECL | xnUSBShutdown ()
XN_C_API XnStatus XN_C_DECL | xnUSBIsDevicePresent (XnUInt16 nVendorID, XnUInt16 nProductID, void *pExtraParam, XnBool *pbDevicePresent)
XN_C_API XnStatus XN_C_DECL | xnUSBEnumerateDevices (XnUInt16 nVendorID, XnUInt16 nProductID, const XnUSBConnectionString **pastrDevicePaths, XnUInt32 *pnCount)
XN_C_API void XN_C_DECL | xnUSBFreeDevicesList (const XnUSBConnectionString *astrDevicePaths)
XN_C_API XnStatus XN_C_DECL | xnUSBOpenDevice (XnUInt16 nVendorID, XnUInt16 nProductID, void *pExtraParam, void *pExtraParam2, XN_USB_DEV_HANDLE *pDevHandlePtr)
XN_C_API XnStatus XN_C_DECL | xnUSBOpenDeviceByPath (const XnUSBConnectionString strDevicePath, XN_USB_DEV_HANDLE *pDevHandlePtr)
XN_C_API XnStatus XN_C_DECL | xnUSBCloseDevice (XN_USB_DEV_HANDLE pDevHandle)
XN_C_API XnStatus XN_C_DECL | xnUSBGetDeviceSpeed (XN_USB_DEV_HANDLE pDevHandle, XnUSBDeviceSpeed *pDevSpeed)
XN_C_API XnStatus XN_C_DECL | xnUSBSetConfig (XN_USB_DEV_HANDLE pDevHandle, XnUInt8 nConfig)
XN_C_API XnStatus XN_C_DECL | xnUSBGetConfig (XN_USB_DEV_HANDLE pDevHandle, XnUInt8 *pnConfig)
XN_C_API XnStatus XN_C_DECL | xnUSBSetInterface (XN_USB_DEV_HANDLE pDevHandle, XnUInt8 nInterface, XnUInt8 nAltInterface)
XN_C_API XnStatus XN_C_DECL | xnUSBGetInterface (XN_USB_DEV_HANDLE pDevHandle, XnUInt8 *pnInterface, XnUInt8 *pnAltInterface)
XN_C_API XnStatus XN_C_DECL | xnUSBOpenEndPoint (XN_USB_DEV_HANDLE pDevHandle, XnUInt16 nEndPointID, XnUSBEndPointType nEPType, XnUSBDirectionType nDirType, XN_USB_EP_HANDLE *pEPHandlePtr)
XN_C_API XnStatus XN_C_DECL | xnUSBCloseEndPoint (XN_USB_EP_HANDLE pEPHandle)
XN_C_API XnStatus XN_C_DECL | xnUSBGetEndPointMaxPacketSize (XN_USB_EP_HANDLE pEPHandle, XnUInt32 *pnMaxPacketSize)
XN_C_API XnStatus XN_C_DECL | xnUSBAbortEndPoint (XN_USB_EP_HANDLE pEPHandle)
XN_C_API XnStatus XN_C_DECL | xnUSBFlushEndPoint (XN_USB_EP_HANDLE pEPHandle)
XN_C_API XnStatus XN_C_DECL | xnUSBResetEndPoint (XN_USB_EP_HANDLE pEPHandle)
XN_C_API XnStatus XN_C_DECL | xnUSBSendControl (XN_USB_DEV_HANDLE pDevHandle, XnUSBControlType nType, XnUInt8 nRequest, XnUInt16 nValue, XnUInt16 nIndex, XnUChar *pBuffer, XnUInt32 nBufferSize, XnUInt32 nTimeOut)
XN_C_API XnStatus XN_C_DECL | xnUSBReceiveControl (XN_USB_DEV_HANDLE pDevHandle, XnUSBControlType nType, XnUInt8 nRequest, XnUInt16 nValue, XnUInt16 nIndex, XnUChar *pBuffer, XnUInt32 nBufferSize, XnUInt32 *pnBytesReceived, XnUInt32 nTimeOut)
XN_C_API XnStatus XN_C_DECL | xnUSBReadEndPoint (XN_USB_EP_HANDLE pEPHandle, XnUChar *pBuffer, XnUInt32 nBufferSize, XnUInt32 *pnBytesReceived, XnUInt32 nTimeOut)
XN_C_API XnStatus XN_C_DECL | xnUSBWriteEndPoint (XN_USB_EP_HANDLE pEPHandle, XnUChar *pBuffer, XnUInt32 nBufferSize, XnUInt32 nTimeOut)
XN_C_API XnStatus XN_C_DECL | xnUSBQueueReadEndPoint (XN_USB_EP_HANDLE pEPHandle, XnUChar *pBuffer, XnUInt32 nBufferSize, XnUInt32 nTimeOut)
XN_C_API XnStatus XN_C_DECL | xnUSBFinishReadEndPoint (XN_USB_EP_HANDLE pEPHandle, XnUInt32 *pnBytesReceived, XnUInt32 nTimeOut)
XN_C_API XnStatus XN_C_DECL | xnUSBInitReadThread (XN_USB_EP_HANDLE pEPHandle, XnUInt32 nBufferSize, XnUInt32 nNumBuffers, XnUInt32 nTimeOut, XnUSBReadCallbackFunctionPtr pCallbackFunction, void *pCallbackData)
XN_C_API XnStatus XN_C_DECL | xnUSBShutdownReadThread (XN_USB_EP_HANDLE pEPHandle)
XN_C_API XnStatus XN_C_DECL | xnUSBSetCallbackHandler (XnUInt16 nVendorID, XnUInt16 nProductID, void *pExtraParam, XnUSBEventCallbackFunctionPtr pCallbackFunction, void *pCallbackData)
XN_C_API XnStatus XN_C_DECL | xnUSBRegisterToConnectivityEvents (XnUInt16 nVendorID, XnUInt16 nProductID, XnUSBDeviceCallbackFunctionPtr pFunc, void *pCookie, XnRegistrationHandle *phRegistration)
XN_C_API void XN_C_DECL | xnUSBUnregisterFromConnectivityEvents (XnRegistrationHandle hRegistration)

## Typedef Documentation

## XN_USB_DEV_HANDLE

typedef XnUSBDeviceHandle* XN_USB_DEV_HANDLE

## XN_USB_EP_HANDLE

typedef XnUSBEndPointHandle* XN_USB_EP_HANDLE

## XnUSBConnectionString

typedef XnChar XnUSBConnectionString[XN_FILE_MAX_PATH]

## XnUSBDeviceCallbackFunctionPtr

typedef void(* XnUSBDeviceCallbackFunctionPtr) (XnUSBEventArgs *pArgs, void *pCookie)

## XnUSBEventArgs

typedef struct XnUSBEventArgs XnUSBEventArgs

## XnUSBEventCallbackFunctionPtr

typedef XnBool(* XnUSBEventCallbackFunctionPtr) (XnUSBEventType USBEventType, XnChar *cpDevPath, void *pCallbackData)

## XnUSBReadCallbackFunctionPtr

typedef XnBool(* XnUSBReadCallbackFunctionPtr) (XnUChar *pBuffer, XnUInt32 nBufferSize, void *pCallbackData)

## Enumeration Type Documentation

## XnUSBControlType

enum XnUSBControlType

Enumerator
XN_USB_CONTROL_TYPE_STANDARD |
XN_USB_CONTROL_TYPE_CLASS |
XN_USB_CONTROL_TYPE_VENDOR |

## XnUSBDeviceSpeed

enum XnUSBDeviceSpeed

Enumerator
XN_USB_DEVICE_LOW_SPEED |
XN_USB_DEVICE_FULL_SPEED |
XN_USB_DEVICE_HIGH_SPEED |

## XnUSBDirectionType

enum XnUSBDirectionType

Enumerator
XN_USB_DIRECTION_IN |
XN_USB_DIRECTION_OUT |

## XnUSBEndPointType

enum XnUSBEndPointType

Enumerator
XN_USB_EP_BULK |
XN_USB_EP_ISOCHRONOUS |
XN_USB_EP_INTERRUPT |

## XnUSBEventType

enum XnUSBEventType

Enumerator
XN_USB_EVENT_DEVICE_CONNECT |
XN_USB_EVENT_DEVICE_DISCONNECT |

## Function Documentation

## xnUSBAbortEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBAbortEndPoint | ( | XN_USB_EP_HANDLE | pEPHandle | ) |

## xnUSBCloseDevice()

XN_C_API XnStatus XN_C_DECL xnUSBCloseDevice | ( | XN_USB_DEV_HANDLE | pDevHandle | ) |

## xnUSBCloseEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBCloseEndPoint | ( | XN_USB_EP_HANDLE | pEPHandle | ) |

## xnUSBEnumerateDevices()

XN_C_API XnStatus XN_C_DECL xnUSBEnumerateDevices | ( | XnUInt16 | nVendorID,
|  | XnUInt16 | nProductID,
|  | const XnUSBConnectionString ** | pastrDevicePaths,
|  | XnUInt32 * | pnCount )

## xnUSBFinishReadEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBFinishReadEndPoint | ( | XN_USB_EP_HANDLE | pEPHandle,
|  | XnUInt32 * | pnBytesReceived,
|  | XnUInt32 | nTimeOut )

## xnUSBFlushEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBFlushEndPoint | ( | XN_USB_EP_HANDLE | pEPHandle | ) |

## xnUSBFreeDevicesList()

XN_C_API void XN_C_DECL xnUSBFreeDevicesList | ( | const XnUSBConnectionString * | astrDevicePaths | ) |

## xnUSBGetConfig()

XN_C_API XnStatus XN_C_DECL xnUSBGetConfig | ( | XN_USB_DEV_HANDLE | pDevHandle,
|  | XnUInt8 * | pnConfig )

## xnUSBGetDeviceSpeed()

XN_C_API XnStatus XN_C_DECL xnUSBGetDeviceSpeed | ( | XN_USB_DEV_HANDLE | pDevHandle,
|  | XnUSBDeviceSpeed * | pDevSpeed )

## xnUSBGetEndPointMaxPacketSize()

XN_C_API XnStatus XN_C_DECL xnUSBGetEndPointMaxPacketSize | ( | XN_USB_EP_HANDLE | pEPHandle,
|  | XnUInt32 * | pnMaxPacketSize )

## xnUSBGetInterface()

XN_C_API XnStatus XN_C_DECL xnUSBGetInterface | ( | XN_USB_DEV_HANDLE | pDevHandle,
|  | XnUInt8 * | pnInterface,
|  | XnUInt8 * | pnAltInterface )

## xnUSBInit()

XN_C_API XnStatus XN_C_DECL xnUSBInit | ( |  | ) |

## xnUSBInitReadThread()

XN_C_API XnStatus XN_C_DECL xnUSBInitReadThread | ( | XN_USB_EP_HANDLE | pEPHandle,
|  | XnUInt32 | nBufferSize,
|  | XnUInt32 | nNumBuffers,
|  | XnUInt32 | nTimeOut,
|  | XnUSBReadCallbackFunctionPtr | pCallbackFunction,
|  | void * | pCallbackData )

## xnUSBIsDevicePresent()

XN_C_API XnStatus XN_C_DECL xnUSBIsDevicePresent | ( | XnUInt16 | nVendorID,
|  | XnUInt16 | nProductID,
|  | void * | pExtraParam,
|  | XnBool * | pbDevicePresent )

## xnUSBOpenDevice()

XN_C_API XnStatus XN_C_DECL xnUSBOpenDevice | ( | XnUInt16 | nVendorID,
|  | XnUInt16 | nProductID,
|  | void * | pExtraParam,
|  | void * | pExtraParam2,
|  | XN_USB_DEV_HANDLE * | pDevHandlePtr )

## xnUSBOpenDeviceByPath()

XN_C_API XnStatus XN_C_DECL xnUSBOpenDeviceByPath | ( | const XnUSBConnectionString | strDevicePath,
|  | XN_USB_DEV_HANDLE * | pDevHandlePtr )

## xnUSBOpenEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBOpenEndPoint | ( | XN_USB_DEV_HANDLE | pDevHandle,
|  | XnUInt16 | nEndPointID,
|  | XnUSBEndPointType | nEPType,
|  | XnUSBDirectionType | nDirType,
|  | XN_USB_EP_HANDLE * | pEPHandlePtr )

## xnUSBQueueReadEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBQueueReadEndPoint | ( | XN_USB_EP_HANDLE | pEPHandle,
|  | XnUChar * | pBuffer,
|  | XnUInt32 | nBufferSize,
|  | XnUInt32 | nTimeOut )

## xnUSBReadEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBReadEndPoint | ( | XN_USB_EP_HANDLE | pEPHandle,
|  | XnUChar * | pBuffer,
|  | XnUInt32 | nBufferSize,
|  | XnUInt32 * | pnBytesReceived,
|  | XnUInt32 | nTimeOut )

## xnUSBReceiveControl()

XN_C_API XnStatus XN_C_DECL xnUSBReceiveControl | ( | XN_USB_DEV_HANDLE | pDevHandle,
|  | XnUSBControlType | nType,
|  | XnUInt8 | nRequest,
|  | XnUInt16 | nValue,
|  | XnUInt16 | nIndex,
|  | XnUChar * | pBuffer,
|  | XnUInt32 | nBufferSize,
|  | XnUInt32 * | pnBytesReceived,
|  | XnUInt32 | nTimeOut )

## xnUSBRegisterToConnectivityEvents()

XN_C_API XnStatus XN_C_DECL xnUSBRegisterToConnectivityEvents | ( | XnUInt16 | nVendorID,
|  | XnUInt16 | nProductID,
|  | XnUSBDeviceCallbackFunctionPtr | pFunc,
|  | void * | pCookie,
|  | XnRegistrationHandle * | phRegistration )

## xnUSBResetEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBResetEndPoint | ( | XN_USB_EP_HANDLE | pEPHandle | ) |

## xnUSBSendControl()

XN_C_API XnStatus XN_C_DECL xnUSBSendControl | ( | XN_USB_DEV_HANDLE | pDevHandle,
|  | XnUSBControlType | nType,
|  | XnUInt8 | nRequest,
|  | XnUInt16 | nValue,
|  | XnUInt16 | nIndex,
|  | XnUChar * | pBuffer,
|  | XnUInt32 | nBufferSize,
|  | XnUInt32 | nTimeOut )

## xnUSBSetCallbackHandler()

XN_C_API XnStatus XN_C_DECL xnUSBSetCallbackHandler | ( | XnUInt16 | nVendorID,
|  | XnUInt16 | nProductID,
|  | void * | pExtraParam,
|  | XnUSBEventCallbackFunctionPtr | pCallbackFunction,
|  | void * | pCallbackData )

## xnUSBSetConfig()

XN_C_API XnStatus XN_C_DECL xnUSBSetConfig | ( | XN_USB_DEV_HANDLE | pDevHandle,
|  | XnUInt8 | nConfig )

## xnUSBSetInterface()

XN_C_API XnStatus XN_C_DECL xnUSBSetInterface | ( | XN_USB_DEV_HANDLE | pDevHandle,
|  | XnUInt8 | nInterface,
|  | XnUInt8 | nAltInterface )

## xnUSBShutdown()

XN_C_API XnStatus XN_C_DECL xnUSBShutdown | ( |  | ) |

## xnUSBShutdownReadThread()

XN_C_API XnStatus XN_C_DECL xnUSBShutdownReadThread | ( | XN_USB_EP_HANDLE | pEPHandle | ) |

## xnUSBUnregisterFromConnectivityEvents()

XN_C_API void XN_C_DECL xnUSBUnregisterFromConnectivityEvents | ( | XnRegistrationHandle | hRegistration | ) |

## xnUSBWriteEndPoint()

XN_C_API XnStatus XN_C_DECL xnUSBWriteEndPoint | ( | XN_USB_EP_HANDLE | pEPHandle,
|  | XnUChar * | pBuffer,
|  | XnUInt32 | nBufferSize,
|  | XnUInt32 | nTimeOut )