Skip to content

Commit

Permalink
Merge branch 'master' into AD2_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
krkeegan committed Jun 26, 2014
2 parents e060c15 + 6ad9496 commit 212b879
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions lib/Insteon_PLM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,35 @@ sub _parse_data {
$is_nack = 1 if ($data =~ /^($nackcmd)/);
$is_badcmd = 1 if ($data =~ /^($badcmd)/);
}

# Step 4b Check if this is a unique PLM Response
if ($record_type eq $prefix{plm_info} and (length($data) >= 18)){
#Note Receipt of PLM Response
$pending_message->plm_receipt(1);

::print_log( "[Insteon_PLM] DEBUG4:\n".Insteon::MessageDecoder::plm_decode($data))
if $self->debuglevel(4, 'insteon');

$self->device_id(substr($data,4,6));
$self->firmware(substr($data,14,2));
$self->on_interface_info_received();

$data = substr($data, 18);
}
elsif ($record_type eq $prefix{plm_get_config} and (length($data) >= 12)){
#Note Receipt of PLM Response
$pending_message->plm_receipt(1);

::print_log( "[Insteon_PLM] DEBUG4:\n".Insteon::MessageDecoder::plm_decode($data))
if $self->debuglevel(4, 'insteon');
my $message_data = substr($data,4,8);
$self->on_interface_config_received($message_data);
$data = substr($data, 18);
}


# STEP 4b Is this a PLM Response to a command MH sent?
if ($is_ack) {
# STEP 4c Is this a PLM Response to a command MH sent?
elsif ($is_ack) {
#Note Receipt of PLM ACK
$pending_message->plm_receipt(1);

Expand Down Expand Up @@ -1008,29 +1034,6 @@ sub _parse_data {

$data = substr($data, 6);
}
elsif ($record_type eq $prefix{plm_info} and (length($data) >= 18)){
#Note Receipt of PLM Response
$pending_message->plm_receipt(1);

::print_log( "[Insteon_PLM] DEBUG4:\n".Insteon::MessageDecoder::plm_decode($data))
if $self->debuglevel(4, 'insteon');

$self->device_id(substr($data,4,6));
$self->firmware(substr($data,14,2));
$self->on_interface_info_received();

$data = substr($data, 18);
}
elsif ($record_type eq $prefix{plm_get_config} and (length($data) >= 12)){
#Note Receipt of PLM Response
$pending_message->plm_receipt(1);

::print_log( "[Insteon_PLM] DEBUG4:\n".Insteon::MessageDecoder::plm_decode($data))
if $self->debuglevel(4, 'insteon');
my $message_data = substr($data,4,8);
$self->on_interface_config_received($message_data);
$data = substr($data, 18);
}
else {
# No more processing can be done now, wait for more data
$process_data = 0;
Expand Down

0 comments on commit 212b879

Please sign in to comment.