The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

ProLite - Perl extension to control Pro-Lite LED Message Signs

SYNOPSIS

  use ProLite qw(:core);
  
  my $s = new ProLite(id=>1, device=>'/dev/ttyS0', debug=>0, charDelay=>2000);
  
  $err = $s->connect();
  die "Can't connect to device - $err" if $err;
  
  $s->wakeUp();
  $s->setPage(1, "Hello World");
  $s->runPage(1);

DESCRIPTION

Pro-Lite "Programmable Electronic Displays" available at discount stores and clubs like BJ's Wholesale Club contain a built-in RS-232 Interface via which you can communicate with the device rather than the IR remote control.

Pro-Lite (unlike some of their competitors) has decided to make the protocol for communicating with the sign freely available. This class provides a simple interface embodying that communication protocol for the sign.

EXPORT

Only the core methods are exported by default. While this is kinda nice, you can't do much but initiate communication with the sign.

The class methods and constants are broken down into the following groups:

  :core      methods responsible for basic communication
  :commands  methods responsible for the control of sign functions
  :colors    constants for text colors (see below)
  :styles    constants for text styles
  :dingbats  constants for graphic characters
  :effects   constants for transition effects

OVERVIEW

Pro-Lite signs have 26 pages available, each of which can be filled with content. The content can be augmented with special codes to control text color, font, effects, or special characters.

There may be up to 99 signs all listening on a common RS-422 network connected to a single serial port.

Communication is established by instantiating a ProLite object, passing the id number of the sign with which you want to communicate and the name of a (writable) serial device:

  my $s = new ProLite(id=>1, device=>'/dev/ttyS0', debug=>0, charDelay=>2000);

Next, the connection is established:

  $err = $s->connect();
  die "Can't connect to device - $err" if $err;

and, since the sign disables it's communication port after a period of inactivity, the sign is sent a 'Wake-Up' command:

  $s->wakeUp();

Pages can then be populated with data and selected for display. See the examples accompanying this class.

METHODS

new(id=>$integer, device=>$string, [debug=>$boolean, maxReadAttempts=>$integer])

$evice sets the device over which to communicate.

$debug if true, communication processes are displayed over STDOUT

$id an integer, 1-99, of the sign with which to communicate. Default is 1

$maxReadAttempts the number of times internally to try to get a byte from the sign before timing out. Default is 10000

connect()

Establishes the connection with the sign. Returns false on success, and an error string if a communication or other failure occurs.

wakeUp()

Sends a 'wake-up' signal to the sign. After a period of inactivity, the sign disables it's communication port.

deletePage($page)

Removes the contents (permanently!) of page $page. Valid range 1-26.

deleteGraphic($graphic)

Removes the contents (permanently!) of graphic $graphic. Valid range 1-26.

deleteAll()

Removes all sign data. Use with caution.

setPage($page, @content)

Sets the content of page $page to the list passed. There are 26 pages, numbered 1 through 26. The list can contain literal text or any of the constant methods described below.

For example:

  setPage(1, RESET, yellow, "Hello ", green, "world");
runPage($page)

Tells the sign to immediately display the page specified.

signInfo()

Causes the sign to display it's configuration settings.

factoryReset()

Sets the sign back to it's original settings. Usefull after replacing the internal battery or upgrading the sign's ROM.

setSpeed($speed)

Sets the speed of scrolling activity by inserting delays.

setClock()

Sets the date and time on the sign to the current system time.

targetUp($type, $value, $target, $page)

Sets the event count-up target. The sign will maintain this number and make it available for insertion into sign messages.

$type may be one of 'DAYS' or 'HOURS'. If 'DAYS' the counter is incremented every 24 hours. If 'HOURS' the counter is incremented every hour.

$value the current counter value

$target The desired value

$page The page number to display when this value is reached.

targetDown($days, $hours, $mins, $page)

Sets the event count-down target. The sign will maintain this number and make it available for insertion into sign messages.

$days The number of days to the target

$hours The number of hours to the target

$mins The number of minutes to the target

$page The page number to display when this value is reached.

chain($page)

Generates the code to cause the sign to jump to the specified page.

$page indicates the page

For example:

  setPage(1, RESET, yellow, "Hello ", green, "world", chain(2));
  setPage(2, " Happy Birthday ", chain(1));

would cause "Hello world Happy Birthday " to cycle on the sign. This allows for arbitrarily complex content, especially when coupled to the target functions.

LOW-LEVEL METHODS

Several of the methods listed below are 'Low Level'. They are not needed for common use, and provide access to byte-level communication processes.

waiting()

Returns the number of bytes waiting on the serial port to be read.

getBytes()

Returns, then flushes the serial port input buffer.

sendCommand($data, [$global])

Sends data in $data to the sign with the ID specified in the constructor. If $global is true, formats is as a message to all signs.

CONSTANTS

All of the 'special' characters that the protocol specifies can be generated via constants as described in these tables:

Colors

  RESET             dimRed              red                 brightRed
  orange            brightOrange        dimYellow           yellow 
  brightYellow      dimLime             lime                brightLime
  brightGreen       green               dimGreen
        
  yellowSRedOnGreen rainbow             redSGreen           redSYellow
  greenSRed         greenSYellow        greenOnRed          redOnGreen
  orangeSBlackOnGr  limeSBlackOnRed     greenSBlackOnRed    redSBlackOnGreen 

Styles

  blank             normal              bold                italic
  boldItalic        normalFlash         boldFlash           italicFlash
  boldItalicFlash
  
  uncondensed       condensed 

Dingbats

  telephone         glasses             faucet              rocket
  monster           key                 shirt               helicopter
  car               tank                house               teaPot
  knifeFork         duck                motorcycle          bicycle
  crown             twinHearts          arrowR              arrowL
  arrowDL           arrowUL             beerGlass           chair
  shoe              wineGlass 

Effects

  autoL             openOutL            coverOutL           cyclingL
  closeRT           closeLT             closeInT            scrollUpL
  scrollDownL       overlapL            stackingL           comic1L
  comic2L           appearL             randomL             shiftLeftL
  magicL
  
  thankyou          welcome
  
  currentTime       target              current             dayLeft
  hourLeft          minLeft             secLeft
  
  beep              pauseT
  
  date

AUTHOR

Marc D. Spencer, marcs@pobox.com

SEE ALSO

perl(1).

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 296:

'=item' outside of any '=over'

Around line 301:

You forgot a '=back' before '=head2'