NAME

Net::OBEX::Response::Connect - interpret OBEX protocol Connect response packets

SYNOPSIS

use strict;
use warnings;
use Net::OBEX::Response;

my $res = Net::OBEX::Response->new;

# read 7 bytes of the Connect packet from the socket there somewhere
# now parse it:
my $response_ref = $res->parse( $data_from_the_socket, 1 );

if ( $response_ref->{headers_length} ) {
    # ok, looks like we got some headers in this packet
    # read $response_ref->{headers_length} bytes from the socket
    # here and parse the headers.
}

# OMG SO COMPLICATED!!
# Why not use Net::OBEX::Response parse_sock() method instead?!

DESCRIPTION

WARNING!!! this module is still in early alpha stage. It is recommended that you use it only for testing.

This module is used internally by Net::OBEX::Response and that's what you probably should be using. This module provides means to interpret raw OBEX protocol Connect responses. For other responses see Net::OBEX::Response::Generic

CONSTRUCTOR

new

my $res = Net::OBEX::Response::Connect->new;

Takes no arguments, returns a freshly baked, Net::OBEX::Response::Connect object ready to be used and abused.

METHODS

parse_info

$res->packet( $data_from_wire );
my $connect_response = $res->parse_info;

# or

my $connect_response = $res->parse_info( $data_from_wire );

Takes one optional argument which is the raw data from the wire representing the Connect response packet. If called without arguments will use the data which you set via packet() method (see documentation for Net::OBEX::Response::Generic) Returns a hashref with the following keys/values:

Sample returns (descriptions are below):

$VAR1 = {
    'mtu' => 5126,
    'flags' => '00000000',
    'packet_length' => 31,
    'obex_version' => '00010000',
    'response_code' => 200,
    'headers_length' => 24,
    'response_code_meaning' => 'OK, Success'
};

packet_length

{ 'packet_length' => 3 }

The packet_length key will contain the length of the packet in bytes.

headers_length

{ 'headers_length' => 24 }

The headers_length key will contain the length of packet's headers in bytes. You would use this value to finish reading the entire packet from the socket, however, see the parse_sock() method described below.

response_code

{ 'response_code' => 200 }

The response_code key will contain a response code, this will pretty much be HTTP response codes since that what OBEX prefers to use.

response_code_meaning

{ 'response_code_meaning' => 'OK, Success' }

The response_code_meaning key will contain a human parseable explanation of response_code.

mtu

{ 'mtu' => 5126 }

The mtu key will contain the MTU of the responding device, i.e. the maximum length of a packet (in bytes) the device can accept.

flags

{ 'flags' => '00000000' }

The flags key will contain an unpacked "flags" byte, all but the first of those 8 bits are reserved. If the first bit is set it indicates support for multiple IrLMP connections to the same LSAP-SEL

obex_version

{ 'obex_version' => '00010000' }

The obex_version key will contain an unpacked "version" byte. Which is the version of the OBEX protocol encoded with the major number in the high order 4 bits, and the minor version in the low order 4 bits.

other methods

The module also provides code_meaning(), headers_length(), packet and info() methods which are described in documentation for Net::OBEX::Response::Generic.

SEE ALSO

Net::OBEX::Packet::Headers, Net::OBEX::Response, Net::OBEX::Response::Generic

REPOSITORY

Fork this module on GitHub: https://github.com/zoffixznet/Net-OBEX

BUGS

To report bugs or request features, please use https://github.com/zoffixznet/Net-OBEX/issues

If you can't access GitHub, you can email your request to bug-Net-OBEX at rt.cpan.org

AUTHOR

Zoffix Znet <zoffix at cpan.org> (http://zoffix.com/, http://haslayout.net/)

LICENSE

You can use and distribute this module under the same terms as Perl itself. See the LICENSE file included in this distribution for complete details.