device-usbhost.h
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 #pragma once
5 
6 #include "../usb/usb-types.h"
7 #include "messenger-usbhost.h"
8 #include "../usb/usb-device.h"
9 #include "usbhost.h"
10 #include "../types.h"
11 
12 #include <string>
13 #include <regex>
14 #include <sstream>
15 #include <mutex>
16 #include <map>
17 #include <string>
18 
19 namespace librealsense
20 {
21  namespace platform
22  {
24  {
25  switch (sts)
26  {
27  case 0: return RS2_USB_STATUS_SUCCESS;
28  case EBADF:
29  case ENODEV: return RS2_USB_STATUS_NO_DEVICE;
30  case EOVERFLOW: return RS2_USB_STATUS_OVERFLOW;
31  case EPROTO: return RS2_USB_STATUS_PIPE;
32  case EINVAL: return RS2_USB_STATUS_INVALID_PARAM;
33  case ENOMEM: return RS2_USB_STATUS_NO_MEM;
34  case ETIMEDOUT: return RS2_USB_STATUS_TIMEOUT;
35  //TODO:MK
36  default: return RS2_USB_STATUS_OTHER;
37  }
38  }
39 
40  class usb_device_usbhost : public usb_device, public std::enable_shared_from_this<usb_device_usbhost>
41  {
42  public:
44  virtual ~usb_device_usbhost();
45 
46  virtual const usb_device_info get_info() const override { return _infos[0]; }
47  virtual const std::vector<rs_usb_interface> get_interfaces() const override { return _interfaces; }
48  virtual const rs_usb_interface get_interface(uint8_t interface_number) const override;
49  virtual const rs_usb_messenger open(uint8_t interface_number) override;
50  virtual const std::vector<usb_descriptor> get_descriptors() const override;
51 
54  const std::vector<usb_device_info> get_subdevices_info() const { return _infos; }
57 
58  private:
60  const usb_device_descriptor *_usb_device_descriptor;
61  std::vector<usb_device_info> _infos;
62  std::vector<rs_usb_interface> _interfaces;
63  std::vector<usb_descriptor> _descriptors;
64 
65  std::mutex _mutex;
66  std::shared_ptr<dispatcher> _dispatcher;
67  std::map<uint8_t,std::shared_ptr<dispatcher>> _dispatchers;
68 
69  void invoke();
70  };
71  }
72 }
std::vector< rs_usb_interface > _interfaces
std::shared_ptr< usb_request > rs_usb_request
Definition: usb-request.h:41
std::shared_ptr< usb_interface > rs_usb_interface
Definition: usb-interface.h:31
static usb_status usbhost_status_to_rs(int sts)
usb_status cancel_request(const rs_usb_request &request)
GLuint64 GLenum void * handle
Definition: glext.h:7785
const std::vector< usb_device_info > get_subdevices_info() const
std::map< uint8_t, std::shared_ptr< dispatcher > > _dispatchers
unsigned char uint8_t
Definition: stdint.h:78
enum librealsense::platform::_usb_status usb_status
std::vector< usb_device_info > _infos
virtual const rs_usb_interface get_interface(uint8_t interface_number) const override
virtual const usb_device_info get_info() const override
std::shared_ptr< dispatcher > _dispatcher
std::shared_ptr< usb_messenger > rs_usb_messenger
Definition: usb-messenger.h:26
std::vector< usb_descriptor > _descriptors
const usb_device_descriptor * _usb_device_descriptor
virtual const std::vector< usb_descriptor > get_descriptors() const override
virtual const std::vector< rs_usb_interface > get_interfaces() const override
int usb_device_get_fd(struct usb_device *device)
Definition: usbhost.c:415
usb_status submit_request(const rs_usb_request &request)
virtual const rs_usb_messenger open(uint8_t interface_number) override


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