File Coverage

blib/lib/Device/MindWave/Packet/ThinkGear/DataValue/Meditation.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 5 5 100.0
total 37 37 100.0


line stmt bran cond sub pod time code
1             package Device::MindWave::Packet::ThinkGear::DataValue::Meditation;
2              
3 5     5   26078 use strict;
  5         8  
  5         171  
4 5     5   25 use warnings;
  5         9  
  5         130  
5              
6 5     5   610 use Device::MindWave::Utils qw(checksum);
  5         9  
  5         242  
7              
8 5     5   25 use base qw(Device::MindWave::Packet::ThinkGear::DataValue);
  5         15  
  5         1575  
9              
10             sub new
11             {
12 3     3 1 34 my ($class, $bytes, $index) = @_;
13              
14 3         12 my $self = { value => $bytes->[$index + 1] };
15 3         11 bless $self, $class;
16 3         13 return $self;
17             }
18              
19             sub as_bytes
20             {
21 2     2 1 863 my ($self) = @_;
22              
23 2         18 return [ 0x05, $self->{'value'} ];
24             }
25              
26             sub length
27             {
28 3     3 1 10 return 2;
29             }
30              
31             sub as_string
32             {
33 2     2 1 602 my ($self) = @_;
34              
35 2         14 return "Meditation (".$self->{'value'}."/100)";
36             }
37              
38             sub as_hashref
39             {
40 2     2 1 5 my ($self) = @_;
41              
42 2         18 return { Meditation => $self->{'value'} };
43             }
44              
45             1;
46              
47             __END__