Device-RFXCOM

 view release on metacpan or  search on metacpan

lib/Device/RFXCOM/Response.pm  view on Meta::CPAN


sub bytes { shift->{bytes} }


sub messages { shift->{messages} || [] }


sub duplicate { shift->{duplicate} }


sub summary {
  my $self = shift;
  my $str = join "\n  ", map { $_->summary } @{$self->messages};
  sprintf('%s %s %02x.%s%s%s',
          $self->master ? 'master' : 'slave',
          $self->type,
          $self->header_byte,
          $self->hex_data,
          $self->duplicate ? '(dup)' : '',
          $str =~ /\n/ ? ":\n  ".$str : $str ne '' ? ': '.$str : '');
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Device::RFXCOM::Response - Device::RFXCOM::Response class for data from RFXCOM receiver

=head1 VERSION

version 1.163170

=head1 SYNOPSIS

  # see Device::RFXCOM::RX

=head1 DESCRIPTION

Base class for RFXCOM response modules.

=head1 METHODS

=head2 C<new(%params)>

This constructor returns a new response object.

=head2 C<type()>

This method returns the type of the response.  It will be one of:

=over

=item unknown

for a message that could not be decoded

=item version

for a response to a version check request

=item mode

for a response to a mode setting request

=item empty

for an empty message

=back

or it will be a string representing the type of device from which the
message originated.

=head2 C<header_byte()>

This method returns the header byte contains the length in buts and
master/slave flag for the message.

=head2 C<master()>

This method returns true of the message originated from the master
receiver or false of it originated from a slave receiver.

=head2 C<hex_data()>

This method returns a hex string representing the payload of the RF
message.

=head2 C<data()>

This method returns the binary string of the payload of the RF
message.

=head2 C<length()>

This method returns the length of the payload of the RF message (in bytes).

=head2 C<bytes()>

This method returns an array reference of bytes representing the
payload of the RF message.

=head2 C<messages()>

This method returns an array reference of message objects generated
from the payload.

=head2 C<duplicate()>

This method returns a true value if the message was identical to another
sent recently.

=head2 C<summary()>

This method returns a string summary of the contents of the RF message.



( run in 0.473 second using v1.01-cache-2.11-cpan-81fc1098f69 )