request-winusb.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "../usb/usb-request.h"
7 #include "../usb/usb-device.h"
8 
9 #include <Windows.h>
10 
11 #include <winusb.h>
12 
13 namespace librealsense
14 {
15  namespace platform
16  {
18  {
19  public:
20  safe_handle(HANDLE handle) :_handle(handle)
21  {
22 
23  }
24 
26  {
27  if (_handle != nullptr)
28  {
29  CloseHandle(_handle);
30  _handle = nullptr;
31  }
32  }
33 
34  HANDLE GetHandle() const { return _handle; }
35  private:
36  safe_handle() = delete;
37 
38  // Disallow copy:
39  safe_handle(const safe_handle&) = delete;
40  safe_handle& operator=(const safe_handle&) = delete;
41 
42  HANDLE _handle;
43  };
44 
46  {
47  public:
49  virtual ~usb_request_winusb();
50 
51  virtual int get_actual_length() const override;
52  virtual void* get_native_request() const override;
53 
54  protected:
55  virtual void set_native_buffer_length(int length) override;
56  virtual int get_native_buffer_length() override;
57  virtual void set_native_buffer(uint8_t* buffer) override;
58  virtual uint8_t* get_native_buffer() const override;
59 
60  private:
61  std::shared_ptr<OVERLAPPED> _overlapped; //https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-overlapped
62  std::shared_ptr<safe_handle> _safe_handle;
63  };
64  }
65 }
std::shared_ptr< OVERLAPPED > _overlapped
GLuint64 GLenum void * handle
Definition: glext.h:7785
safe_handle & operator=(const safe_handle &)=delete
unsigned char uint8_t
Definition: stdint.h:78
std::shared_ptr< usb_endpoint > rs_usb_endpoint
Definition: usb-endpoint.h:24
std::shared_ptr< safe_handle > _safe_handle
GLenum GLuint GLenum GLsizei length
std::shared_ptr< usb_device > rs_usb_device
Definition: usb-device.h:29


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