package USBLCD;

use vars qw($VERSION @ISA @EXPORT $AUTOLOAD);

require Exporter;
require DynaLoader;

@ISA = qw(Exporter DynaLoader);
@EXPORT = qw(
    USBLCD_DEV_TYPE_MT12232A
    USBLCD_DEV_TYPE_MT12232A_KEYS

    USBLCD_POWER_ON
    USBLCD_POWER_SAVE
    USBLCD_POWER_OFF

    USBLCD_LED_UNDEF
    USBLCD_LED_OK
    USBLCD_LED_WARNING
    USBLCD_LED_ERROR

    USBLCD_LED_WHITE
    USBLCD_LED_RED
    USBLCD_LED_ORANGE
    USBLCD_LED_YELLOW
    USBLCD_LED_GREEN
    USBLCD_LED_BLUE

    USBLCD_LED_OFF
    USBLCD_LED_ON

    USBLCD_KEY_NONE
    USBLCD_KEY_UP
    USBLCD_KEY_DOWN
    USBLCD_KEY_LEFT
    USBLCD_KEY_RIGHT
    USBLCD_KEY_OK
    USBLCD_KEY_CANCEL
    USBLCD_KEY_F1
    USBLCD_KEY_F2
    USBLCD_KEY_F3
    USBLCD_KEY_F4

    USBLCD_POLLEVENT_KEYDOWN
    USBLCD_POLLEVENT_KEYUP
    USBLCD_POLLEVENT_IR

    USBLCD_ROTATE0
    USBLCD_ROTATE90
    USBLCD_ROTATE180
    USBLCD_ROTATE270
);

$VERSION = '1.0';



sub AUTOLOAD {
    # This AUTOLOAD is used to 'autoload' constants from the constant()
    # XS function.  If a constant is not found then control is passed
    # to the AUTOLOAD in AutoLoader.

    my($constname);
    ($constname = $AUTOLOAD) =~ s/.*:://;
    my $val = constant($constname);
    if ($! != 0) {
	if ($! =~ /Invalid/) {
	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
	    goto &AutoLoader::AUTOLOAD;
	}
	else {
	    my($pack,$file,$line) = caller;
	    die "Your vendor has not defined USBLCD macro $pack\:\:$constname, used at $file line $line.\n";
	}
    }
    eval "sub $AUTOLOAD { $val }";
    goto &$AUTOLOAD;
}



bootstrap USBLCD;



1;
