📄 msiconference.java
字号:
// MSIConference: Manage MSI conferences
// $Id: MSIConference.java,v 1.2 2003/11/13 11:49:19 cgm8 Exp $
/*
* Copyright (c) 1999 Carlos G Mendioroz.
*
* This file is part of D4J.
*
* D4J is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* D4J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Report problems and direct all questions to:
*
* tron@acm.org
*/
package local.dialogic;
public class MSIConference extends Conference
{
// Class variables
private static Conference server;
static {
server = null;
}
/** Open a msi device */
public static void init(String name)
{
// msiBn
if (! name.substring(0, 4).equals("msiB"))
throw new RuntimeException("MSIConference.init: bad name");
int device = Dialogic.ms_open(name, 0);
synchronized(boards) {
boards.put(name, new Integer(device));
}
dsps.setSize(openDsps+1);
dsps.setElementAt(new Integer(device), openDsps++);
}
public MSIConference() {
this(NOBEEP, NODIGITS);
}
public MSIConference(int attributes, int digitMask) {
super(attributes,digitMask);
}
synchronized void _add(CDT cdt) {
int attributes = cdt.chan_attr;
if (members.size() < 1)
return;
if (conf < 0) {
CDT cdts[] = new CDT[2];
cdts[0] = (CDT)members.elements().nextElement();
cdts[1] = cdt;
int attr0 = cdts[0].chan_attr;
// Create
conf = Dialogic.ms_estconf(dsp, cdts, attr);
cdts[0].chan_lts = cdts[0].chan_attr;
cdts[0].chan_attr = attr0;
cdt.chan_lts = cdt.chan_attr;
cdt.chan_attr = attributes;
if ((Dialogic.debug & Dialogic.DEBUG_CONFERENCE) != 0)
System.out.println("New MSIconference " + this.toString());
if (active.get(cdts[0].channel) != null)
connect(cdts[0].channel);
} else {
// Add
Dialogic.ms_addtoconf(dsp, conf, cdt);
cdt.chan_lts = cdt.chan_attr;
cdt.chan_attr = attributes;
}
}
public void finalize() throws Throwable
{
close();
super.finalize();
}
public synchronized void close()
{
if (conf >= 0)
Dialogic.ms_delconf(dsp, conf);
if ((Dialogic.debug & Dialogic.DEBUG_CONFERENCE) != 0)
System.out.println("Closed MSIconference " + this.toString());
super.close();
conf = -1;
}
synchronized void _free(CDT cdt) {
if(members.size() == 2) {
// Tier down
Dialogic.ms_delconf(dsp, conf);
if ((Dialogic.debug & Dialogic.DEBUG_CONFERENCE) != 0)
System.out.println("Freed MSIconference " + this.toString());
conf = -1;
} else if (conf >= 0) {
Dialogic.dcb_remfromconf(dsp, conf, cdt);
}
}
public String toString() {
StringBuffer desc = new StringBuffer();
if (conf < 0) {
desc.append("Unestablished MSIConference");
} else
desc.append("MSIConference " + conf);
desc.append(" with "+ members.size() + " (" + attr + ")");
return desc.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -