Skip to content

Commit

Permalink
Merge pull request #666 from CityDweller/upb_updates
Browse files Browse the repository at this point in the history
update to contain name of object when there is an error
  • Loading branch information
hplato authored Feb 18, 2017
2 parents e71339b + a3043a3 commit a579bf7
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions lib/UPBPIM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,28 @@ sub _parse_data {
#UPB No Acknowledgement
elsif ( uc( substr( $data, 1, 1 ) ) eq 'N' ) {
$$self{xmit_in_progress} = 0;
&::print_log(
"$self->object_name: Reports device does not respond");
pop( @{ $$self{command_stack} } );


my $pop = pop( @{ $$self{command_stack} } );
my $destination = unpack( "C", pack( "H*", substr( $pop, 6, 2 ) ) );
my $msgid = unpack( "C", pack( "H*", substr( $pop, 10, 2 ) ) );
my $command;
for my $key ( keys %UPB_Device::message_types )
{
if ($UPB_Device::message_types{$key} == $msgid)
{
$command = $key;
last;
}
}
for my $obj ( @{ $$self{objects} } )
{
if ($obj->device_id() == $destination )
{
#&::print_log("$self->object_name: Reports device does not respond; LastCommand: $pop");
&::print_log("UPBPIM reports that device: " . $obj->get_object_name . " does not respond to command: $command");
}
}
select( undef, undef, undef, .15 );
$self->process_command_stack();
}
Expand Down

0 comments on commit a579bf7

Please sign in to comment.