NAME

POCSAG::PISS - A perl module for accessing the PISS modem

ABSTRACT

PISS is a simple protocol to talk to a synchronous POCSAG bit-banger module. At concept level, much like KISS (Keep It Simple Stupid), but for POCSAG instead of AX.25.

DESCRIPTION

Unless a debugging mode is enabled, all errors and warnings are reported through the API (as opposed to printing on STDERR or STDOUT), so that they can be reported nicely on the user interface of an application.

OBJECT INTERFACE

new(config)

Returns a new instance of the PISS modem driver. Usage:

my $modem = new POCSAG::PISS(
   'serial' => '/dev/ttyUSB0',
   'serial_speed' => 9600,
   'max_tx_len' => 1000,
);
get_error($modem)

Returns the error code and error message string for the last error experienced.

my($code, $message) = $modem->get_error();

error_msg($modem)

Gets just the error message string for the last error experienced. Good for

$modem->open() || die "Failed to open modem: " . $modem->error_msg();

open()

Opens the serial device after locking it using a lock file in /var/lock, sets serial port parameters, and flushes the input buffer by reading whatever the modem has transmitted to us since we last read from the port.

The flushing part does take a couple of seconds, so be patient.

close()

Closes the serial device.

keepalive()

Reopens the serial device, if needed, if it has been closed due to a error for example.

max_tx_len()

Returns the maximum length of a transmit buffer the modem is willing to take. Depends on the available memory on the modem, and it's internal data set size. Whatever this function returns, should be passed to POCSAG::Encode.

brraaap($encoded)

Transmits an encoded message, as returned by POCSAG::Encode::generate().

close()

Closes the modem device. Can be reopened with open().