Skip to main content
FrankNatoli
Associate III
October 17, 2021
Question

How to access TouchGFX Model and/or ModelListener

  • October 17, 2021
  • 2 replies
  • 2728 views

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.

2 replies

MM..1
Chief III
October 17, 2021

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
October 17, 2021

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?

MM..1
Chief III
October 18, 2021
Alexandre RENOUX
Visitor II
October 19, 2021

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