NAME

Device::ProXR - A Moo based object oriented interface for creating controlling devices using the National Control Devices ProXR command set

VERSION

Version 0.07

SYNOPSIS

  ## Device::ProXR is a base class that is typicall extended
  ##    see Device::ProXR::RelayControl 
  use Device::ProXR;

  my $board = Device::ProXR->new(port => qq{COM1});

SEE ALSO

Device::ProXR::RelayControl

See the NCD website for the devices with the ProXR series controller.

ATTRIBUTES

port
  Port used to communicate with the device
baud
  Baud rate for port used to communicate with the device.
  NOTE: This only applies to serial port communications
  DEFAULT: 115200
API_mode
  Enable the API mode of communications. This mode adds byte counts and
  checksums to all commands and responses.
  DEFAULT: 1
debug_level
  Debug level controls amount of debugging information displayed
  DEFAULT: 0

METHODS

last_error()

Description

Returns the last error message

Parameters

NONE

Return

String containing the last error, or an empty string if no error has been encountered

send_command(cmd, param)

Description

Sends the given command wand optional parameter. NOTE: This method adds the required 0xFE before the command, and encapsulation of the packet in API mode

Parameters

cmd - Command to send param - Optional parameter

Return

UNDEF on error (last_error set), or number of bytes sent

get_response(count, ms_timeout)

Description

Return a buffer containing the response received from the controller NOTE: In API mode, the checksum is verified and the header byte (0xAA) count and checksum are removed from the buffer

Parameters

count - Number of bytes expected DEFAULT: 1 ms_timeout - Optional timeout in milliseconds DEFAULT: 400

Return

UNDEF on error (last_error set), or SCALAR containing the data received

AUTHOR

Paul Durden <alabamapaul AT gmail.com>

COPYRIGHT & LICENSE

Copyright (C) 2015 by Paul Durden.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.