Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insteon: Parse PLM_Info Messages Before ACK/NACK/Bad Command #419

Merged
merged 1 commit into from
Jun 17, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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