OpenNI 1.5.4
XnUSBDevice.h
Go to the documentation of this file.
1/****************************************************************************
2* *
3* OpenNI 1.x 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
33 #include <Win32/usb100.h>
34 typedef USB_ENDPOINT_DESCRIPTOR XnUSBEndpointDescriptor;
35 typedef USB_INTERFACE_DESCRIPTOR XnUSBInterfaceDescriptor;
36 typedef USB_CONFIGURATION_DESCRIPTOR XnUSBConfigDescriptor;
37 typedef USB_DEVICE_DESCRIPTOR XnUSBDeviceDescriptor;
38
39 #define USB_DT_CONFIG_SIZE 0
40 #define USB_DT_CONFIG 0
41 #define USB_CONFIG_ATT_ONE 0
42 #define USB_DT_ENDPOINT_SIZE 0
43 #define USB_DT_ENDPOINT 0
44 #define USB_ENDPOINT_XFER_BULK 0
45 #define USB_DT_INTERFACE_SIZE 0
46 #define USB_DT_INTERFACE 0
47 #define USB_CLASS_VENDOR_SPEC 0
48 #define USB_DT_DEVICE_SIZE 0
49 #define USB_DT_DEVICE 0
50
51#elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM || XN_PLATFORM == XN_PLATFORM_LINUX_AARCH64 || XN_PLATFORM == XN_PLATFORM_LINUX_POWERPC || XN_PLATFORM == XN_PLATFORM_LINUX_MIPS || XN_PLATFORM == XN_PLATFORM_LINUX_RISCV64 || XN_PLATFORM == XN_PLATFORM_LINUX_LOONGARCH64)
52 #include <linux/usb/ch9.h>
53 typedef struct usb_endpoint_descriptor XnUSBEndpointDescriptor;
54 typedef struct usb_interface_descriptor XnUSBInterfaceDescriptor;
55 typedef struct usb_config_descriptor XnUSBConfigDescriptor;
56 typedef struct usb_device_descriptor XnUSBDeviceDescriptor;
57#else
58 #error "Unsupported Platform!"
59#endif
60
61//---------------------------------------------------------------------------
62// Structures & Enums
63//---------------------------------------------------------------------------
70
72{
73 XnUInt8 nID;
74 const XnChar* strString;
76
82
88
96
97struct XnUSBDevice;
98typedef struct XnUSBDevice XnUSBDevice;
99
100typedef void (*XnUSBDeviceNewControlRequestCallback)(XnUSBDevice* pDevice, void* pCookie);
102
103//---------------------------------------------------------------------------
104// API
105//---------------------------------------------------------------------------
106XN_C_API XnStatus XN_C_DECL xnUSBDeviceInit(const XnUSBDeviceDescriptorHolder* pDeviceDescriptor, XnUInt32 nControlMessageMaxSize, XnUSBDevice** ppDevice);
107XN_C_API void XN_C_DECL xnUSBDeviceShutdown(XnUSBDevice* pDevice);
109
110//pnRequestSize is max size on input, actual size on output
111XN_C_API XnStatus XN_C_DECL xnUSBDeviceReceiveControlRequest(XnUSBDevice* pDevice, XnUChar* pBuffer, XnUInt32* pnRequestSize);
112XN_C_API XnStatus XN_C_DECL xnUSBDeviceSendControlReply(XnUSBDevice* pDevice, const XnUChar* pBuffer, XnUInt32 nReplySize);
115XN_C_API XnStatus XN_C_DECL xnUSBDeviceWriteEndpoint(XnUSBDevice* pDevice, XnUInt8 nAddress, const XnUChar* pData, XnUInt32 nDataSize);
116
117#endif
#define XN_C_API
Definition XnPlatform.h:132
XnUInt32 XnStatus
Definition XnStatus.h:34
XN_C_API XnStatus XN_C_DECL xnUSBDeviceWriteEndpoint(XnUSBDevice *pDevice, XnUInt8 nAddress, const XnUChar *pData, XnUInt32 nDataSize)
XN_C_API XnStatus XN_C_DECL xnUSBDeviceReceiveControlRequest(XnUSBDevice *pDevice, XnUChar *pBuffer, XnUInt32 *pnRequestSize)
USB_DEVICE_DESCRIPTOR XnUSBDeviceDescriptor
Definition XnUSBDevice.h:37
XN_C_API void XN_C_DECL xnUSBDeviceShutdown(XnUSBDevice *pDevice)
XN_C_API XnStatus XN_C_DECL xnUSBDeviceSetNewControlRequestCallback(XnUSBDevice *pDevice, XnUSBDeviceNewControlRequestCallback pFunc, void *pCookie)
struct XnUSBStringDescriptor XnUSBStringDescriptor
void(* XnUSBDeviceConnectivityChangedCallback)(XnUSBDevice *pDevice, XnUSBDeviceConnectionState state, void *pCookie)
Definition XnUSBDevice.h:101
void(* XnUSBDeviceNewControlRequestCallback)(XnUSBDevice *pDevice, void *pCookie)
Definition XnUSBDevice.h:100
XN_C_API XnStatus XN_C_DECL xnUSBDeviceInit(const XnUSBDeviceDescriptorHolder *pDeviceDescriptor, XnUInt32 nControlMessageMaxSize, XnUSBDevice **ppDevice)
struct XnUSBDevice XnUSBDevice
Definition XnUSBDevice.h:98
struct XnUSBDeviceDescriptorHolder XnUSBDeviceDescriptorHolder
USB_ENDPOINT_DESCRIPTOR XnUSBEndpointDescriptor
Definition XnUSBDevice.h:34
USB_CONFIGURATION_DESCRIPTOR XnUSBConfigDescriptor
Definition XnUSBDevice.h:36
struct XnUSBInterfaceDescriptorHolder XnUSBInterfaceDescriptorHolder
XnUSBDeviceConnectionState
Definition XnUSBDevice.h:65
@ XN_USB_DEVICE_CONNECTED
Definition XnUSBDevice.h:67
@ XN_USB_DEVICE_DISCONNECTED
Definition XnUSBDevice.h:66
@ XN_USB_DEVICE_SUSPENDED
Definition XnUSBDevice.h:68
XN_C_API XnStatus XN_C_DECL xnUSBDeviceSendControlReply(XnUSBDevice *pDevice, const XnUChar *pBuffer, XnUInt32 nReplySize)
USB_INTERFACE_DESCRIPTOR XnUSBInterfaceDescriptor
Definition XnUSBDevice.h:35
XN_C_API XnStatus XN_C_DECL xnUSBDeviceSetConnectivityChangedCallback(XnUSBDevice *pDevice, XnUSBDeviceConnectivityChangedCallback pFunc, void *pCookie)
struct XnUSBConfigDescriptorHolder XnUSBConfigDescriptorHolder
XN_C_API XnBool XN_C_DECL xnUSBDeviceIsControlRequestPending(XnUSBDevice *pDevice)
Definition XnUSBDevice.h:84
XnUSBConfigDescriptor descriptor
Definition XnUSBDevice.h:85
XnUSBInterfaceDescriptorHolder ** aInterfaces
Definition XnUSBDevice.h:86
Definition XnUSBDevice.h:90
XnUInt8 nStrings
Definition XnUSBDevice.h:94
XnUSBStringDescriptor * aStrings
Definition XnUSBDevice.h:93
XnUSBDeviceDescriptor descriptor
Definition XnUSBDevice.h:91
XnUSBConfigDescriptorHolder ** aConfigurations
Definition XnUSBDevice.h:92
Definition XnUSBDevice.h:78
XnUSBInterfaceDescriptor descriptor
Definition XnUSBDevice.h:79
XnUSBEndpointDescriptor ** aEndpoints
Definition XnUSBDevice.h:80
Definition XnUSBDevice.h:72
XnUInt8 nID
Definition XnUSBDevice.h:73
const XnChar * strString
Definition XnUSBDevice.h:74