How does MessageListener callback access data?

Forgive me if I’m missing something obvious, but I don’t understand how to use the Message and MessageListener classes to pass data. The documentation for Message reads:

If you want to send a message that carries some kind of custom data, just create a subclass of Message with some appropriate member variables to hold your data.

But how can the MessageListener callback access a Message subclass’s member variables? The callback does not see the interface of the subclass of Message. It only sees the public interface of the Message class itself. If I define a Message subclass containing some data, how do I access that data from the MessageListener callback?

You could use a dynamic_cast (there’s an example in TimersAndEventsDemo.h).

See Also : MessageManager::callAsync
See Also : Timer::callAfterDelay