|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.co.keang.callerid.driver.CallSimulator
public class CallSimulator
Simulates incoming phone calls.
This will always wait at least 200 mSec between sending a series of call data streams.
The simulator is used in system testing and does not require the hardware to be attached. You can create a simulator with a random set of phone numbers or you can give it a list of phone numbers to simulate calls from. ie
// create an array of phone numbers to call where 'null' is number withheld
String[] nums = new String[] {null, "01482571234", "01482576666", "01482571111", "01482570000", "01482575555", "01482578888"};
CallSimulator sim = new CallSimulator(nums);
callerID = new CTICallerID(sim);
callerID.addCallerIDListener(new ICallerIDListener()
{
public void incomingCall(CallerIDEvent event)
{
// Handle incoming calls
}
public void callerIDException(Exception e)
{
// Handle any exceptions caught by the driver
}
});
// call a random number from the supplied list
sim.callRandomNumber();
Constructor Summary | |
---|---|
CallSimulator()
A simulator with 10 random phone numbers |
|
CallSimulator(int n)
A simulator with the given number of random phone numbers |
|
CallSimulator(java.lang.String[] nums)
A simulator with the given list of phone numbers |
|
CallSimulator(java.lang.String[] nums,
long initialDelay,
long repeatDelay)
A simulator with the given list of phone numbers that automatically calls them in order |
|
CallSimulator(java.lang.String[] nums,
long initialDelay,
long repeatDelay,
java.util.TimerTask task)
A simulator with the given list of phone numbers that automatically runs the task at the specified frequency |
Method Summary | |
---|---|
void |
callNextNumber()
Simulates a call from the next number in the list |
void |
callNumber(java.lang.String num)
Simulates a call from the given number |
void |
callNumberWithHeld()
Simulates a call from a number withheld |
void |
callRandomNumber()
Simulates a call from a random number from the list |
void |
close()
Closes the streams |
(package private) java.io.PipedInputStream |
getInputStream()
Gets the input stream that will contain the caller ID data |
void |
sendBadChecksum()
Sends a corrupted data stream, ie one with a bad checksum |
void |
sendTruncated()
Sends a short data stream, ie one which is missing part of the data |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CallSimulator()
public CallSimulator(int n)
public CallSimulator(java.lang.String[] nums)
nums
- the telephone numberspublic CallSimulator(java.lang.String[] nums, long initialDelay, long repeatDelay)
nums
- the telephone numbersinitialDelay
- the time to wait before firing any eventsrepeatDelay
- the time to wait between eventspublic CallSimulator(java.lang.String[] nums, long initialDelay, long repeatDelay, java.util.TimerTask task)
nums
- the telephone numbersinitialDelay
- the time to wait before firing any eventsrepeatDelay
- the time to wait between eventstask
- the task to runMethod Detail |
---|
java.io.PipedInputStream getInputStream()
public void callNextNumber()
public void callRandomNumber()
public void callNumber(java.lang.String num)
num
- the number to callpublic void callNumberWithHeld()
public void sendBadChecksum()
public void sendTruncated()
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |