Skip to main content
FrankNatoli
Associate III
Question

How to access TouchGFX Model and/or ModelListener

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"?

This topic has been closed for replies.

4 replies

MM..1
Super User

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...

FrankNatoli
Associate III

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
Visitor II

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