Chapter 9. Storyboard IO

Table of Contents

Connecting to a Storyboard Application
Sending Events to a Storyboard Application
Setting Application Data
Receiving Events from a Storyboard Application
Storyboard IO Utilities
iogen
iorcv
Storyboard IO API
gre_io_add_mdata
gre_io_close
gre_io_free_buffer
gre_io_grow_buffer
gre_io_open
gre_io_receive
gre_io_send
gre_io_send_mdata
gre_io_serialize
gre_io_size_buffer
gre_io_unserialize
gre_io_zero_buffer

The Storyboard IO API provides a platform independent communication API that allows inter-task and inter-process queued message passing. This is primarily used to allow external communication with a Storyboard application.

Note

Storyboard IO was previously known as GREIO

The Storyboard IO API layers on top of native message passing and communication APIs, dependent on the operating system:

Linux

SysV message queue

MacOS

SysV message queue

QNX

QNX POSIX message queue (mqueue server or mq server/library)

Using the SBIO_MQ_PATH environment variable you can determine which message queue technology will be used. By default the standard mqueue server and corresponding C library mq_* functions will be used.

If the SBIO_MQ_PATH environment variable is set to point at the libmq.so library (ie SBIO_MQ_PATH=/usr/lib/libmq.so) then the default binding for the message queue implementation can be changed to use the mq server and the corresponding mq library functions.

If the SBIO_MQ_PATH environment variable is used, then it must be used consistently with all Storyboard IO clients and servers that want to communicate with one another.

WinCE/WinCompact7

WinCE MSMQ

Win32

MS-Mailslots

Storyboard IO integration with the Storyboard Engine is implemented as a plugin. It is possible to create alternate Storyboard IO implementations that take advantage of custom communication facilities available on a platform.

The Storyboard IO plugin provides a single communication channel which clients can used to inject events into the Storyboard application. These events will be queued and dispatched in the same manner as internally generated events.

Client applications can use Storyboard IO to create their own communication channels and then receive events from that channel from the Storyboard application or from any other Storyboard IO client.

Connecting to a Storyboard Application

In order to communicate with a running Storyboard application the application must first attach to the application's Storyboard IO channel.  By default this channel is named after the deployment bundle file (ie [bundlename].gapp), however the name of this channel can be customized by specifying -ogreio,channel=newname as an option to sbengine. Alternatively, on some platforms, it is also possible to set a GREIONAME environment variable to the channel name.

Once the channel name is determined, the connection to the channel can be established with the gre_io_open() function. This will connect to the channel and return a handle that can be used for future communication.

Once the application has determined that no further communication is necessary the channel should be closed via the gre_io_close() function.