Skip to content

Commit

Permalink
sdk: Expose the size of a frame (generated by depth compute) via control
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Nechita <[email protected]>
  • Loading branch information
dNechita committed Sep 28, 2023
1 parent 81b614a commit 1f7152e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sdk/src/connections/target/adsd3500_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 1f7152e

Please sign in to comment.