cancel
Showing results for 
Search instead for 
Did you mean: 

How to access TouchGFX Model and/or ModelListener

FrankNatoli
Associate III

TouchGFX creates Model and ModelListener but I can't figure out how to access the Model "getters" from main.c or any other user code. I can't find where Model or ModelListener is instantiated or where a pointer to the class instance can be found. How to access the "getters"?

4 REPLIES 4
MM..1
Chief II

This class isnt desired to use from main.c. TouchGFX Model is for use with active screen inside GFX task. And over rtos QUEUE messages or shared memory with other tasks...

Queuing messages requires the overhead of writing to a queue, waiting on a queue, thread context switch when queue has data, reading from a queue, all to get data that could be instantly satisfied by a class "getter".

The principle of MVC, model-view-controller, is that "getters" provide "safe" access to a class private members.

But not for TouchGFX Model?

Alexandre RENOUX
Principal

Hello FNato.1,

Please have a look at this article to understand how to communicate with the Model from the View (The ModelListener is not necessary in this case).

You can also read this article to understand how to communicate from main.c to Model which is called Backend communication.

Hope this helps,

/Alexandre