Defines | Functions

iliad_api.h File Reference

Simplified low-level API for the IRex Iliad. More...

#include <liberipc/eripc.h>

Go to the source code of this file.

Defines

#define UAID   1
#define ILIAD_NOERR   0
#define ILIAD_ERR_CONN   1
#define ILIAD_ERR_ERLIB   2
#define ILIAD_ERR_RANGE   3
#define LED_OFF   0
#define LED_BLINK   1
#define LED_ON   2
#define DISP_4BIT   0
#define DISP_2BIT   2
#define DISP_1BIT   1
#define DISP_IMMED   3
#define DISP_01SEC   2
#define DISP_05SEC   1
#define DISP_15SEC   0

Functions

erClientChannel_t busyd_channel ()
 IPC channel for communication with busy LED daemon.
int set_led (int state)
 Set state of busy LED.
erClientChannel_t toolbar_channel ()
 IPC channel for communication with toolbar.
int init_icons (int *iconlist)
 Set icons to show on toolbar.
erClientChannel_t pagebar_channel ()
 IPC channel for communication with pagebar.
int init_pagebar (int npages, int page, int pagepos, int zoom)
 Initialise pagebar.
int set_pagebar_page (int page, int pagepos)
 Set current page and position for pagebar.
unsigned char * framebuffer ()
 Map screen framebuffer device into memory.
void unmap_framebuffer ()
 Unmap screen framebuffer device from memory.
void update_now4bit ()
 Update the display with 4-bit quality within 0.1 seconds.
int update_display (int quality, int priority)
 Update the iLiad's display.
void clear_display ()
 Clears the display within 0.1 seconds.

Detailed Description

Simplified low-level API for the IRex Iliad.

This library contains wrapper functions for display updates, controlling the busy LED, toolbar and pagebar, and for mapping the frame buffer into RAM.


Function Documentation

erClientChannel_t busyd_channel (  ) 

IPC channel for communication with busy LED daemon.

The IPC client is started when this function is first called, the cached channel data is returned on subsequent calls.

Returns:
NULL indicates that the IPC client could not be started.
unsigned char* framebuffer (  ) 

Map screen framebuffer device into memory.

Opens and maps the framebuffer device /dev/fb0 on demand and henceforth returns a pointer to the mapped region. The organisation of the framebuffer is one byte per pixel, row major.

Returns:
Pointer to mapped screen space, or NULL on error
int init_icons ( int *  iconlist  ) 

Set icons to show on toolbar.

Creates toolbar icon set from scratch.

Parameters:
iconlist Pointer to integer array indicating desired icons. The least significant byte must contain the icon ID according to the e_iconID_t enum, the next more significant byte the icon state according to the e_iconState_t enum. The list must be concluded with a -1.
Returns:
0 on success, ILIAD_ERR_CONN if the IPC client could not be started, ILIAD_ERR_ERLIB if one of the iRex library functions returned an error.
int init_pagebar ( int  npages,
int  page,
int  pagepos,
int  zoom 
)

Initialise pagebar.

This function resets the page bar, sets the number of pages to display, the current page, the position on the current page (if applicable) and the page bar mode.

Parameters:
npages Number of pages the page bar should display
page Current page, 1-based
pagepos If >= 0, this is the position on the current page in percent, which is displayed as a narrow black bar at the bottom of the rounded rectangle representing the current page.
zoom Determines what the pagebar displays when the number of pages is so large that not all of them can be displayed as rounded rectangles. If 1, only the pages neighbouring the current one are displayed, all as rounded rectangles. If 0, the current, first and last pages are displayed as rectangles, while those in between are indicated by a series of vertical lines.
Returns:
0 on success, ILIAD_ERR_CONN if IPC client could not be started, ILIAD_ERR_ERLIB if one of the iRex library functions returned an error.
erClientChannel_t pagebar_channel (  ) 

IPC channel for communication with pagebar.

The IPC client is started when this function is first called, the cached channel data is returned on subsequent calls.

Returns:
NULL indicates that the IPC client could not be started.
int set_led ( int  state  ) 

Set state of busy LED.

Parameters:
state LED_OFF, LED_BLINK or LED_ON
Returns:
0 on success, ILIAD_ERR_RANGE state argument out of range, ILIAD_ERR_CONN could not connect to busy LED daemon, ILIAD_ERR_ERLIB error returned by iRex library function call
int set_pagebar_page ( int  page,
int  pagepos 
)

Set current page and position for pagebar.

Parameters:
page Current page, 1-based
pagepos If >= 0, this is the position on the current page in percent, which is displayed as a narrow black bar at the bottom of the rounded rectangle representing the current page.
Returns:
0 on success, ILIAD_ERR_CONN if IPC client could not be started, ILIAD_ERR_ERLIB if one of the iRex library functions returned an error.
erClientChannel_t toolbar_channel (  ) 

IPC channel for communication with toolbar.

The IPC client is started when this function is first called, the cached channel data is returned on subsequent calls.

Returns:
NULL indicates that the IPC client could not be started.
int update_display ( int  quality,
int  priority 
)

Update the iLiad's display.

The reason for the existence of these two parameters is undocumented by iRex. Possibly higher qualities and priorities are more power-intensive.

Parameters:
quality Quality (bit accuracy) of the update
priority Priority determining the delay until the update will be performed (this function returns immediately in any case)
Returns:
0 OK, ILIAD_ERR_RANGE when one of the arguments is out of legal range
void update_now4bit (  ) 

Update the display with 4-bit quality within 0.1 seconds.

This is a convenience function which merely calls update_display(DISP_4BIT, DISP_01SEC).