POCSAG::PISS - A perl module for accessing the PISS modem
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.
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.
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, );
Returns the error code and error message string for the last error experienced.
my($code, $message) = $modem->get_error();
Gets just the error message string for the last error experienced. Good for
$modem->open() || die "Failed to open modem: " . $modem->error_msg();
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.
Closes the serial device.
Reopens the serial device, if needed, if it has been closed due to a error for example.
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.
Transmits an encoded message, as returned by POCSAG::Encode::generate().
Closes the modem device. Can be reopened with open().