|↑↑↑ Home||↑↑ Hardware||↑ Iliad|
The problem -- The solution
iRex has opened up the complete source code of Iliad libraries and daemon programs. This is very interesting from the point of view of understanding how the e-reader works (the lack of documentation notwithstanding). But the available header and source files do not constitute an API as such. The header files relating to a topic (say, communication with the page bar) contain not only functions to be called by the application program, and which are is often undocumented. An application programmer also has to look through a large number of header files to find everything (s)he will need.
When I wrote a reader program for the Iliad, I decided to factor out functions that every reader program would need and wrappers for function calls to the iRex API that tend to occur together.
This resulted in two "libraries" (which are not designed to exist as separate libraries, but to be hard-linked into programs). The first, iliad_api.c and iliad_api.h, define convenient wrapper functions for accessing the LED daemon, the toolbar and pagebar daemons, the frame buffer, and for triggering display updates. The second set of functions defined in iliad_app.c and iliad_app.h is more high-level. They perform initialisation (initialising GTK and opening a full-screen window) and set up a global event queue to which events from both GTK and the toolbar and pagebar are written.
The API wrappers do not contain all the functionality offered by the iRex libraries. But they constitute an actual application program interface (API). They are also interoperable with library functions they do not support, as handles (IPC channels or GTK window handle) can be obtained by the application. For comparatively simple reader programs, they are quite sufficient on their own.
TOS / Impressum