Skip to content

question about passing driver data with Q_NEW api #49

Open
@andy27182

Description

@andy27182

When my software needs to access the data of the same peripheral in multiple QActives, is it the best practice in the qp framework to use Q_NEW to pass these data?
The data of a certain peripheral may be dozens of bytes in size. When there are multiple peripherals, it is necessary to derive many event objects of different lengths from QEvt. After obtaining the data, allocate memory through Q_NEW and send it to the receiving object via the post interface. Then, inside the receiving object, these data are copied again. This process will generate multiple buffering processes.
If dont use the Q_NEW API, I use global variables, Its simple but then I will be back to the situation where I need to manually protect resource.
Could you please answer my question or provide a suitable example?

Activity

quantum-leaps

quantum-leaps commented on Mar 5, 2025

@quantum-leaps
Contributor

Hi Andy,
Could you please repost your question to the Free QP/QM Support Forum? I want to answer your question, but such that this discussion will be available to the broader QP community. If I answer here, hardly anybody except you will see it. I hope this comment makes sense to you.
--MMS

andy27182

andy27182 commented on Mar 6, 2025

@andy27182
Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      question about passing driver data with Q_NEW api · Issue #49 · QuantumLeaps/qpc