Net::OBEX::Packet::Request::Connect - create OBEX protocol Connect request packets.
Connect
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;
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.
0x80
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:
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)
[]
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
4096
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.
"\x10"
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)
"\x00"
my $raw_packet = $conn->make;
Takes no arguments, returns a raw OBEX Connect packet ready to go down the wire.
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.
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()).
make()
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.
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.
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.
Fork this module on GitHub: https://github.com/zoffixznet/Net-OBEX
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
bug-Net-OBEX at rt.cpan.org
Zoffix Znet <zoffix at cpan.org> (http://zoffix.com/, http://haslayout.net/)
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.
LICENSE
To install Net::OBEX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::OBEX
CPAN shell
perl -MCPAN -e shell install Net::OBEX
For more information on module installation, please visit the detailed CPAN module installation guide.