Catch-all event handler

Questions and information about using Lua scripting with Storyboard

Moderator: jamiev

Catch-all event handler

Postby Benjamin » Mon Nov 19, 2018 5:39 am

Hello,

Is it possible to specify a handler that is called on all incoming events (or at least on the ones that aren't already bound to an event handler), without specifying the exact event name? The idea here is to log events that are unrecognized by my Storyboard project and display / log an error message. I looked through the API and didn't find anything.

Cheers,
Benjamin
Benjamin
 
Posts: 9
Joined: Mon Sep 10, 2018 7:11 am

Re: Catch-all event handler

Postby rdowdall » Thu Nov 22, 2018 9:30 am

Hello Benjamin

Unfortunately at this time, no, there isn't a way to do that. We don't have a way to attach a generic event handler that gets fired on every event that occurs. If it's something that you really need for your project you can talk to support about custom engineering paths.

Thanks,
Rodney
rdowdall
 
Posts: 124
Joined: Mon Nov 02, 2009 9:46 pm

Re: Catch-all event handler

Postby rdowdall » Thu Nov 22, 2018 10:04 am

Hello Benjamin

Another approach that you could take with this is to use our SDK to create a plugin that registers a handler that will listen for all events.

Thanks,
Rodney
rdowdall
 
Posts: 124
Joined: Mon Nov 02, 2009 9:46 pm

Re: Catch-all event handler

Postby corey » Fri Nov 23, 2018 10:15 am

Hello Benjamin,

If you are just looking to debug your app, and don't want to do anything with the unknown event other than log it, I thought I'd let you know that Storyboard already logs all incoming events whether they are handled or not. You just need to increase your verbosity when starting your sbengine. To get events to be printed to the log, you need level 3 verbosity (-vvv). If running from the command line supply the verbosity argument as
sbengine -vvv ...
If running from Storyboard Designer, you can add additional command line arguments into your launch configuration by going to Storyboard Simulator Configurations (the device button with the green asterisk, next to the normal launch button on the top menu bar) and in the Storyboard Launch Parameters tab, near the bottom you'll see a box that says "Extra Engine Options:". It defaults to -v but you can change it to -vvv to get additional logging, including events. Just underneath that you should see the launch command line reflect your edit. Click Apply or Run and this will be set to your default launch configuration for future runs (when running from Storyboard Designer).

Hope that helps!

Cheers,
Corey
corey
 
Posts: 1
Joined: Thu Nov 22, 2018 1:46 pm

Re: Catch-all event handler

Postby Benjamin » Tue Dec 11, 2018 6:25 am

Hey Rodney and Corey

Thank you for your replies and suggestions. I think using the SDK is a bit overkill but maybe I run it with -vvv in our firmware for a while and filter the events to save the unknown ones. I'll try that out. Thanks!

Cheers,
Benjamin
Benjamin
 
Posts: 9
Joined: Mon Sep 10, 2018 7:11 am


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron