usb_depth_sensor.h
Go to the documentation of this file.
1 /*
2  * BSD 3-Clause License
3  *
4  * Copyright (c) 2019, Analog Devices, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 #ifndef USB_DEPTH_SENSOR_H
33 #define USB_DEPTH_SENSOR_H
34 
36 
37 #include <memory>
38 namespace aditof {
39 //TODO this is temporary and should be removed imediately after these details are read from the hardware
40 static const unsigned int USB_FRAME_WIDTH = 640;
41 static const unsigned int USB_FRAME_HEIGHT = 480;
42 } // namespace aditof
43 
45  public:
46  UsbDepthSensor(const std::string &name, const std::string &driverPath);
48 
49  public: // implements DepthSensorInterface
50  virtual aditof::Status open() override;
51  virtual aditof::Status start() override;
52  virtual aditof::Status stop() override;
53  virtual aditof::Status
54  getAvailableModes(std::vector<uint8_t> &modes) override;
55  virtual aditof::Status
56  getModeDetails(const uint8_t &mode,
57  aditof::DepthSensorModeDetails &details) override;
58  virtual aditof::Status
60  virtual aditof::Status setMode(const uint8_t &mode) override;
61  virtual aditof::Status getFrame(uint16_t *buffer) override;
62  virtual aditof::Status
63  getAvailableControls(std::vector<std::string> &controls) const override;
64  virtual aditof::Status setControl(const std::string &control,
65  const std::string &value) override;
66  virtual aditof::Status getControl(const std::string &control,
67  std::string &value) const override;
68  virtual aditof::Status
69  getDetails(aditof::SensorDetails &details) const override;
70  virtual aditof::Status getHandle(void **handle) override;
71  virtual aditof::Status getName(std::string &name) const override;
72  virtual aditof::Status
73  setHostConnectionType(std::string &connectionType) override;
74 
75  virtual aditof::Status adsd3500_read_cmd(uint16_t cmd, uint16_t *data,
76  unsigned int usDelay = 0) override;
77  virtual aditof::Status
78  adsd3500_write_cmd(uint16_t cmd, uint16_t data,
79  unsigned int usDelay = 0) override;
80  virtual aditof::Status
81  adsd3500_read_payload_cmd(uint32_t cmd, uint8_t *readback_data,
82  uint16_t payload_len) override;
83  virtual aditof::Status adsd3500_read_payload(uint8_t *payload,
84  uint16_t payload_len) override;
85  virtual aditof::Status
86  adsd3500_write_payload_cmd(uint32_t cmd, uint8_t *payload,
87  uint16_t payload_len) override;
88  virtual aditof::Status
89  adsd3500_write_payload(uint8_t *payload, uint16_t payload_len) override;
90  virtual aditof::Status adsd3500_reset() override;
92  aditof::SensorInterruptCallback &cb) override;
94  aditof::SensorInterruptCallback &cb) override;
95  virtual aditof::Status adsd3500_get_status(int &chipStatus,
96  int &imagerStatus) override;
97  virtual aditof::Status
98  initTargetDepthCompute(uint8_t *iniFile, uint16_t iniFileLength,
99  uint8_t *calData, uint16_t calDataLength) override;
100  virtual aditof::Status
101  getDepthComputeParams(std::map<std::string, std::string> &params) override;
103  const std::map<std::string, std::string> &params) override;
104  virtual aditof::Status
105  setSensorConfiguration(const std::string &sensorConf) override;
107  std::string &iniStr) override;
108 
109  private:
110  struct ImplData;
114  std::unique_ptr<ImplData> m_implData;
115  std::vector<aditof::DepthSensorModeDetails> m_depthSensorModes;
116  int m_fps;
117 };
118 
119 #endif // USB_DEPTH_SENSOR_H
name
GLuint const GLchar * name
Definition: glcorearb.h:3055
UsbDepthSensor::adsd3500_read_payload
virtual aditof::Status adsd3500_read_payload(uint8_t *payload, uint16_t payload_len) override
Reads a chunk of data from adsd3500. This will perform a burst read making it useful for reading chun...
Definition: usb_depth_sensor_linux.cpp:817
UsbDepthSensor::adsd3500_unregister_interrupt_callback
virtual aditof::Status adsd3500_unregister_interrupt_callback(aditof::SensorInterruptCallback &cb) override
Unregister a function registered with adsd3500_register_interrupt_callback.
Definition: usb_depth_sensor_linux.cpp:1003
UsbDepthSensor::m_fps
int m_fps
Definition: usb_depth_sensor.h:116
aditof::SensorDetails
Provides details about the device.
Definition: sensor_definitions.h:50
mode
GLenum mode
Definition: glcorearb.h:2764
UsbDepthSensor::getName
virtual aditof::Status getName(std::string &name) const override
Get the name of the sensor.
Definition: usb_depth_sensor_linux.cpp:663
UsbDepthSensor::adsd3500_write_payload
virtual aditof::Status adsd3500_write_payload(uint8_t *payload, uint16_t payload_len) override
Send a chunk of data (payload) to adsd3500. This will perform a burst write making it useful for writ...
Definition: usb_depth_sensor_linux.cpp:911
UsbDepthSensor::adsd3500_get_status
virtual aditof::Status adsd3500_get_status(int &chipStatus, int &imagerStatus) override
Returns the chip status.
Definition: usb_depth_sensor_linux.cpp:1010
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
UsbDepthSensor::setMode
virtual aditof::Status setMode(const aditof::DepthSensorModeDetails &type) override
Set the sensor frame mode to the given type.
Definition: usb_depth_sensor_linux.cpp:269
UsbDepthSensor::adsd3500_reset
virtual aditof::Status adsd3500_reset() override
Reset adsd3500 chip.
Definition: usb_depth_sensor_linux.cpp:955
UsbDepthSensor::initTargetDepthCompute
virtual aditof::Status initTargetDepthCompute(uint8_t *iniFile, uint16_t iniFileLength, uint8_t *calData, uint16_t calDataLength) override
Get the name of the sensor.
Definition: usb_depth_sensor_linux.cpp:1017
UsbDepthSensor::getFrame
virtual aditof::Status getFrame(uint16_t *buffer) override
Request a frame from the sensor.
Definition: usb_depth_sensor_linux.cpp:422
UsbDepthSensor
Definition: usb_depth_sensor.h:44
UsbDepthSensor::open
virtual aditof::Status open() override
Open the communication channels with the hardware.
Definition: usb_depth_sensor_linux.cpp:115
UsbDepthSensor::getDetails
virtual aditof::Status getDetails(aditof::SensorDetails &details) const override
Get a structure that contains information about the instance of the sensor.
Definition: usb_depth_sensor_linux.cpp:647
aditof
Namespace aditof.
Definition: adsd_errs.h:40
UsbDepthSensor::adsd3500_write_cmd
virtual aditof::Status adsd3500_write_cmd(uint16_t cmd, uint16_t data, unsigned int usDelay=0) override
Send a write command to adsd3500.
Definition: usb_depth_sensor_linux.cpp:721
UsbDepthSensor::getControl
virtual aditof::Status getControl(const std::string &control, std::string &value) const override
Gets the value of a specific sensor control.
Definition: usb_depth_sensor_linux.cpp:600
UsbDepthSensor::getAvailableControls
virtual aditof::Status getAvailableControls(std::vector< std::string > &controls) const override
Gets the sensors's list of controls.
Definition: usb_depth_sensor_linux.cpp:503
UsbDepthSensor::m_implData
std::unique_ptr< ImplData > m_implData
Definition: usb_depth_sensor.h:114
UsbDepthSensor::getAvailableModes
virtual aditof::Status getAvailableModes(std::vector< uint8_t > &modes) override
Return all modes that are supported by the sensor.
Definition: usb_depth_sensor_linux.cpp:241
aditof::USB_FRAME_WIDTH
static const unsigned int USB_FRAME_WIDTH
Definition: usb_depth_sensor.h:40
UsbDepthSensor::adsd3500_read_cmd
virtual aditof::Status adsd3500_read_cmd(uint16_t cmd, uint16_t *data, unsigned int usDelay=0) override
Send a read command to adsd3500.
Definition: usb_depth_sensor_linux.cpp:674
UsbDepthSensor::adsd3500_register_interrupt_callback
virtual aditof::Status adsd3500_register_interrupt_callback(aditof::SensorInterruptCallback &cb) override
Register a function to be called when a ADSD3500 interrupt occurs.
Definition: usb_depth_sensor_linux.cpp:996
params
GLenum const GLfloat * params
Definition: glcorearb.h:2770
UsbDepthSensor::start
virtual aditof::Status start() override
Start the streaming of data from the sensor.
Definition: usb_depth_sensor_linux.cpp:183
UsbDepthSensor::~UsbDepthSensor
~UsbDepthSensor()
Definition: usb_depth_sensor_linux.cpp:86
UsbDepthSensor::m_depthSensorModes
std::vector< aditof::DepthSensorModeDetails > m_depthSensorModes
Definition: usb_depth_sensor.h:115
buffer
Definition: buffer_processor.h:43
UsbDepthSensor::getIniParamsArrayForMode
aditof::Status getIniParamsArrayForMode(int mode, std::string &iniStr) override
Get ini parameters for Depth Compute library as string.
Definition: usb_depth_sensor_linux.cpp:1044
UsbDepthSensor::m_driverPath
std::string m_driverPath
Definition: usb_depth_sensor.h:113
UsbDepthSensor::adsd3500_write_payload_cmd
virtual aditof::Status adsd3500_write_payload_cmd(uint32_t cmd, uint8_t *payload, uint16_t payload_len) override
Send a write command to adsd3500. This will perform a burst write making it useful for writing chunks...
Definition: usb_depth_sensor_linux.cpp:863
aditof::Status
Status
Status of any operation that the TOF sdk performs.
Definition: status_definitions.h:48
aditof::DepthSensorInterface
Provides access to the low level functionality of the camera sensor. This includes sensor configurati...
Definition: depth_sensor_interface.h:57
UsbDepthSensor::setHostConnectionType
virtual aditof::Status setHostConnectionType(std::string &connectionType) override
Set the host connection type for target sdk.
Definition: usb_depth_sensor_linux.cpp:669
type
GLenum type
Definition: glcorearb.h:2695
UsbDepthSensor::getHandle
virtual aditof::Status getHandle(void **handle) override
Gets a handle to be used by other devices such as Storage, Temperature, etc. This handle will allow t...
Definition: usb_depth_sensor_linux.cpp:652
UsbDepthSensor::setDepthComputeParams
virtual aditof::Status setDepthComputeParams(const std::map< std::string, std::string > &params) override
Set ini parameters for Depth Compute library.
Definition: usb_depth_sensor_linux.cpp:1031
aditof::USB_FRAME_HEIGHT
static const unsigned int USB_FRAME_HEIGHT
Definition: usb_depth_sensor.h:41
UsbDepthSensor::setSensorConfiguration
virtual aditof::Status setSensorConfiguration(const std::string &sensorConf) override
Set sensor configutation table.
Definition: usb_depth_sensor_linux.cpp:1039
aditof::DepthSensorModeDetails
Describes the type of entire frame that a depth sensor can capture and transmit.
Definition: sensor_definitions.h:120
UsbDepthSensor::stop
virtual aditof::Status stop() override
Stop the sensor data stream.
Definition: usb_depth_sensor_linux.cpp:219
UsbDepthSensor::m_sensorName
std::string m_sensorName
Definition: usb_depth_sensor.h:110
UsbDepthSensor::getModeDetails
virtual aditof::Status getModeDetails(const uint8_t &mode, aditof::DepthSensorModeDetails &details) override
Returns details of specified mode.
Definition: usb_depth_sensor_linux.cpp:251
UsbDepthSensor::adsd3500_read_payload_cmd
virtual aditof::Status adsd3500_read_payload_cmd(uint32_t cmd, uint8_t *readback_data, uint16_t payload_len) override
Send a read command to adsd3500. This will perform a burst read making it useful for reading chunks o...
Definition: usb_depth_sensor_linux.cpp:765
UsbDepthSensor::getDepthComputeParams
virtual aditof::Status getDepthComputeParams(std::map< std::string, std::string > &params) override
Get ini parameters for Depth Compute library.
Definition: usb_depth_sensor_linux.cpp:1024
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: glcorearb.h:2879
UsbDepthSensor::ImplData
Definition: usb_depth_sensor_linux.cpp:64
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
UsbDepthSensor::UsbDepthSensor
UsbDepthSensor(const std::string &name, const std::string &driverPath)
Definition: usb_depth_sensor_linux.cpp:74
UsbDepthSensor::m_sensorDetails
aditof::SensorDetails m_sensorDetails
Definition: usb_depth_sensor.h:112
UsbDepthSensor::setControl
virtual aditof::Status setControl(const std::string &control, const std::string &value) override
Sets a specific sensor control.
Definition: usb_depth_sensor_linux.cpp:550
depth_sensor_interface.h
aditof::SensorInterruptCallback
std::function< void(Adsd3500Status)> SensorInterruptCallback
Callback for sensor interrupts.
Definition: depth_sensor_interface.h:50


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:01