messenger-winusb.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 "usb/usb-messenger.h"
8 #include "backend.h"
9 #include "win/win-helpers.h"
10 #include "handle-winusb.h"
11 #include "interface-winusb.h"
12 #include "request-winusb.h"
13 
14 #include <winusb.h>
15 #include <SetupAPI.h>
16 
17 namespace librealsense
18 {
19  namespace platform
20  {
21  class usb_device_winusb;
22 
24  {
25  public:
26  usb_messenger_winusb(const std::shared_ptr<usb_device_winusb> device, std::shared_ptr<handle_winusb> handle);
27  virtual ~usb_messenger_winusb();
28 
29  virtual usb_status control_transfer(int request_type, int request, int value, int index, uint8_t* buffer, uint32_t length, uint32_t& transferred, uint32_t timeout_ms) override;
30  virtual usb_status bulk_transfer(const rs_usb_endpoint& endpoint, uint8_t* buffer, uint32_t length, uint32_t& transferred, uint32_t timeout_ms) override;
31  virtual usb_status reset_endpoint(const rs_usb_endpoint& endpoint, uint32_t timeout_ms) override;
32  virtual usb_status submit_request(const rs_usb_request& request) override;
33  virtual usb_status cancel_request(const rs_usb_request& request) override;
34  virtual rs_usb_request create_request(rs_usb_endpoint endpoint) override;
35 
36  private:
37  std::shared_ptr<dispatcher> get_dispatcher(uint8_t endpoint);
38  usb_status set_timeout_policy(WINUSB_INTERFACE_HANDLE handle, uint8_t endpoint, uint32_t timeout_ms);
39 
40  unsigned long _in_out_pipe_timeout_ms = 7000;
41 
42  std::mutex _mutex;
43  std::shared_ptr<handle_winusb> _handle;
44  std::shared_ptr<usb_device_winusb> _device;
45  std::map<uint8_t,std::shared_ptr<dispatcher>> _dispatchers;
46  };
47  }
48 }
virtual usb_status reset_endpoint(const rs_usb_endpoint &endpoint, uint32_t timeout_ms) override
std::shared_ptr< usb_request > rs_usb_request
Definition: usb-request.h:41
GLuint64 GLenum void * handle
Definition: glext.h:7785
GLfloat value
unsigned char uint8_t
Definition: stdint.h:78
enum librealsense::platform::_usb_status usb_status
GLuint index
std::shared_ptr< dispatcher > get_dispatcher(uint8_t endpoint)
virtual rs_usb_request create_request(rs_usb_endpoint endpoint) override
unsigned int uint32_t
Definition: stdint.h:80
usb_messenger_winusb(const std::shared_ptr< usb_device_winusb > device, std::shared_ptr< handle_winusb > handle)
std::shared_ptr< usb_endpoint > rs_usb_endpoint
Definition: usb-endpoint.h:24
virtual usb_status control_transfer(int request_type, int request, int value, int index, uint8_t *buffer, uint32_t length, uint32_t &transferred, uint32_t timeout_ms) override
usb_status set_timeout_policy(WINUSB_INTERFACE_HANDLE handle, uint8_t endpoint, uint32_t timeout_ms)
std::shared_ptr< usb_device_winusb > _device
virtual usb_status bulk_transfer(const rs_usb_endpoint &endpoint, uint8_t *buffer, uint32_t length, uint32_t &transferred, uint32_t timeout_ms) override
virtual usb_status cancel_request(const rs_usb_request &request) override
virtual usb_status submit_request(const rs_usb_request &request) override
std::shared_ptr< handle_winusb > _handle
GLenum GLuint GLenum GLsizei length
std::map< uint8_t, std::shared_ptr< dispatcher > > _dispatchers


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