OpenNI 1.5.7
XnUSBDevice.h
Go to the documentation of this file.
1/*****************************************************************************
2* *
3* OpenNI 1.x Alpha *
4* Copyright (C) 2012 PrimeSense Ltd. *
5* *
6* This file is part of OpenNI. *
7* *
8* Licensed under the Apache License, Version 2.0 (the "License"); *
9* you may not use this file except in compliance with the License. *
10* You may obtain a copy of the License at *
11* *
12* http://www.apache.org/licenses/LICENSE-2.0 *
13* *
14* Unless required by applicable law or agreed to in writing, software *
15* distributed under the License is distributed on an "AS IS" BASIS, *
16* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17* See the License for the specific language governing permissions and *
18* limitations under the License. *
19* *
20*****************************************************************************/
21#ifndef _XN_USB_DEVICE_H_
22#define _XN_USB_DEVICE_H_
23
24//---------------------------------------------------------------------------
25// Includes
26//---------------------------------------------------------------------------
27#include "XnPlatform.h"
28#include "XnStatus.h"
29
30#if (XN_PLATFORM == XN_PLATFORM_WIN32)
31
32 #include <Win32/usb100.h>
33 typedef USB_ENDPOINT_DESCRIPTOR XnUSBEndpointDescriptor;
34 typedef USB_INTERFACE_DESCRIPTOR XnUSBInterfaceDescriptor;
35 typedef USB_CONFIGURATION_DESCRIPTOR XnUSBConfigDescriptor;
36 typedef USB_DEVICE_DESCRIPTOR XnUSBDeviceDescriptor;
37
38 #define USB_DT_CONFIG_SIZE 0
39 #define USB_DT_CONFIG 0
40 #define USB_CONFIG_ATT_ONE 0
41 #define USB_DT_ENDPOINT_SIZE 0
42 #define USB_DT_ENDPOINT 0
43 #define USB_ENDPOINT_XFER_BULK 0
44 #define USB_DT_INTERFACE_SIZE 0
45 #define USB_DT_INTERFACE 0
46 #define USB_CLASS_VENDOR_SPEC 0
47 #define USB_DT_DEVICE_SIZE 0
48 #define USB_DT_DEVICE 0
49
50#elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM)
51 #include <linux/usb/ch9.h>
52 typedef struct usb_endpoint_descriptor XnUSBEndpointDescriptor;
53 typedef struct usb_interface_descriptor XnUSBInterfaceDescriptor;
54 typedef struct usb_config_descriptor XnUSBConfigDescriptor;
55 typedef struct usb_device_descriptor XnUSBDeviceDescriptor;
56#else
57 #error "Unsupported Platform!"
58#endif
59
60//---------------------------------------------------------------------------
61// Structures & Enums
62//---------------------------------------------------------------------------
64{
69
71{
72 XnUInt8 nID;
73 const XnChar* strString;
75
77{
81
83{
87
89{
93 XnUInt8 nStrings;
95
96struct XnUSBDevice;
97typedef struct XnUSBDevice XnUSBDevice;
98
99typedef void (*XnUSBDeviceNewControlRequestCallback)(XnUSBDevice* pDevice, void* pCookie);
101
102//---------------------------------------------------------------------------
103// API
104//---------------------------------------------------------------------------
105XN_C_API XnStatus XN_C_DECL xnUSBDeviceInit(const XnUSBDeviceDescriptorHolder* pDeviceDescriptor, XnUInt32 nControlMessageMaxSize, XnUSBDevice** ppDevice);
106XN_C_API void XN_C_DECL xnUSBDeviceShutdown(XnUSBDevice* pDevice);
108
109//pnRequestSize is max size on input, actual size on output
110XN_C_API XnStatus XN_C_DECL xnUSBDeviceReceiveControlRequest(XnUSBDevice* pDevice, XnUChar* pBuffer, XnUInt32* pnRequestSize);
111XN_C_API XnStatus XN_C_DECL xnUSBDeviceSendControlReply(XnUSBDevice* pDevice, const XnUChar* pBuffer, XnUInt32 nReplySize);
114XN_C_API XnStatus XN_C_DECL xnUSBDeviceWriteEndpoint(XnUSBDevice* pDevice, XnUInt8 nAddress, const XnUChar* pData, XnUInt32 nDataSize);
115XN_C_API XnStatus XN_C_DECL xnUSBDeviceResetEndpoint(XnUSBDevice* pDevice, XnUInt8 nAddress);
116
117#endif
#define XN_C_API
Definition: XnPlatform.h:121
XnUInt32 XnStatus
Definition: XnStatus.h:33
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:36
XN_C_API void XN_C_DECL xnUSBDeviceShutdown(XnUSBDevice *pDevice)
XN_C_API XnStatus XN_C_DECL xnUSBDeviceSetNewControlRequestCallback(XnUSBDevice *pDevice, XnUSBDeviceNewControlRequestCallback pFunc, void *pCookie)
void(* XnUSBDeviceConnectivityChangedCallback)(XnUSBDevice *pDevice, XnUSBDeviceConnectionState state, void *pCookie)
Definition: XnUSBDevice.h:100
void(* XnUSBDeviceNewControlRequestCallback)(XnUSBDevice *pDevice, void *pCookie)
Definition: XnUSBDevice.h:99
XN_C_API XnStatus XN_C_DECL xnUSBDeviceInit(const XnUSBDeviceDescriptorHolder *pDeviceDescriptor, XnUInt32 nControlMessageMaxSize, XnUSBDevice **ppDevice)
struct XnUSBDevice XnUSBDevice
Definition: XnUSBDevice.h:97
XN_C_API XnStatus XN_C_DECL xnUSBDeviceResetEndpoint(XnUSBDevice *pDevice, XnUInt8 nAddress)
USB_ENDPOINT_DESCRIPTOR XnUSBEndpointDescriptor
Definition: XnUSBDevice.h:33
USB_CONFIGURATION_DESCRIPTOR XnUSBConfigDescriptor
Definition: XnUSBDevice.h:35
XnUSBDeviceConnectionState
Definition: XnUSBDevice.h:64
@ XN_USB_DEVICE_CONNECTED
Definition: XnUSBDevice.h:66
@ XN_USB_DEVICE_DISCONNECTED
Definition: XnUSBDevice.h:65
@ XN_USB_DEVICE_SUSPENDED
Definition: XnUSBDevice.h:67
XN_C_API XnStatus XN_C_DECL xnUSBDeviceSendControlReply(XnUSBDevice *pDevice, const XnUChar *pBuffer, XnUInt32 nReplySize)
USB_INTERFACE_DESCRIPTOR XnUSBInterfaceDescriptor
Definition: XnUSBDevice.h:34
XN_C_API XnStatus XN_C_DECL xnUSBDeviceSetConnectivityChangedCallback(XnUSBDevice *pDevice, XnUSBDeviceConnectivityChangedCallback pFunc, void *pCookie)
XN_C_API XnBool XN_C_DECL xnUSBDeviceIsControlRequestPending(XnUSBDevice *pDevice)
Definition: XnUSBDevice.h:83
XnUSBConfigDescriptor descriptor
Definition: XnUSBDevice.h:84
XnUSBInterfaceDescriptorHolder ** aInterfaces
Definition: XnUSBDevice.h:85
Definition: XnUSBDevice.h:89
XnUInt8 nStrings
Definition: XnUSBDevice.h:93
XnUSBStringDescriptor * aStrings
Definition: XnUSBDevice.h:92
XnUSBDeviceDescriptor descriptor
Definition: XnUSBDevice.h:90
XnUSBConfigDescriptorHolder ** aConfigurations
Definition: XnUSBDevice.h:91
Definition: XnUSBDevice.h:77
XnUSBInterfaceDescriptor descriptor
Definition: XnUSBDevice.h:78
XnUSBEndpointDescriptor ** aEndpoints
Definition: XnUSBDevice.h:79
Definition: XnUSBDevice.h:71
XnUInt8 nID
Definition: XnUSBDevice.h:72
const XnChar * strString
Definition: XnUSBDevice.h:73