What's the purpose of 'default_handler' in ke_task_desc

4 posts / 0 new
Last post
hardy.chen
Offline
Last seen:1 year 9 months ago
Joined:2015-03-13 04:20
What's the purpose of 'default_handler' in ke_task_desc

Hi,

With the short description from source code (ke_task.h) as below:

/// Pointer to the state handler table (one element for each state).
const struct ke_state_handler* state_handler;
/// Pointer to the default state handler (element parsed after the current state).
const struct ke_state_handler* default_handler;

I still don't know exactly when 'default_handler' will be called, so to speak, what's exact meaning of 'element parsed after the current state'?
我猜应该是将被称为“default_handler”*everytime* after the handler specified in 'state_handler'. ?? Is this true?
Can someone help to explain it for me?

Device:
Joacimwe
Offline
Last seen:1 year 5 months ago
Guru
Joined:2014-01-14 06:45
If there is no matching

If there is no matching handler in the table of the current state, the default handler table will be looked up. This means you can write most of your handlers in the default state table, and override a few of them depending on the state.

MHv_Dialog
Offline
Last seen:1 month 3 weeks ago
Staff
Joined:2013-12-06 15:10
Hi,

Hi,

As Joacim correctly stated, default handlers handle events that the user (you) don't handle. For each event (or message) that is triggered, the call back table inuser_callback_config.hmust specify to either be handled by the default handler, behandledbya handler implemented by you (the user), or be gracefully "ignored" (NULL). This method allows the user to implement anything he/she wants without having to care about stuff that already works in the sample code. This is the core difference between SDK3 and SDK5 in fact.

hardy.chen
Offline
Last seen:1 year 9 months ago
Joined:2015-03-13 04:20
Hi,

Hi,

Thanks for your comment. Well noted!