GPS::Lowrance::LSI

GPS::Lowrance::LSI is a Lowrance Serial Interface Protocol module in Perl.
Download

GPS::Lowrance::LSI Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Robert Rothenberg
  • Publisher web site:
  • http://search.cpan.org/~rrwo/

GPS::Lowrance::LSI Tags


GPS::Lowrance::LSI Description

GPS::Lowrance::LSI is a Lowrance Serial Interface Protocol module in Perl. GPS::Lowrance::LSI is a Lowrance Serial Interface Protocol module in Perl.SYNOPSIS use Win32::SerialPort; # or Device::SerialPort (?) use GPS::Lowrance::LSI 'lsi_query'; my $port = new Win32::SerialPort( 'com1' ); my $data = lsi_query( $port, 0x30e, "", 0 );This module provides very low-level support for the LSI (Lowrance Serial Interface) 100 protocol used to communicate with Lowrance and Eagle GPS devices.(Higher-level functions and wrappers for specific commands will be provided in other modules. This module is intentionally kept simple.)Functionslsi_query $data_out = lsi_query( $port, $cmd, $data_in, $id, $debug, $timeout, $retry );This method submits an LSI query sentence (with the command and input data) to a GPS connected to the device specified by serial port at $port. (See the LSI specification on the Lowrance or Eagle web sites for the specific command codes.)It then waits $timeout seconds (defaults to 5) for a response. If there is no response, it returns undef.Otherwise, it verifies that the response is well-formed and returns the data. If $retry is greater than zero, then it will retry the query $retry times if there is a bad checksum or if there is a timeout. (If the checksum keeps failing or responses time out, it will return undef.)A value of -1 for $retry causes bad checksums to be ignored.The $id value is "reserved" and should be set to 0.The first 8-bytes of the returned data is the response header.The format of the rest of the data depends on the command.If $debug is true, then debugging information is shown.verify_checksum if (verify_checksum( $data )) { ... }Used to verify the checksum in the data. The last byte of data returned is the checksum of the data.Note that "lsi_query" returns the initial 8-byte acknowledgement header along with any data. So to verify data returned by that function: if (verify_checksum( substr( $data, 8 ) )) { ... }The query function already verifies data returned by the query. So there is usually no need to re-check the data.lsi_checksum $chksum = lsi_checksum( $data );Used to calculate 8-bit checksums in data. This is generally an internal routine, but since "lsi_query" makes raw data available, this is useful.EXAMPLESAn example of using this module to query product information is below: use GPS::Lowrance::LSI; use Parse::Binary::FixedFormat; $InfoRec = new Parse::Binary::FixedFormat ; # We assume that $Port is already initialized to a serial port using # Win32::SerialPort or Device::SerialPort $Buff = lsi_query($Port, 0x30e); $Info = $InfoRec->unformat( substr($Buff, 8) );A working implementation of this example can be found in the file eg/getinfo.pl included with this distrubtion. Requirements: · Perl


GPS::Lowrance::LSI Related Software