XnUSB.h
Go to the documentation of this file.
/****************************************************************************
* *
* OpenNI 1.x Alpha *
* Copyright (C) 2011 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* OpenNI is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* OpenNI is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
* *
****************************************************************************/
#ifndef _XN_USB_H_
#define _XN_USB_H_
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "XnOS.h"
//---------------------------------------------------------------------------
// Structures & Enums
//---------------------------------------------------------------------------
typedef enum {
XN_USB_DEVICE_LOW_SPEED = 0,
XN_USB_DEVICE_FULL_SPEED,
XN_USB_DEVICE_HIGH_SPEED,
} XnUSBDeviceSpeed;
typedef enum {
XN_USB_EP_BULK = 0,
XN_USB_EP_ISOCHRONOUS,
XN_USB_EP_INTERRUPT,
} XnUSBEndPointType;
typedef enum {
XN_USB_DIRECTION_IN = 0,
XN_USB_DIRECTION_OUT,
} XnUSBDirectionType;
typedef enum {
XN_USB_CONTROL_TYPE_STANDARD = 0,
XN_USB_CONTROL_TYPE_CLASS,
XN_USB_CONTROL_TYPE_VENDOR,
} XnUSBControlType;
typedef enum {
XN_USB_EVENT_DEVICE_CONNECT = 0,
XN_USB_EVENT_DEVICE_DISCONNECT,
} XnUSBEventType;
struct XnUSBDeviceHandle;
struct XnUSBEndPointHandle;
typedef XnChar XnUSBConnectionString[XN_FILE_MAX_PATH];
typedef XnUSBDeviceHandle* XN_USB_DEV_HANDLE;
typedef XnUSBEndPointHandle* XN_USB_EP_HANDLE;
typedef XnBool (XN_CALLBACK_TYPE* XnUSBReadCallbackFunctionPtr)(XnUChar* pBuffer, XnUInt32 nBufferSize, void* pCallbackData);
typedef XnBool (XN_CALLBACK_TYPE* XnUSBEventCallbackFunctionPtr)(XnUSBEventType USBEventType, XnChar* cpDevPath, void* pCallbackData);
typedef struct XnUSBEventArgs
{
const XnChar* strDevicePath;
XnUSBEventType eventType;
} XnUSBEventArgs;
typedef void (XN_CALLBACK_TYPE* XnUSBDeviceCallbackFunctionPtr)(XnUSBEventArgs* pArgs, void* pCookie);
//---------------------------------------------------------------------------
// Exported Function Declaration
//---------------------------------------------------------------------------
XN_C_API XnStatus XN_C_DECL xnUSBInit();
XN_C_API XnStatus XN_C_DECL xnUSBShutdown();
XN_C_API XnStatus XN_API_DEPRECATED("Use xnUSBEnumerateDevices() instead") 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_API_DEPRECATED("Use xnUSBOpenDeviceByPath() instead") 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_API_DEPRECATED("Use xnUSBRegisterToConnectivityEvents() instead") 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);
#endif //_XN_USB_H_
XnOS.h
XnRegistrationHandle
struct XnRegistrationHandleImpl * XnRegistrationHandle
Definition XnPlatform.h:112
XN_C_API
#define XN_C_API
Definition XnPlatform.h:132
XnStatus
XnUInt32 XnStatus
Definition XnStatus.h:34
XnUSBDeviceCallbackFunctionPtr
void(* XnUSBDeviceCallbackFunctionPtr)(XnUSBEventArgs *pArgs, void *pCookie)
Definition XnUSB.h:78
xnUSBFreeDevicesList
XN_C_API void XN_C_DECL xnUSBFreeDevicesList(const XnUSBConnectionString *astrDevicePaths)
xnUSBSetCallbackHandler
XN_C_API XnStatus XN_C_DECL xnUSBSetCallbackHandler(XnUInt16 nVendorID, XnUInt16 nProductID, void *pExtraParam, XnUSBEventCallbackFunctionPtr pCallbackFunction, void *pCallbackData)
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)
xnUSBUnregisterFromConnectivityEvents
XN_C_API void XN_C_DECL xnUSBUnregisterFromConnectivityEvents(XnRegistrationHandle hRegistration)
xnUSBGetEndPointMaxPacketSize
XN_C_API XnStatus XN_C_DECL xnUSBGetEndPointMaxPacketSize(XN_USB_EP_HANDLE pEPHandle, XnUInt32 *pnMaxPacketSize)
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)
XN_USB_DEV_HANDLE
XnUSBDeviceHandle * XN_USB_DEV_HANDLE
Definition XnUSB.h:66
xnUSBOpenDevice
XN_C_API XnStatus XN_C_DECL xnUSBOpenDevice(XnUInt16 nVendorID, XnUInt16 nProductID, void *pExtraParam, void *pExtraParam2, XN_USB_DEV_HANDLE *pDevHandlePtr)
xnUSBGetInterface
XN_C_API XnStatus XN_C_DECL xnUSBGetInterface(XN_USB_DEV_HANDLE pDevHandle, XnUInt8 *pnInterface, XnUInt8 *pnAltInterface)
XN_USB_EP_HANDLE
XnUSBEndPointHandle * XN_USB_EP_HANDLE
Definition XnUSB.h:67
XnUSBReadCallbackFunctionPtr
XnBool(* XnUSBReadCallbackFunctionPtr)(XnUChar *pBuffer, XnUInt32 nBufferSize, void *pCallbackData)
Definition XnUSB.h:69
xnUSBGetConfig
XN_C_API XnStatus XN_C_DECL xnUSBGetConfig(XN_USB_DEV_HANDLE pDevHandle, XnUInt8 *pnConfig)
xnUSBWriteEndPoint
XN_C_API XnStatus XN_C_DECL xnUSBWriteEndPoint(XN_USB_EP_HANDLE pEPHandle, XnUChar *pBuffer, XnUInt32 nBufferSize, XnUInt32 nTimeOut)
xnUSBInitReadThread
XN_C_API XnStatus XN_C_DECL xnUSBInitReadThread(XN_USB_EP_HANDLE pEPHandle, XnUInt32 nBufferSize, XnUInt32 nNumBuffers, XnUInt32 nTimeOut, XnUSBReadCallbackFunctionPtr pCallbackFunction, void *pCallbackData)
xnUSBQueueReadEndPoint
XN_C_API XnStatus XN_C_DECL xnUSBQueueReadEndPoint(XN_USB_EP_HANDLE pEPHandle, XnUChar *pBuffer, XnUInt32 nBufferSize, XnUInt32 nTimeOut)
xnUSBRegisterToConnectivityEvents
XN_C_API XnStatus XN_C_DECL xnUSBRegisterToConnectivityEvents(XnUInt16 nVendorID, XnUInt16 nProductID, XnUSBDeviceCallbackFunctionPtr pFunc, void *pCookie, XnRegistrationHandle *phRegistration)
xnUSBAbortEndPoint
XN_C_API XnStatus XN_C_DECL xnUSBAbortEndPoint(XN_USB_EP_HANDLE pEPHandle)
xnUSBShutdownReadThread
XN_C_API XnStatus XN_C_DECL xnUSBShutdownReadThread(XN_USB_EP_HANDLE pEPHandle)
xnUSBSetConfig
XN_C_API XnStatus XN_C_DECL xnUSBSetConfig(XN_USB_DEV_HANDLE pDevHandle, XnUInt8 nConfig)
XnUSBConnectionString
XnChar XnUSBConnectionString[XN_FILE_MAX_PATH]
Definition XnUSB.h:64
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)
xnUSBShutdown
XN_C_API XnStatus XN_C_DECL xnUSBShutdown()
xnUSBSetInterface
XN_C_API XnStatus XN_C_DECL xnUSBSetInterface(XN_USB_DEV_HANDLE pDevHandle, XnUInt8 nInterface, XnUInt8 nAltInterface)
xnUSBFlushEndPoint
XN_C_API XnStatus XN_C_DECL xnUSBFlushEndPoint(XN_USB_EP_HANDLE pEPHandle)
XnUSBDeviceSpeed
XnUSBDeviceSpeed
Definition XnUSB.h:33
XN_USB_DEVICE_FULL_SPEED
@ XN_USB_DEVICE_FULL_SPEED
Definition XnUSB.h:35
XN_USB_DEVICE_HIGH_SPEED
@ XN_USB_DEVICE_HIGH_SPEED
Definition XnUSB.h:36
XN_USB_DEVICE_LOW_SPEED
@ XN_USB_DEVICE_LOW_SPEED
Definition XnUSB.h:34
xnUSBReadEndPoint
XN_C_API XnStatus XN_C_DECL xnUSBReadEndPoint(XN_USB_EP_HANDLE pEPHandle, XnUChar *pBuffer, XnUInt32 nBufferSize, XnUInt32 *pnBytesReceived, XnUInt32 nTimeOut)
xnUSBResetEndPoint
XN_C_API XnStatus XN_C_DECL xnUSBResetEndPoint(XN_USB_EP_HANDLE pEPHandle)
xnUSBEnumerateDevices
XN_C_API XnStatus XN_C_DECL xnUSBEnumerateDevices(XnUInt16 nVendorID, XnUInt16 nProductID, const XnUSBConnectionString **pastrDevicePaths, XnUInt32 *pnCount)
XnUSBEventCallbackFunctionPtr
XnBool(* XnUSBEventCallbackFunctionPtr)(XnUSBEventType USBEventType, XnChar *cpDevPath, void *pCallbackData)
Definition XnUSB.h:70
xnUSBInit
XN_C_API XnStatus XN_C_DECL xnUSBInit()
xnUSBFinishReadEndPoint
XN_C_API XnStatus XN_C_DECL xnUSBFinishReadEndPoint(XN_USB_EP_HANDLE pEPHandle, XnUInt32 *pnBytesReceived, XnUInt32 nTimeOut)
XnUSBDirectionType
XnUSBDirectionType
Definition XnUSB.h:45
XN_USB_DIRECTION_OUT
@ XN_USB_DIRECTION_OUT
Definition XnUSB.h:47
XN_USB_DIRECTION_IN
@ XN_USB_DIRECTION_IN
Definition XnUSB.h:46
XnUSBControlType
XnUSBControlType
Definition XnUSB.h:50
XN_USB_CONTROL_TYPE_STANDARD
@ XN_USB_CONTROL_TYPE_STANDARD
Definition XnUSB.h:51
XN_USB_CONTROL_TYPE_VENDOR
@ XN_USB_CONTROL_TYPE_VENDOR
Definition XnUSB.h:53
XN_USB_CONTROL_TYPE_CLASS
@ XN_USB_CONTROL_TYPE_CLASS
Definition XnUSB.h:52
xnUSBIsDevicePresent
XN_C_API XnStatus XN_C_DECL xnUSBIsDevicePresent(XnUInt16 nVendorID, XnUInt16 nProductID, void *pExtraParam, XnBool *pbDevicePresent)
xnUSBGetDeviceSpeed
XN_C_API XnStatus XN_C_DECL xnUSBGetDeviceSpeed(XN_USB_DEV_HANDLE pDevHandle, XnUSBDeviceSpeed *pDevSpeed)
XnUSBEndPointType
XnUSBEndPointType
Definition XnUSB.h:39
XN_USB_EP_INTERRUPT
@ XN_USB_EP_INTERRUPT
Definition XnUSB.h:42
XN_USB_EP_BULK
@ XN_USB_EP_BULK
Definition XnUSB.h:40
XN_USB_EP_ISOCHRONOUS
@ XN_USB_EP_ISOCHRONOUS
Definition XnUSB.h:41
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)
XnUSBEventType
XnUSBEventType
Definition XnUSB.h:56
XN_USB_EVENT_DEVICE_CONNECT
@ XN_USB_EVENT_DEVICE_CONNECT
Definition XnUSB.h:57
XN_USB_EVENT_DEVICE_DISCONNECT
@ XN_USB_EVENT_DEVICE_DISCONNECT
Definition XnUSB.h:58
XnUSBEventArgs
Definition XnUSB.h:73
XnUSBEventArgs::strDevicePath
const XnChar * strDevicePath
Definition XnUSB.h:74
XnUSBEventArgs::eventType
XnUSBEventType eventType
Definition XnUSB.h:75