Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _XN_USB_DEVICE_H_
00023 #define _XN_USB_DEVICE_H_
00024
00025
00026
00027
00028 #include "XnPlatform.h"
00029 #include "XnStatus.h"
00030
00031 #if (XN_PLATFORM == XN_PLATFORM_WIN32)
00032
00033 #include <Win32/usb100.h>
00034 typedef USB_ENDPOINT_DESCRIPTOR XnUSBEndpointDescriptor;
00035 typedef USB_INTERFACE_DESCRIPTOR XnUSBInterfaceDescriptor;
00036 typedef USB_CONFIGURATION_DESCRIPTOR XnUSBConfigDescriptor;
00037 typedef USB_DEVICE_DESCRIPTOR XnUSBDeviceDescriptor;
00038
00039 #define USB_DT_CONFIG_SIZE 0
00040 #define USB_DT_CONFIG 0
00041 #define USB_CONFIG_ATT_ONE 0
00042 #define USB_DT_ENDPOINT_SIZE 0
00043 #define USB_DT_ENDPOINT 0
00044 #define USB_ENDPOINT_XFER_BULK 0
00045 #define USB_DT_INTERFACE_SIZE 0
00046 #define USB_DT_INTERFACE 0
00047 #define USB_CLASS_VENDOR_SPEC 0
00048 #define USB_DT_DEVICE_SIZE 0
00049 #define USB_DT_DEVICE 0
00050
00051 #elif (XN_PLATFORM == XN_PLATFORM_LINUX_X86 || XN_PLATFORM == XN_PLATFORM_LINUX_ARM)
00052 #include <linux/usb/ch9.h>
00053 typedef struct usb_endpoint_descriptor XnUSBEndpointDescriptor;
00054 typedef struct usb_interface_descriptor XnUSBInterfaceDescriptor;
00055 typedef struct usb_config_descriptor XnUSBConfigDescriptor;
00056 typedef struct usb_device_descriptor XnUSBDeviceDescriptor;
00057 #else
00058 #error "Unsupported Platform!"
00059 #endif
00060
00061
00062
00063
00064 typedef struct XnUSBStringDescriptor
00065 {
00066 XnUInt8 nID;
00067 const XnChar* strString;
00068 } XnUSBStringDescriptor;
00069
00070 typedef struct XnUSBInterfaceDescriptorHolder
00071 {
00072 XnUSBInterfaceDescriptor descriptor;
00073 XnUSBEndpointDescriptor** aEndpoints;
00074 } XnUSBInterfaceDescriptorHolder;
00075
00076 typedef struct XnUSBConfigDescriptorHolder
00077 {
00078 XnUSBConfigDescriptor descriptor;
00079 XnUSBInterfaceDescriptorHolder** aInterfaces;
00080 } XnUSBConfigDescriptorHolder;
00081
00082 typedef struct XnUSBDeviceDescriptorHolder
00083 {
00084 XnUSBDeviceDescriptor descriptor;
00085 XnUSBConfigDescriptorHolder** aConfigurations;
00086 XnUSBStringDescriptor* aStrings;
00087 XnUInt8 nStrings;
00088 } XnUSBDeviceDescriptorHolder;
00089
00090 struct XnUSBDevice;
00091 typedef struct XnUSBDevice XnUSBDevice;
00092
00093 typedef void (*XnUSBDeviceNewControlRequestCallback)(XnUSBDevice* pDevice, void* pCookie);
00094
00095
00096
00097
00098 XN_C_API XnStatus XN_C_DECL xnUSBDeviceInit(const XnUSBDeviceDescriptorHolder* pDeviceDescriptor, XnUInt32 nControlMessageMaxSize, XnUSBDevice** ppDevice);
00099 XN_C_API void XN_C_DECL xnUSBDeviceShutdown(XnUSBDevice* pDevice);
00100 XN_C_API XnBool XN_C_DECL xnUSBDeviceIsControlRequestPending(XnUSBDevice* pDevice);
00101
00102
00103 XN_C_API XnStatus XN_C_DECL xnUSBDeviceReceiveControlRequest(XnUSBDevice* pDevice, XnUChar* pBuffer, XnUInt32* pnRequestSize);
00104 XN_C_API XnStatus XN_C_DECL xnUSBDeviceSendControlReply(XnUSBDevice* pDevice, const XnUChar* pBuffer, XnUInt32 nReplySize);
00105 XN_C_API XnStatus XN_C_DECL xnUSBDeviceSetNewControlRequestCallback(XnUSBDevice* pDevice, XnUSBDeviceNewControlRequestCallback pFunc, void* pCookie);
00106 XN_C_API XnStatus XN_C_DECL xnUSBDeviceWriteEndpoint(XnUSBDevice* pDevice, XnUInt8 nAddress, const XnUChar* pData, XnUInt32 nDataSize);
00107
00108 #endif