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

Fix issue 158 #159

Merged
merged 3 commits into from
Apr 17, 2013
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
55 changes: 36 additions & 19 deletions lib/Insteon_PLM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -619,19 +619,24 @@ sub _parse_data {
}
elsif ($parsed_prefix eq $prefix{all_link_clean_failed} and ($message_length == 12))
{ #ALL-Link Cleanup Failure Report
# extract out the pertinent parts of the message for display purposes
# bytes 0-1 - group; 2-7 device address
my $failure_group = substr($message_data,0,2);
my $failure_device = substr($message_data,2,6);

&::print_log("[Insteon_PLM] DEBUG2: Received all-link cleanup failure from device: "
. "$failure_device and group: $failure_group") if $main::Debug{insteon} >= 2;
if ($self->active_message){
# extract out the pertinent parts of the message for display purposes
# bytes 0-1 - group; 2-7 device address
my $failure_group = substr($message_data,0,2);
my $failure_device = substr($message_data,2,6);

&::print_log("[Insteon_PLM] DEBUG2: Received all-link cleanup failure from device: "
. "$failure_device and group: $failure_group") if $main::Debug{insteon} >= 2;

my $failed_object = &Insteon::get_object($failure_device,'01');
my $message = new Insteon::InsteonMessage('all_link_direct_cleanup', $failed_object,
$self->active_message->command, $failure_group);
push(@{$$failed_object{command_stack}}, $message);
$failed_object->_process_command_stack();
my $failed_object = &Insteon::get_object($failure_device,'01');
my $message = new Insteon::InsteonMessage('all_link_direct_cleanup', $failed_object,
$self->active_message->command, $failure_group);
push(@{$$failed_object{command_stack}}, $message);
$failed_object->_process_command_stack();
} else {
&::print_log("[Insteon_PLM] DEBUG2: Received all-link cleanup failure."
. " But there is no pending message.") if $main::Debug{insteon} >= 2;
}

}
elsif ($parsed_prefix eq $prefix{all_link_record} and ($message_length == 20))
Expand Down Expand Up @@ -674,15 +679,27 @@ sub _parse_data {
# so, slow things down
if (!($nack_count))
{
my $nack_delay = ($::config_parms{Insteon_PLM_disable_throttling}) ? 0.3 : 1.0;
&::print_log("[Insteon_PLM] DEBUG3: Interface extremely busy. Resending command"
. " after delaying for $nack_delay second") if $main::Debug{insteon} >= 3;
$self->_set_timeout('xmit',$nack_delay * 1000);
$self->active_message->no_hop_increase(1);
$self->retry_active_message();
$process_next_command = 0;
if ($self->active_message){
my $nack_delay = ($::config_parms{Insteon_PLM_disable_throttling}) ? 0.3 : 1.0;
&::print_log("[Insteon_PLM] DEBUG3: Interface extremely busy. Resending command"
. " after delaying for $nack_delay second") if $main::Debug{insteon} >= 3;
$self->_set_timeout('xmit',$nack_delay * 1000);
$self->active_message->no_hop_increase(1);
$self->retry_active_message();
$process_next_command = 0;
} else {
&::print_log("[Insteon_PLM] DEBUG3: Interface extremely busy."
. " No message to resend.") if $main::Debug{insteon} >= 3;
}
$nack_count++;
}
#Remove the leading NACK bytes and place whatever remains into fragment for next read
$parsed_data =~ s/^(15)*//;
if ($parsed_data ne ''){
$$self{_data_fragment} .= $parsed_data;
::print_log("[Insteon_PLM] DEBUG3: Saving parsed data fragment: "
. $parsed_data) if( $main::Debug{insteon} >= 3);
}
}
else
{
Expand Down