Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
usbhost
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
{
23
static
usb_status
usbhost_status_to_rs
(
int
sts)
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
:
43
usb_device_usbhost
(::
usb_device
*
handle
);
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
52
::usb_device
*
get_handle
() {
return
_handle
; }
53
int
get_file_descriptor
() {
return
usb_device_get_fd
(
_handle
); }
54
const
std::vector<usb_device_info>
get_subdevices_info
()
const
{
return
_infos
; }
55
usb_status
submit_request
(
const
rs_usb_request
& request);
56
usb_status
cancel_request
(
const
rs_usb_request
& request);
57
58
private
:
59
::usb_device
*
_handle
;
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
}
librealsense::platform::RS2_USB_STATUS_NO_DEVICE
Definition:
usb-types.h:53
librealsense::platform::usb_device_info
Definition:
usb-types.h:136
librealsense::platform::usb_device_usbhost::_interfaces
std::vector< rs_usb_interface > _interfaces
Definition:
device-usbhost.h:62
librealsense::platform::rs_usb_request
std::shared_ptr< usb_request > rs_usb_request
Definition:
usb-request.h:41
librealsense::platform::rs_usb_interface
std::shared_ptr< usb_interface > rs_usb_interface
Definition:
usb-interface.h:31
librealsense::platform::usbhost_status_to_rs
static usb_status usbhost_status_to_rs(int sts)
Definition:
device-usbhost.h:23
librealsense::platform::usb_device_usbhost::cancel_request
usb_status cancel_request(const rs_usb_request &request)
handle
GLuint64 GLenum void * handle
Definition:
glext.h:7785
librealsense::platform::usb_device_usbhost::get_subdevices_info
const std::vector< usb_device_info > get_subdevices_info() const
Definition:
device-usbhost.h:54
librealsense::platform::usb_device_usbhost::~usb_device_usbhost
virtual ~usb_device_usbhost()
librealsense::platform::usb_device_usbhost::_dispatchers
std::map< uint8_t, std::shared_ptr< dispatcher > > _dispatchers
Definition:
device-usbhost.h:67
uint8_t
unsigned char uint8_t
Definition:
stdint.h:78
librealsense::platform::usb_device_usbhost::usb_device_usbhost
usb_device_usbhost(::usb_device *handle)
librealsense::platform::usb_device_usbhost::_mutex
std::mutex _mutex
Definition:
device-usbhost.h:65
librealsense::platform::usb_status
enum librealsense::platform::_usb_status usb_status
librealsense::platform::usb_device_usbhost::_infos
std::vector< usb_device_info > _infos
Definition:
device-usbhost.h:61
librealsense::platform::usb_device_usbhost::get_interface
virtual const rs_usb_interface get_interface(uint8_t interface_number) const override
librealsense::platform::RS2_USB_STATUS_OVERFLOW
Definition:
usb-types.h:57
librealsense
Definition:
calibration-model.h:6
librealsense::platform::usb_device_usbhost::get_info
virtual const usb_device_info get_info() const override
Definition:
device-usbhost.h:46
librealsense::platform::usb_device_usbhost
Definition:
device-usbhost.h:40
usbhost.h
librealsense::platform::RS2_USB_STATUS_PIPE
Definition:
usb-types.h:58
librealsense::platform::usb_device_usbhost::get_file_descriptor
int get_file_descriptor()
Definition:
device-usbhost.h:53
librealsense::platform::RS2_USB_STATUS_SUCCESS
Definition:
usb-types.h:49
librealsense::platform::usb_device_usbhost::_dispatcher
std::shared_ptr< dispatcher > _dispatcher
Definition:
device-usbhost.h:66
librealsense::platform::rs_usb_messenger
std::shared_ptr< usb_messenger > rs_usb_messenger
Definition:
usb-messenger.h:26
librealsense::platform::RS2_USB_STATUS_TIMEOUT
Definition:
usb-types.h:56
messenger-usbhost.h
librealsense::platform::usb_device_usbhost::_descriptors
std::vector< usb_descriptor > _descriptors
Definition:
device-usbhost.h:63
librealsense::platform::usb_device_usbhost::_usb_device_descriptor
const usb_device_descriptor * _usb_device_descriptor
Definition:
device-usbhost.h:60
librealsense::platform::usb_device_usbhost::get_handle
::usb_device * get_handle()
Definition:
device-usbhost.h:52
librealsense::platform::usb_device_usbhost::get_descriptors
virtual const std::vector< usb_descriptor > get_descriptors() const override
librealsense::platform::usb_device
Definition:
usb-device.h:17
librealsense::platform::usb_device_usbhost::get_interfaces
virtual const std::vector< rs_usb_interface > get_interfaces() const override
Definition:
device-usbhost.h:47
librealsense::platform::usb_device_usbhost::_handle
::usb_device * _handle
Definition:
device-usbhost.h:59
librealsense::platform::usb_device_usbhost::invoke
void invoke()
librealsense::platform::RS2_USB_STATUS_NO_MEM
Definition:
usb-types.h:60
usb_device_get_fd
int usb_device_get_fd(struct usb_device *device)
Definition:
usbhost.c:415
librealsense::platform::RS2_USB_STATUS_INVALID_PARAM
Definition:
usb-types.h:51
librealsense::platform::usb_device_usbhost::submit_request
usb_status submit_request(const rs_usb_request &request)
librealsense::platform::usb_device_usbhost::open
virtual const rs_usb_messenger open(uint8_t interface_number) override
librealsense::platform::RS2_USB_STATUS_OTHER
Definition:
usb-types.h:62
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:47:12