## switchapi

switchapi

## Synopsis

    gint                initSwitchApi                       ();
    gint                closeSwitchApi                      ();
    gint                registerSwitchDownListener          (gint switch_num,
                                                             void *callback);
    gint                registerSwitchUpListener            (gint switch_num,
                                                             void *callback);
    gint                deregisterSwitchDownListener        (gint switch_num);
    gint                deregisterSwitchUpListener          (gint switch_num);

## Description

## Details

### initSwitchApi ()

    gint                initSwitchApi                       ();

Initializes the swithc API. This must be called before using the switches.

Returns : | The number of switches that the device can possibly use. Returns -1 if the switch API can't be initialized (so don't use it).

### closeSwitchApi ()

    gint                closeSwitchApi                      ();

Closes the switch API. This must be called at the end of the program.

Returns : | Always zero.

### registerSwitchDownListener ()

    gint                registerSwitchDownListener          (gint switch_num,
                                                             void *callback);

Registers a switch down listener.

`switch_num` : |
`callback` : |
Returns : | Always zero.

### registerSwitchUpListener ()

    gint                registerSwitchUpListener            (gint switch_num,
                                                             void *callback);

Registers a switch up listener.

`switch_num` : |
`callback` : |
Returns : | Always zero.

### deregisterSwitchDownListener ()

    gint                deregisterSwitchDownListener        (gint switch_num);

Removes a switch down listener.

`switch_num` : |
Returns : | Always zero.

### deregisterSwitchUpListener ()

    gint                deregisterSwitchUpListener          (gint switch_num);

Removes a switch up listener.

`switch_num` : |
Returns : | Always zero.