Storyboard input channel name

Hello,

I am working on a simple IO example using Storyboard with FreeRTOS on an NXP RT1050 EVB with no file system.
My backend code can receive messages from the Storyboard frontend but when I try to open a channel to send messages to the frontend I get a failure. I think the problem is the name of the channel. In a Unix type system, my understanding is that the send channel is called "projectname.gapp" or whatever the .gapp file is called.

So my question is, what is the name of the send channel in a "real" embedded system?

Thanks & Regards,
Bob

0

Comments

2 comments
  • Hi Bob,

    The mechanism is just the same for the FreeRTOS platform as you use with Linux if you want to use a named channel but instead of specifying the channel name on the sbengine launcher command line you need to pass this name as an argument to the run_storyboard_app() API call as follows. In this case, we are sending to a named inbound channel 'frontend' defined in the model:

    // set an inbound SBIO channel name
    args[n++] = "greio";
    args[n++] = "channel=frontend";

    run_storyboard_app(sb_model, GR_APP_LOAD_STRING, args, n);

    With the FreeRTOS platform, you can also use a slightly different, more direct approach and API from the SDK (check-in include/gre/gre.h) which uses the application handle and app object. Be sure to first check that this app handle is valid before calling an API function eg: from an interrupt or another RTOS task.

    From gre.h:

    /**
    * Inject an event into the application event queue.
    *
    * After making this call the arguments are copied into the internal event queue and
    * the content can be freely modified without affecting the queue'ed event.
    *
    * @param app The application handle
    * @param event_target The name of the event target, or NULL to send to the default target
    * @param event_name The name of the event to send, must not be NULL
    * @param event_format The format of the data (see <data_format.h>, or NULL if no data is being sent
    * @param event_data A pointer do the data to transmit, or NULL if no data is transmitted
    * @param event_nbytes The number of data bytes to transmit, or NULL if no data is transmitted
    * @return 0 on success otherwise an error.
    */
    DLLExport int gr_application_send_event(gr_application_t *app,
    const char *event_target,
    const char *event_name,
    const char *event_format,
    const void *event_data,
    int event_nbytes);

    If you have a copy of the Storyboard SDK document (Storyboard_Suite_SDK.pdf) there are more details of the various APIs.

    Below is an example back-end code snippet for FreeRTOS which post an 'update_angle' event to the Storyboard model with some event data 'dial_angle' using the API call gr_application_send_event().

    gr_application_t *g_app = NULL;
    :
    :
    float angle = 90.0f;
    int status = 0;

    if( g_app != NULL ) {
    status = gr_application_send_event(g_app, NULL, "update_angle", "4f1 dial_angle", &angle, sizeof(angle));
    }

    This is some code that you can use to send a key press-release cycle triggered from for example an IO pin interrupt trigger, UART character received etc:

    #include <gre/greio.h>
    #include <gre/iodefs.h>

    gr_application_t *g_app = NULL;

    gr_key_event_t key_event_data;
    memset(&key_event_data, 0, sizeof(key_event_data));

    key_event_data.code = 0;
    key_event_data.key = c; // Read key value to send from serial port, keyboard device or sample IO pin etc
    key_event_data.modifiers = 0;

    if( g_app != NULL ) {
    // key is pressed and it was not a repeat key so send new press event
    gr_application_send_event(g_app, NULL, GR_EVENT_KEY_DOWN, GR_EVENT_KEY_FMT, &key_event_data, sizeof(key_event_data));

    greal_nanosleep(&sleep_time, NULL);
    // and release
    gr_application_send_event(g_app, NULL, GR_EVENT_KEY_UP, GR_EVENT_KEY_FMT, &key_event_data, sizeof(key_event_data));
    }

    The key-presses and touch events are posted to the model event queue and are handled at the application scope. Checkout the definitions in gre/greio.h and gre/iodefs.h for more details of the events and formats.

    I hope this information helps.

    Regards,
    Garry

    0
    Comment actions Permalink
  • Thanks, Garry. Good information.
    Everything is working fine now.
    Bob

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post