📄 tapicall.java
字号:
/*
* JTAPI library copyright 1998 by Web4Groups consortium (http://Web4Groups.at)
*/
import java.telephony.capabilities.CallCapabilities;
import java.telephony.*;
import java.telephony.events.*;
import java.util.*;
class TAPICall implements Call{
Vector observers;
int state;
KapschProvider provider;
ArrayVector tapiConnections;
TAPICall(KapschProvider provider){
observers = new Vector();
this.provider = provider;
tapiConnections = new ArrayVector();
state = Call.IDLE;
}
/* implementation specific */
void addConnection(Connection connection) { //needed for incoming calls
if (connection != null)
tapiConnections.addElement(connection);
}
/* implementation specific */
void removeConnection(Connection connection) {
if (connection != null)
tapiConnections.removeElement(connection);
}
public synchronized void addObserver(CallObserver observer){
if(observer!=null)
observers.addElement(observer);
}
public synchronized CallObserver[] getObservers(){
CallObserver data[]=null;
int s=observers.size();
data=new CallObserver[s];
int i;
for(i=0;i<s;i++)
data[i]=(CallObserver)observers.elementAt(i);
return data;
}
public synchronized void removeObserver(CallObserver observer){
if(observer!=null)
observers.removeElement(observer);
}
public Connection[] connect(Terminal origterm, Address origaddr, String dialedDigits) throws InvalidStateException {
int s = provider.getState();
if (s != Provider.IN_SERVICE)
throw new InvalidStateException(provider, InvalidStateException.PROVIDER_OBJECT, s);
if (state != IDLE)
throw new InvalidStateException(this, InvalidStateException.CALL_OBJECT, state);
state = ACTIVE;
TAPIConnection[] tc = new TAPIConnection[2];
addConnection(tc[0]);
addConnection(tc[1]);
return tc;
}
public Connection[] getConnections() throws InvalidStateException {
int s = provider.getState();
if (s != Provider.IN_SERVICE)
throw new InvalidStateException(provider, InvalidStateException.PROVIDER_OBJECT, s);
Connection ret[] = null;
Object obj[] = tapiConnections.getArray();
if(obj != null){
ret = new Connection[obj.length];
System.arraycopy(obj, 0, ret, 0, obj.length);
}
return ret;
}
public CallCapabilities getCallCapabilities(Terminal terminal, Address address){
return new TAPICallCapabilities();
}
public Provider getProvider(){
return provider;
}
public int getState(){
return state;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -