interface-usbhost.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #ifdef RS2_USE_ANDROID_BACKEND
5 
6 #include <cstdint>
7 #include <vector>
8 #include "interface-usbhost.h"
9 #include "messenger-usbhost.h"
10 
11 #include "../types.h"
12 #include "usbhost.h"
13 
14 namespace librealsense
15 {
16  namespace platform
17  {
18  usb_interface_usbhost::usb_interface_usbhost(::usb_interface_descriptor desc, ::usb_descriptor_iter it) :
19  _desc(desc)
20  {
21  for (int e = 0; e < desc.bNumEndpoints;) {
22  usb_descriptor_header *h = usb_descriptor_iter_next(&it);
23  if(h == NULL)
24  break;
25  if (h->bDescriptorType == (USB_DT_ENDPOINT & ~USB_TYPE_MASK)) {
26  e++;
27  auto epd = *((usb_endpoint_descriptor *) h);
28  auto ep = std::make_shared<usb_endpoint_usbhost>(epd, desc.bInterfaceNumber);
29  _endpoints.push_back(ep);
30  }
31  }
32  }
33 
35  {
36 
37  }
38 
40  {
41  for (auto&& ep : _endpoints)
42  {
43  if (ep->get_type() != type)
44  continue;
45  if (ep->get_direction() != direction)
46  continue;
47  return ep;
48  }
49  return nullptr;
50  }
51 
53  {
54  if(interface)
55  _associated_interfaces.push_back(interface);
56  }
57  }
58 }
59 
60 #endif
std::vector< rs_usb_interface > _associated_interfaces
#define USB_DT_ENDPOINT
Definition: usb-types.h:16
std::shared_ptr< usb_interface > rs_usb_interface
Definition: usb-interface.h:31
std::vector< std::shared_ptr< usb_endpoint > > _endpoints
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:1960
e
Definition: rmse.py:177
direction
Definition: rs-align.cpp:25
usb_interface_usbhost(::usb_interface_descriptor desc,::usb_descriptor_iter it)
enum librealsense::platform::_endpoint_direction endpoint_direction
virtual const rs_usb_endpoint first_endpoint(const endpoint_direction direction, const endpoint_type type=RS2_USB_ENDPOINT_BULK) const override
std::shared_ptr< usb_endpoint > rs_usb_endpoint
Definition: usb-endpoint.h:24
static auto it
GLenum type
struct usb_descriptor_header * usb_descriptor_iter_next(struct usb_descriptor_iter *iter)
Definition: usbhost.c:594
#define NULL
Definition: tinycthread.c:47
enum librealsense::platform::_endpoint_type endpoint_type
void add_associated_interface(const rs_usb_interface &interface)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:17