Phidgets
Class PhidgetAccelerometer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Phidgets.Phidget
              |
              +--Phidgets.PhidgetAccelerometer
All Implemented Interfaces:
java.lang.Runnable

public class PhidgetAccelerometer
extends Phidget

Author:
Patrick McNeil

The class PhidgetAccelerometer represents a Phidget Accelerometer. All methods to read acceleration data from an accelerometer are implemented in this class.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PhidgetAccelerometer()
          Create a new uninitialized PhidgetAccelerometer
 
Method Summary
 void add_IPhidgetAccelerometerEventsListener(_IPhidgetAccelerometerEvents l)
          Sets up the event handlers
 double GetAcceleration(int Index)
          Gets the acceleration of a particular axis
 double GetAccelerationChangeTrigger(int Index)
          Gets the change trigger for an Axis
 int GetNumAxis()
          Gets the number of accelerometer axes
 int OpenRemote(int serverSerial, int port, int serialNumber, java.lang.String pass)
          Open the device when it is on the local network.
 int OpenRemoteIP(java.lang.String ip, int port, int serialNumber, java.lang.String pass)
          Open the device when it is on a remote network.
 void remove_IPhidgetAccelerometerEventsListener()
          Removes the events handlers
 void SetAccelerationChangeTrigger(int Index, double newVal)
          Sets the change trigger for an Axis.
 
Methods inherited from class Phidgets.Phidget
Close, equals, GetDeviceType, GetDeviceVersion, GetIsAttached, GetSerialNumber, GetServerAddress, GetServerID, GetServerPort, run, setDeviceType, setDeviceVersion, setSerialNumber
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PhidgetAccelerometer

public PhidgetAccelerometer()
Create a new uninitialized PhidgetAccelerometer
Method Detail

OpenRemote

public int OpenRemote(int serverSerial,
                      int port,
                      int serialNumber,
                      java.lang.String pass)
Open the device when it is on the local network. This uses a UDB broadcast to find the server with a specified serial number, so you don't need to know it's IP address, but only works on internal networks where broadcasting is allowed
Parameters:
serverSerial - Serial number of the server, or -1 for any serial
port - Server port
serialNumber - Serial number of the device or -1 for any serial
pass - Server password
Returns:
0 on success

OpenRemoteIP

public int OpenRemoteIP(java.lang.String ip,
                        int port,
                        int serialNumber,
                        java.lang.String pass)
Open the device when it is on a remote network. Use this when OpenRemote fails, such as opening Phidgets over the internet. You need to know the IP address here.
Parameters:
ip - IP address or hostname of the server
port - Server port
serialNumber - Serial number of the device or -1 for any serial
pass - Server password
Returns:
0 on success

GetNumAxis

public int GetNumAxis()
Gets the number of accelerometer axes
Returns:
Number of Axes

GetAcceleration

public double GetAcceleration(int Index)
Gets the acceleration of a particular axis
Parameters:
Index - Axis
Returns:
Acceleration

GetAccelerationChangeTrigger

public double GetAccelerationChangeTrigger(int Index)
Gets the change trigger for an Axis
Parameters:
Index - Axis
Returns:
Change trigger

SetAccelerationChangeTrigger

public void SetAccelerationChangeTrigger(int Index,
                                         double newVal)
Sets the change trigger for an Axis. This is the difference in acceleration that must appear between succesive calls to the OnAccelerationChange event handler.
Parameters:
Index - Axis
newVal - Change triger

add_IPhidgetAccelerometerEventsListener

public void add_IPhidgetAccelerometerEventsListener(_IPhidgetAccelerometerEvents l)
Sets up the event handlers
Parameters:
l - An object implementing the _IPhidgetAccelerometerEvents interface

remove_IPhidgetAccelerometerEventsListener

public void remove_IPhidgetAccelerometerEventsListener()
Removes the events handlers