⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 device.java

📁 著名的dialogic电话语音卡的java驱动程序,已经验证可用。
💻 JAVA
字号:
// local.dialogic.Device interface
// $Id: Device.java,v 2.6 2001/07/12 23:49:07 tron Exp tron $
/* 
 * 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 abstract class Device extends java.lang.Object {
    // Variables
    static private java.util.Vector deviceAtDev;   // Class instances
    protected int device;
    protected String name;
    protected Channel channel = null;
    
    static {
        deviceAtDev = new java.util.Vector(5,4);
    }
    
    public static Device atDev(int dev) {
        if (dev != 0 && dev < deviceAtDev.size())
            return (Device)deviceAtDev.elementAt(dev);
        else
            return null;
    }
    
    public Device(Channel channel, String name)
    {
        this.channel = channel;
        this.name = name;
    }

    public void finalize() throws Throwable 
    {
        close();
        super.finalize();
    }
    
    protected void register()
    {
        if (device != 0) {
            if (deviceAtDev.size() <= device)
                deviceAtDev.setSize(device + 1);
            deviceAtDev.setElementAt(this, device);
            if (channel != null)
                channel.register(this);
        }
    }
    
    public void close() 
    {
        if (device != 0)
            deviceAtDev.setElementAt(null, device);
        if (channel != null)
            channel.unregister(this);
    }

    public boolean source(EVT evt) 
    { 
        return evt.dev == device;
    }
    
    public abstract int getTs();
    public abstract void listen(Device source);
    public abstract void listen(Channel aChannel, Resource resource);

    public String toString() {
        return name + "/" + device;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -