2020-11-29 06:41 PM
Often I call the C function from the hardware in Model::tick() function.
But how can I call the function of Model outside.
If I add a member variable to get the Instance(this) of Model, is there any risk? I mean if Model writed by Singleton mode.
Solved! Go to Solution.
2020-11-30 03:37 AM
What exactly do you want to accomplish? There might be another way. It could be that you simply want to have a task running and send a message through a queue to the Model which will then handle it in its ::tick() function.
2020-11-30 01:38 AM
What is it exactly you want to do?
You probably either want to 1) Call a C++ function from C code 2) Have the Model react to something
/Martin
2020-11-30 03:23 AM
1) Call a C++ function from C code
And now, I write a static pointer of Model and make it = this. To make it work. I am afraid it is not safe.:grinning_face_with_sweat:
2020-11-30 03:37 AM
What exactly do you want to accomplish? There might be another way. It could be that you simply want to have a task running and send a message through a queue to the Model which will then handle it in its ::tick() function.
2020-11-30 06:06 PM
Yes, you are right, but sometimes I want to trigger an action one times. If I use the tick() function, I need maintain two flags to realize it. The touchGFX give the trigger function like 'static_cast<FrontendApplication*>(Application::getInstance())->handleKeyEvent(1);', So I want to find If the Model have the same interface. It is not a problem for me, just a advice.=)