Sunday, August 2, 2009


As explained in section 5.1.1 of the iOn development document, the DBUS is the mechanism for inter process communication. Most system components are implemented as seperate programs. When you do a ps, you will see among others
sysd : The system deamon
/usr/bin/popupmenu : the popup menu shown when pressing the menu-button
/usr/bin/uds : the universal document viewer
/usr/bin/ctb : the content browser, basically, this is that application that allows you to browse thru the content of the SD-card.

To show our own icon in the TaskManager or to show our own menu we need to communicate with the popupmenu application via the DBUS.

Take a look at the ipc.c source-file from hello-world, which has all the functions you need to communicate with the 'out-side' world. Most of the available functions are explained in the iOn Development document, chapter 8.

In ipc.c @ 71 DBUS_APPL_NAME is defined as "helloworld" when using the file for your own application, you should give this another name. At line 76-80 you see that every 'system'-application has its own name.
A structure is defined at line 138 indicating the messages to which the hello-world application will react. The first parameter is the name of the (local) function that is called when the event occurs, the second is the name of the event and the third is the application that sends the event (which is not always needed). Different system components will broadcast these messages. The list makes a difference between message handlers and signal handlers, to me it is not completely clear what the difference is.
The function at line 169 ipc_set_services() installs the message and signal handlers using the DBUS. From this point onwards the installed call-back functions, as indicated in the structure at line 138, can be called from the system.
The function ipc_sys_startup_complete() at line 244 should be called to show the icon in the TaskManager-row of the Menu.
From line 371 functions to install menus in the popupmenu are implemented. These should be called from the application to install your own menu. The advantage of using this menu, is that its items can also be dragged to the toolbar and are thus quickly available when running an application. When installing a menu, one should also install a message handler for the "menuItemActivated" message, that will be send by the popupmenu-application.

No comments:

Post a Comment