From bc279996358906960dd87d8845b62390b8aebe57 Mon Sep 17 00:00:00 2001 From: Dan Nechita Date: Thu, 28 Sep 2023 12:56:59 +0300 Subject: [PATCH] sdk: Expose the size of a frame (generated by depth compute) via control Signed-off-by: Dan Nechita --- sdk/src/connections/target/adsd3500_sensor.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sdk/src/connections/target/adsd3500_sensor.cpp b/sdk/src/connections/target/adsd3500_sensor.cpp index 90c3b8b0e..54635f145 100644 --- a/sdk/src/connections/target/adsd3500_sensor.cpp +++ b/sdk/src/connections/target/adsd3500_sensor.cpp @@ -151,6 +151,7 @@ Adsd3500Sensor::Adsd3500Sensor(const std::string &driverPath, m_controls.emplace("imagerType", ""); m_controls.emplace("inputFormat", ""); m_controls.emplace("partialDepthEnable", ""); + m_controls.emplace("processedFrameSize", ""); // Define the commands that correspond to the sensor controls m_implData->controlsCommands["abAveraging"] = 0x9819e5; @@ -703,6 +704,15 @@ Adsd3500Sensor::setFrameType(const aditof::DepthSensorFrameType &type) { } } + size_t processedFrameSize = 0; + status = ModeInfo::getInstance()->getProcessedFramesProperties( + type.type, nullptr, nullptr, &processedFrameSize); + if (status == Status::OK) { + setControl("processedFrameSize", std::to_string(processedFrameSize)); + } else { + LOG(ERROR) << "Failed to get the properties of a processed Frame"; + } + return status; } @@ -883,6 +893,9 @@ aditof::Status Adsd3500Sensor::setControl(const std::string &control, value); return Status::OK; } + if (control == "processedFrameSize") { + return Status::OK; + } // Send the command that sets the control value struct v4l2_control ctrl; @@ -915,6 +928,11 @@ aditof::Status Adsd3500Sensor::getControl(const std::string &control, return Status::OK; } + if (control == "processedFrameSize") { + value = m_controls.at("processedFrameSize"); + return Status::OK; + } + // Send the command that reads the control value struct v4l2_control ctrl; memset(&ctrl, 0, sizeof(ctrl));