Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DpGet does not clear out the DpContainer that's passed in #520

Closed
bocchino opened this issue Oct 10, 2024 · 0 comments · Fixed by #521
Closed

DpGet does not clear out the DpContainer that's passed in #520

bocchino opened this issue Oct 10, 2024 · 0 comments · Fixed by #521
Assignees
Labels
bug Something isn't working code generation Issues related to code generation

Comments

@bocchino
Copy link
Collaborator

The DpGet interface requires the user to pass in a reference to a DpContainer. Currently, if that DpContainer has been used in a previous DpGet call, then some of the state from the previous call will remain in the container after the second DpGet call. That shouldn't happen. To support the reuse of DpContainer objects across different calls, this code should fully clear out the DpContainer:

const FwDpIdType baseId = this->getIdBase();
const FwDpIdType globalId = baseId + containerId;
const FwSizeType size = DpContainer::getPacketSizeForDataSize(dataSize);
Fw::Buffer buffer;
const Fw::Success::T status = this->productGetOut_out(0, globalId, size, buffer);
if (status == Fw::Success::SUCCESS) {
container.setId(globalId);
container.setBuffer(buffer);
container.setBaseId(baseId);
container.setPriority(priority);
}
return status;

This issue is related to nasa/fprime#2938.

@bocchino bocchino added bug Something isn't working code generation Issues related to code generation labels Oct 10, 2024
@bocchino bocchino self-assigned this Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code generation Issues related to code generation
Projects
Development

Successfully merging a pull request may close this issue.

1 participant