usb_utils.cpp
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 
34 #include "usb_buffer.pb.h"
35 #include "utils.h"
36 
37 using namespace std;
38 using namespace aditof;
39 
41  std::vector<aditof::DepthSensorModeDetails> &depthSensorModeDetails,
42  const usb_payload::DepthSensorModeDetailsVector &protoMsg) {
43 
44  // TO DO: Change based on the refactoring
45  // using namespace google::protobuf::io;
46 
47  // depthSensorModeDetails.clear();
48 
49  // for (const auto &frameTypeMsg : protoMsg.depthsensorframetypes()) {
50  // aditof::DepthSensorModeDetails depthSensorModeDetails;
51 
52  // depthSensorModeDetails.type = frameTypeMsg.type();
53  // depthSensorModeDetails.width = frameTypeMsg.width();
54  // depthSensorModeDetails.height = frameTypeMsg.height();
55 
56  // for (const auto &frameContentMsg :
57  // frameTypeMsg.depthsensorframecontent()) {
58  // DepthSensorFrameContent depthSensorFrameContent;
59 
60  // depthSensorFrameContent.width = frameContentMsg.width();
61  // depthSensorFrameContent.height = frameContentMsg.height();
62  // depthSensorFrameContent.type = frameContentMsg.type();
63  // depthSensorModeDetails.content.push_back(depthSensorFrameContent);
64  // }
65 
66  // depthSensorModeDetails.push_back(depthSensorModeDetails);
67  // }
68 }
69 
71  const aditof::DepthSensorModeDetails &depthSensorModeDetails,
72  usb_payload::DepthSensorModeDetails *protoMsg) {
73 
74  // TO DO: Change based on the refactoring
75  // protoMsg->set_type(depthSensorModeDetails.type);
76  // protoMsg->set_width(depthSensorModeDetails.width);
77  // protoMsg->set_height(depthSensorModeDetails.height);
78 
79  // for (const auto &depthSensorFrameContent : depthSensorModeDetails.content) {
80 
81  // auto depthSensorFrameContentMsg =
82  // protoMsg->add_depthsensorframecontent();
83  // depthSensorFrameContentMsg->set_type(depthSensorFrameContent.type);
84  // depthSensorFrameContentMsg->set_width(depthSensorFrameContent.width);
85  // depthSensorFrameContentMsg->set_height(depthSensorFrameContent.height);
86  // }
87 }
UsbUtils::depthSensorModeDetailsToProtoMsg
static void depthSensorModeDetailsToProtoMsg(const aditof::DepthSensorModeDetails &depthSensorModeDetails, usb_payload::DepthSensorModeDetails *protoMsg)
Converts a DepthSensorModeDetails to a protobuf message.
Definition: usb_utils.cpp:70
aditof
Namespace aditof.
Definition: adsd_errs.h:40
UsbUtils::protoMsgToDepthSensorModeDetails
static void protoMsgToDepthSensorModeDetails(std::vector< aditof::DepthSensorModeDetails > &depthSensorModeDetailsVector, const usb_payload::DepthSensorModeDetailsVector &protoMsg)
Converts from protobuf message to aditof type (vector of DepthSensorModeDetails)
Definition: usb_utils.cpp:40
aditof::DepthSensorModeDetails
Describes the type of entire frame that a depth sensor can capture and transmit.
Definition: sensor_definitions.h:120
std
usb_utils.h


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