AnyEvent-OWNet

 view release on metacpan or  search on metacpan

lib/AnyEvent/OWNet.pm  view on Meta::CPAN


Perform an OWNet C<write> operation of the given value to the given path.

=head2 C<dir($path, $sub)>

Perform an OWNet C<dir> operation for the given path.  The callback
will be called once with the list of directory entries in the data
field which isn't consistent with the (misguided?) low-latency intent
of this operation so using L<dirall()|/"dirall($path, $sub)"> probably
makes more sense provided the server supports it.

=head2 C<present($path, $sub)>

Perform an OWNet C<present> check on the given path.

=head2 C<dirall($path, $sub)>

Perform an OWNet C<dirall> operation on the given path.

=head2 C<get($path, $sub)>

Perform an OWNet C<get> operation on the given path.

=head2 C<dirallslash($path, $sub)>

Perform an OWNet C<dirall> operation on the given path.

=head2 C<getslash($path, $sub)>

Perform an OWNet C<get> operation on the given path.

=head2 C<all_cv( [ $condvar ] )>

This method returns the L<AnyEvent> condvar that is used to track all
outstanding operations.  It can also be used to set the initial value
but this is only sensible when no operations are currently outstanding
and is not normally necessary.

=head2 C<cleanup( @error )>

This method is called on error or when the closing the connection to
free up resources and notify any receivers of errors.

=head2 C<connect( [ $command, $callback|$condvar ] )>

This method connects to the C<owserver> daemon.  It is called automatically
when the first command is attempted.

=head2 C<devices( $callback, [ $path, [ $condvar ] ] )>

This method identifies all devices below the given path (or '/' if the
path is not given).  An C<AnyEvent> condvar may also be supplied that
will be used to track C<begin> and C<end> of all actions carried out
during the identification process.  If no condvar is provided then one
will be created.  The condvar used is returned by this method.

The supplied callback is called for each device with the path to each
device as the first argument and the condvar for the operation as the
second argument.  The intention of passing the callback the condvar
(that if not provided is created by the initial call) is to enable the
callbacks that need to make further asynchronous calls to use C<begin>
calls and C<end> calls (in the async callback) on the condvar so that
the complete operation may be tracked.  See the L</SYNOPSIS> for an
example.

This method currently assumes that the C<owserver> supports the C<getslash>
function and if this is not the case it will fail.

=head2 C<device_files( $callback, $file, [ $path, [ $condvar ] ] )>

Visit each device using
L<devices()|/"devices( $callback, [ $path, [ $condvar ] ] )"> and call
the callback with the result of successful L<get()|/"get($path, $sub)">
calls for C<$file> relative to each device found.  If C<$file> is an
array reference each array element is treated as a relative file.

=head2 C<anyevent_read_type()>

This method is used to register an L<AnyEvent::Handle> read type
to read C<OWNet> replies from an C<owserver> daemon.

=head1 TODO

The code assumes that the C<owserver> supports persistence and does
not check the response flags to recognize when it does not.

=head1 SEE ALSO

AnyEvent(3)

OWFS Website: http://owfs.org/

OWFS Protocol Document: http://owfs.org/index.php?page=owserver-protocol

=head1 AUTHOR

Mark Hindess <soft-cpan@temporalanomaly.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Mark Hindess.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 1.178 second using v1.01-cache-2.11-cpan-d7f47b0818f )