org.globalse.arena.sword.hci
Class HMTConnector

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.globalse.arena.sword.hci.HMTConnector

public class HMTConnector
extends java.lang.Thread

HMTConnector.java

Class to connect HMT to the system.

The class is to be used as interface between java SWORD engine and C external head motion tracker driver. Executes as a thread.

Usage: create instance of the class, then run it. Make sure that C part of the driver is running before you instantiate this class. Else no tracker will be found. To terminate, call a terminateHmt() method of this class.

Author: TU-Muenchen. Lehrstuhl Softwaretechnik.

Implementation: Petr Ossipov

See also: Low Level C driver documentation.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HMTConnector(boolean connect)
          Constructor for HMT.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adding of Action Listener for HMT.
protected  boolean createControlConnection()
          Opens control connection to the tracker.
protected  boolean createDataConnection()
          opens data connection to the tracker.
 void removeActionListener(java.awt.event.ActionListener l)
          Remove Action Listener from HMT.
 void run()
          Starts the thread for actual running.
protected  void shutDownControlConnection()
          Closes data connection to the tracker.
protected  void shutDownDataConnection()
          Closes data connection to the tracker.
 void terminateHmt()
          Terminates the head motion tracker driver, if present.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HMTConnector

public HMTConnector(boolean connect)
Constructor for HMT. Used to provide connecting interface for the Head motion tracker.
Parameters:
connect - - if head motion tracker should be used - ignored actually. Automated detection is used.
See Also:
Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adding of Action Listener for HMT. Adding an ActionListener for notification.
Parameters:
listener - - object implementing ActionListener

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Remove Action Listener from HMT. Removal af ActionListener from notification list.
Parameters:
listener - - object implementing ActionListener

run

public void run()
Starts the thread for actual running. Starts thread. If tracker was not detected, Thread terminates automatically. If Tracker is present, thread lives, and uses the event mechanism to notify all Action Listeners registered when notification is recieved on status update.
Overrides:
run in class java.lang.Thread

terminateHmt

public void terminateHmt()
Terminates the head motion tracker driver, if present. Actually sets a boolean variable inside of the class, which is used as a thread loop condition. It causes Thread to send the terminate signal to the tracker driver, close all connections and die.

createDataConnection

protected boolean createDataConnection()
opens data connection to the tracker. Do not use it - use constructor and run() instead. Returns true if creation of data connection was sucess, and false if opening a socket caused an exception.

createControlConnection

protected boolean createControlConnection()
Opens control connection to the tracker. Do not use it - use constructor and run() instead. Returns true if creation of control connection was sucess, and false if opening a socket caused an exception.

shutDownDataConnection

protected void shutDownDataConnection()
Closes data connection to the tracker. Do not use it - use terminateHmt() instead.

shutDownControlConnection

protected void shutDownControlConnection()
Closes data connection to the tracker. Do not use it - use terminateHmt() instead.



This page is hosted by the Chair for Applied Software Engineering of the Technische Universität München.
Imprint (Impressum)