AccessoryMenu/Slider.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 37 CC 5 SCAR 29.7
CC
5
Cov
0%
handle
30.0
on_enter
2.0
BEGIN
2.0
CRAP 19.5
1 use strict;
2 package Device::Ericsson::AccessoryMenu::Slider;
3 use base 'Device::Ericsson::AccessoryMenu::State';
4 __PACKAGE__->mk_accessors( qw( callback value steps title ) );
5  
6  
7 sub on_enter {
8 my $self = shift;
9  
10 my $title = $self->title;
11 my $steps = $self->steps;
12 my $value = int( $self->value / 100 * $steps ); # starting step
13  
14 $self->send( qq{AT*EAID=4,2,"$title",$steps,$value} );
15 $self->expect( 'OK' );
16 }
17  
18 sub handle {
19 my $self = shift;
20 my $line = shift;
21  
22 if ($line =~ /^\*EAII: 15,(\d+)$/) {
23 my $value = $1;
24 $self->callback->($value) if $self->callback;
25 return;
26 }
27 if ($line =~ /\*EAII: [04]/) {
28 $self->exit_state;
29 return;
30 }
31 warn "Slider got unexpected 'line'\n" if $self->debug;
32 }
33  
34 1;