OpenNI 1.3.2
XnUSBDevice.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * OpenNI 1.1 Alpha *
4 * Copyright (C) 2011 PrimeSense Ltd. *
5 * *
6 * This file is part of OpenNI. *
7 * *
8 * OpenNI is free software: you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published *
10 * by the Free Software Foundation, either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * OpenNI is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
20 * *
21 ****************************************************************************/
22 #ifndef _XN_USB_DEVICE_H_
23 #define _XN_USB_DEVICE_H_
24 
25 //---------------------------------------------------------------------------
26 // Includes
27 //---------------------------------------------------------------------------
28 #include "XnPlatform.h"
29 #include "XnStatus.h"
30 
31 #if (XN_PLATFORM == XN_PLATFORM_WIN32)
32  #include <usb100.h>
33  typedef struct USB_ENDPOINT_DESCRIPTOR XnUSBEndpointDescriptor;
34  typedef struct USB_INTERFACE_DESCRIPTOR XnUSBInterfaceDescriptor;
35  typedef struct USB_CONFIGURATION_DESCRIPTOR XnUSBConfigDescriptor;
36  typedef struct USB_DEVICE_DESCRIPTOR XnUSBDeviceDescriptor;
37 #elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM)
38  #include <linux/usb/ch9.h>
39  typedef struct usb_endpoint_descriptor XnUSBEndpointDescriptor;
40  typedef struct usb_interface_descriptor XnUSBInterfaceDescriptor;
41  typedef struct usb_config_descriptor XnUSBConfigDescriptor;
42  typedef struct usb_device_descriptor XnUSBDeviceDescriptor;
43 #else
44  #error "Unsupported Platform!"
45 #endif
46 
47 //---------------------------------------------------------------------------
48 // Structures & Enums
49 //---------------------------------------------------------------------------
50 typedef struct XnUSBStringDescriptor
51 {
52  XnUInt8 nID;
53  const XnChar* strString;
55 
57 {
58  XnUSBInterfaceDescriptor descriptor;
59  XnUSBEndpointDescriptor** aEndpoints;
61 
63 {
64  XnUSBConfigDescriptor descriptor;
67 
69 {
70  XnUSBDeviceDescriptor descriptor;
73  XnUInt8 nStrings;
75 
76 struct XnUSBDevice;
77 typedef struct XnUSBDevice XnUSBDevice;
78 
79 typedef void (*XnUSBDeviceNewControlRequestCallback)(XnUSBDevice* pDevice, void* pCookie);
80 
81 //---------------------------------------------------------------------------
82 // API
83 //---------------------------------------------------------------------------
84 XN_C_API XnStatus XN_C_DECL xnUSBDeviceInit(const XnUSBDeviceDescriptorHolder* pDeviceDescriptor, XnUInt32 nControlMessageMaxSize, XnUSBDevice** ppDevice);
85 XN_C_API void XN_C_DECL xnUSBDeviceShutdown(XnUSBDevice* pDevice);
87 XN_C_API XnStatus XN_C_DECL xnUSBDeviceReceiveControlRequest(XnUSBDevice* pDevice, XnUChar* pBuffer, XnUInt32* pnRequestSize);
88 XN_C_API XnStatus XN_C_DECL xnUSBDeviceSendControlReply(XnUSBDevice* pDevice, const XnUChar* pBuffer, XnUInt32 nReplySize);
90 XN_C_API XnStatus XN_C_DECL xnUSBDeviceWriteEndpoint(XnUSBDevice* pDevice, XnUInt8 nAddress, XnUChar* pData, XnUInt32 nDataSize);
91 
92 #endif