uk.co.keang.callerid.driver
Class CTICallerID

java.lang.Object
  extended by uk.co.keang.callerid.driver.CTICallerID
All Implemented Interfaces:
java.io.Closeable

public class CTICallerID
extends java.lang.Object
implements java.io.Closeable

Provides an interface to Crucible Technologies (CTI) Comet USB Caller ID hardware.
Once closed the connection can not be re-opened, a new CTICallerID object must be created.

Note: The "findcomet.exe" application provided by CTI must be placed in the current working directory if you want to be able to find the port(s) the hardware is attached to

Interfacing to a single hardware device is as simple as:

 
    CTICallerID callerID = new CTICallerID();
    callerID.addCallerIDListener(new ICallerIDListener()
              {
              public void incomingCall(CallerIDEvent event)
                  {
                  // Handle incoming calls
                  }

              public void callerIDException(Exception e)
                  {
                  // Handle any exceptions caught by the driver
                  }
              });
 
 

Version:
1.0 - 15 Jan 2014
Author:
Keang

Constructor Summary
CTICallerID()
          Creates a caller ID interface for hardware on the first port that has hardware attached
CTICallerID(CallSimulator sim)
          Creates a Caller ID interface running from a phone call simulator.
CTICallerID(java.lang.String comPort)
          Creates a caller ID interface for hardware on the given port
 
Method Summary
 void addCallerIDListener(ICallerIDListener listener)
          Adds an CallerID listener.
 void close()
          Closes the serial connection to the CTI hardware and removes all listeners
static java.lang.String[] findCometPorts()
          Finds the port(s) CTI Comet USB Caller ID hardware is attached to.
static void main(java.lang.String[] args)
           
 void removeCallerIDListener(ICallerIDListener listener)
          Removes an CallerID listener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CTICallerID

public CTICallerID()
            throws gnu.io.NoSuchPortException,
                   gnu.io.PortInUseException,
                   gnu.io.UnsupportedCommOperationException,
                   java.io.IOException
Creates a caller ID interface for hardware on the first port that has hardware attached

Throws:
java.io.IOException
gnu.io.UnsupportedCommOperationException
gnu.io.PortInUseException
gnu.io.NoSuchPortException - if auto find failed to identify any ports

CTICallerID

public CTICallerID(java.lang.String comPort)
            throws gnu.io.NoSuchPortException,
                   gnu.io.PortInUseException,
                   gnu.io.UnsupportedCommOperationException,
                   java.io.IOException
Creates a caller ID interface for hardware on the given port

Parameters:
comPort - the com port the hardware is attached to ie COM3
Throws:
java.io.IOException
gnu.io.UnsupportedCommOperationException
gnu.io.PortInUseException
gnu.io.NoSuchPortException

CTICallerID

public CTICallerID(CallSimulator sim)
Creates a Caller ID interface running from a phone call simulator.

This is used for testing purposes only.

Parameters:
sim - the phone call simulator
Method Detail

findCometPorts

public static java.lang.String[] findCometPorts()
Finds the port(s) CTI Comet USB Caller ID hardware is attached to.

Returns:
the ports the hardware is attached to or an empty array if none were found. For a single piece of hardware attached to com port 9 on a windows systems this will be "COM9"

addCallerIDListener

public void addCallerIDListener(ICallerIDListener listener)
Adds an CallerID listener. The listener will be notified of the details all incoming phone calls

Parameters:
listener - the listener to add

removeCallerIDListener

public void removeCallerIDListener(ICallerIDListener listener)
Removes an CallerID listener

Parameters:
listener - the listener to remove

close

public void close()
Closes the serial connection to the CTI hardware and removes all listeners

Specified by:
close in interface java.io.Closeable

main

public static void main(java.lang.String[] args)