Kay Sindre Bærulfsen

NAME

Device::SpaceNavigator - Read data from 3Dconnexion SpaceNavigator

SYNOPSIS

  use Device::SpaceNavigator;

  my $nav = Device::SpaceNavigator->new();

  while ($nav->update()) {
      printf "Pitch:%i / Roll:%i / Yaw:%i X:%i / Y:%i / Z:%i Left button:%s Right button:%s\n",
          $nav->pitch(), $nav->roll(), $nav->yaw(),
          $nav->x(), $nav->y(), $nav->z(),
          $nav->left_button ? 'Pressed' : 'Released',
          $nav->right_button ? 'Pressed' : 'Released';

  }

DESCRIPTION

This module gives you a interface to read values from a connected 3Dconnexion SpaceNavigator. This awsome device has 6 axes; x, y, z, pitch, roll and yaw. In addition, it has two buttons.

METHODS

Device::SpaceNavigator->new()

Creates a new object for reading events from the device. Takes no arguments. Returns a new object.

$nav->open( [ $device ] )

Opens a new socket to the device.

$device The path to the device. Default: /dev/input/by-id/usb-3Dconnexion_SpaceNavigator-event-if00

$nav->close()

Closes the socket.

$nav->update( [ $timeout ] )

Reads and parse event from device. $nav->update() will call open if the socket for some reason is closed.

$timeout Number of secounds $nav->update() should wait for a event from the device before returning.

$nav->x()

Returns the value for the X axe. (3Dconnexion calls this for "Pan left/right")

$nav->y()

Returns the value for the Y axe (Zoom).

$nav->z()

Returns the value for the Z axe (Pan up/down).

$nav->pitch()

Returns the value for the pitch (Tilt).

$nav->roll()

Returns the value for the roll.

$nav->yaw()

Returns the value for yaw (spin).

$nav->left_button()

Returns the state of the left button.

$nav->right_button()

Returns the state of the right button.

AUTHOR

Kay Bærulfsen, <kaysb@cpan.org>

COPYRIGHT AND LICENSE

'SpaceNavigator' is a trademark of 3Dconnexion.

Copyright (C) 2010 by Kay Bærulfsen, <kaysb@cpan.org>

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