| 1 | |||||||||||
| 2 | package Net::OBEX::Packet::Request::Connect; | ||||||||||
| 3 | |||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 7 | our $VERSION = '1.001002'; # VERSION | |||||||||
| 8 | |||||||||||
| 9 | 7 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 7 | ▶ | use base qw(Class::Data::Accessor Net::OBEX::Packet::Request::Base); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 7 | __PACKAGE__->mk_classaccessors( | |||||||||
| 13 | qw( | ||||||||||
| 14 | mtu | ||||||||||
| 15 | version | ||||||||||
| 16 | flags | ||||||||||
| 17 | ) | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 21 | 2 | my $class = shift; | |||||||||
| 22 | 2 | ▶ | croak "Must have even number of arguments to new()" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | if @_ & 1; | ||||||||||
| 24 | 2 | my %args = @_; | |||||||||
| 25 | 2 | $args{ +lc } = delete $args{ $_ } for keys %args; | |||||||||
| 26 | |||||||||||
| 27 | 2 | %args = ( | |||||||||
| 28 | mtu => 4096, | ||||||||||
| 29 | version => "\x10", | ||||||||||
| 30 | flags => "\x00", | ||||||||||
| 31 | headers => [], | ||||||||||
| 32 | |||||||||||
| 33 | %args, | ||||||||||
| 34 | ); | ||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | 2 | return bless \%args, $class; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 2 | ▶ | sub make { | ||||||||
|
Subroutine
make: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 41 | 2 | my $self = shift; | |||||||||
| 42 | 2 | my $headers = join '', @{ $self->headers }; | |||||||||
| 43 | |||||||||||
| 44 | 2 | my $packet = $self->version . $self->flags . pack 'n', $self->mtu; | |||||||||
| 45 | 2 | $packet .= $headers; | |||||||||
| 46 | |||||||||||
| 47 | 2 | $packet = "\x80" . (pack 'n', 3 + length $packet) . $packet; | |||||||||
| 48 | |||||||||||
| 49 | 2 | return $self->raw( $packet ); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 7 | 1; | |||||||||
| 53 | |||||||||||
| 54 | __END__ | ||||||||||