Zoffix Znet > Net-OBEX-1.001001 > Net::OBEX::Packet::Request::Connect

Download:
Net-OBEX-1.001001.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 1.001001   Source  

NAME ^

Net::OBEX::Packet::Request::Connect - create OBEX protocol Connect request packets.

SYNOPSIS ^

    use Net::OBEX::Packet::Request::Connect;

    my $conn = Net::OBEX::Packet::Request::Connect->new(
        headers => [ $bunch, $of, $raw, $headers ],
    );

    my $connect_packet = $conn->make;

    $conn->headers([]); # reset headers.

    my $connect_packet2 = $conn->make;

DESCRIPTION ^

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

The module provides means to create OBEX protocol Connect (0x80) packets. It is used internally by Net::OBEX::Packet::Request module and you probably want to use that instead.

CONSTRUCTOR ^

new

    my $conn = Net::OBEX::Packet::Request::Connect->new;

    my $conn2 = Net::OBEX::Packet::Request::Connect->new(
        mtu       => 4096,
        version   => "\x10",
        flags     => "\x00",
        headers   => [ $bunch, $of, $raw, $headers ],
    );

Returns a brand new Net::OBEX::Packet::Request::Connect object, takes several arguments, all of which are optional. Possible arguments are as follows:

headers

    my $conn2 = Net::OBEX::Packet::Request::Connect->new(
        headers   => [ $bunch, $of, $raw, $headers ],
    );

Optional. Takes an arrayref as a value elements of which are raw OBEX packet headers. See Net::OBEX::Packet::Headers if you want to create those. Defaults to: [] (no headers)

mtu

    my $conn2 = Net::OBEX::Packet::Request::Connect->new( mtu => 4096 );

Optional Specifies the MTU (Maximum Transmission Unit), or in other words, the largest packet the device can accept. Defaults to: 4096

version

    my $conn2 = Net::OBEX::Packet::Request::Connect->new(
        version => "\x10",
    );

Optional. Takes a byte representing the OBEX protocol version used in the conversation encoded with the major number in the high order 4 bits, and the minor version in the low order 4 bits. Defaults to: "\x10" (version 1.0) and you probably don't want to change that right now.

flags

    my $conn2 = Net::OBEX::Packet::Request::Connect->new(
        flags => "\x00",
    );

Optional. Takes a byte representing the connect packet "flags". Currently the all bits of the request packet flags are reserved and must be set to zero, therefore you shouldn't be using this one. Defaults to: "\x00" (all bits set to zero)

METHODS ^

make

    my $raw_packet = $conn->make;

Takes no arguments, returns a raw OBEX Connect packet ready to go down the wire.

ACCESSORS/MUTATORS ^

headers

    my $old_headers_ref = $conn->headers;

    $conn->headers( [ $bunch, $of, $raw, $headers ] );

Takes an arrayref as a value elements of which are raw OBEX packet headers. See Net::OBEX::Packet::Headers if you want to create those. If you want your packet to have no headers specify an empty arrayref ([]) as an argument. Returns an arrayref of currently set headers.

raw

    my $raw_packet = $conn->raw;

Must be called after a call to make() (see above). Takes no arguments. Returns the raw packet which was made with last make() (i.e. the return value of last make()).

mtu

    my $old_mtu = $conn->mtu;

    $conn->mtu(1024);

Returns a currently set MTU, the maximum length of a packet the device can accept. Takes one argument which is the MTU in bytes.

version

    my $old_version = $conn->version;

    $conn->version( "\x10" );

Returns a byte representing the currently set OBEX protocol version. Takes one optional argument which is the byte representing the OBEX protocol version to use encoded with the major number in the high order 4 bits, and the minor version in the low order 4 bits. You probably don't want to play with this.

flags

    my $old_flags = $conn->flags;

    $conn->flags("\x00");

Returns a byte representing the currently set Connect packet "flags". Takes one optional argument which is the byte representing Connect pack "flags" to use. In the request Connect packet all bits of "flags" byte are reserved, thus you probably don't want to play with this.

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.

syntax highlighting: