org.capi.capi20
Interface Capi

All Known Implementing Classes:
Jcapi

public interface Capi

Capi is the Common ISDN Application Programming Interface (CAPI 2.0) for Java.

© 2002 Holger Gräfe

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Contact to author: holger.graefe@gmx.de

Project website: http://jcapi.sourceforge.net


Method Summary
 void addListener(int appID, CapiListener listener)
          adds the given reference to a List of CapiListeners that will be notified of CapiEvents for the given application ID.
 CapiMessage createMessage(byte[] msg)
          constructs a new CapiMessage object from a binary message.
 CapiMessage createMessage(int appID, int type, int number)
          constructs a new CapiMessage object.
 java.lang.String getImplementationInfo()
          returns an information about the used implementation of this interface.
 java.lang.String getManufacturer()
          CAPI 2.0 equivalent: CAPI_MANUFACTURER.
 java.lang.String getManufacturer(int controller)
          CAPI 2.0 equivalent: CAPI_MANUFACTURER.
 CapiMessage getMessage(int appID)
          CAPI 2.0 equivalent: CAPI_GET_MESSAGE.
 int getNumberOfControllers()
          CAPI 2.0 equivalent: CAPI_GET_PROFILE with parameter 0.
 byte[] getProfile(int controller)
          CAPI 2.0 equivalent: CAPI_GET_PROFILE with parameter <>0.
 java.lang.String getSerialNumber()
          CAPI 2.0 equivalent: CAPI_GET_SERIAL_NUMBER.
 java.lang.String getSerialNumber(int controller)
          CAPI 2.0 equivalent: CAPI_GET_SERIAL_NUMBER.
 int[] getVersion()
          CAPI 2.0 equivalent: CAPI_GET_VERSION.
 int[] getVersion(int conrtoller)
          CAPI 2.0 equivalent: CAPI_GET_VERSION.
 boolean installed()
          CAPI 2.0 equivalent: CAPI_INSTALLED.
 void putMessage(CapiMessage msg)
          CAPI 2.0 equivalent: CAPI_PUT_MESSAGE.
 int register(int maxcon, int maxblocks, int maxlen)
          CAPI 2.0 equivalent: CAPI_REGISTER.
 int register(int bufsize, int maxcon, int maxblocks, int maxlen)
          CAPI 2.0 equivalent: CAPI_REGISTER.
 void release(int appID)
          CAPI 2.0 equivalent: CAPI_RELEASE.
 void removeListener(int appID, CapiListener listener)
          removes a CapiListener previously added with addListener().
 void waitForSignal(int appID)
          CAPI 2.0 equivalent: CAPI_WAIT_FOR_SIGNAL.
 

Method Detail

getImplementationInfo

public java.lang.String getImplementationInfo()
returns an information about the used implementation of this interface.
Returns:
the description of the current implementation

addListener

public void addListener(int appID,
                        CapiListener listener)
adds the given reference to a List of CapiListeners that will be notified of CapiEvents for the given application ID.
Parameters:
appID - the application identification number assigned by register()

removeListener

public void removeListener(int appID,
                           CapiListener listener)
removes a CapiListener previously added with addListener().
Parameters:
appID - the application identification number assigned by register()

createMessage

public CapiMessage createMessage(int appID,
                                 int type,
                                 int number)
                          throws CapiException
constructs a new CapiMessage object.
Parameters:
appID - the application identification number assigned by register()
type - the message type, which correspond with the CAPI message fields "command" and "subcommand"
number - the identification number of this message
Returns:
the new CapiMessage object

createMessage

public CapiMessage createMessage(byte[] msg)
                          throws CapiException
constructs a new CapiMessage object from a binary message. Memory pointers (Data, Data handle) are not evaluated, but stored.
Parameters:
msg - the binary CAPI 2.0 message
Returns:
the new CapiMessage object

register

public int register(int maxcon,
                    int maxblocks,
                    int maxlen)
             throws CapiException
CAPI 2.0 equivalent: CAPI_REGISTER.
Parameters:
maxcon - the maximum number of logical connections
maxblocks - the maximum number of received data blocks
maxlen - the maximum size of data block to be transmitted and received
Returns:
an unique identification number for this application

register

public int register(int bufsize,
                    int maxcon,
                    int maxblocks,
                    int maxlen)
             throws CapiException
CAPI 2.0 equivalent: CAPI_REGISTER.
Parameters:
bufsize - the size of the buffer, typical bufsize = 1024 + (1024 * maxcon)
maxcon - the maximum number of logical connections
maxblocks - the maximum number of received data blocks
maxlen - the maximum size of data block to be transmitted and received
Returns:
an unique identification number for this application

release

public void release(int appID)
             throws CapiException
CAPI 2.0 equivalent: CAPI_RELEASE.
Parameters:
appID - the application identification number assigned by register()

putMessage

public void putMessage(CapiMessage msg)
                throws CapiException
CAPI 2.0 equivalent: CAPI_PUT_MESSAGE.
Parameters:
appID - the application identification number assigned by register()
msg - the CapiMessage to be sent to the CAPI

getMessage

public CapiMessage getMessage(int appID)
                       throws CapiException
CAPI 2.0 equivalent: CAPI_GET_MESSAGE.
Parameters:
appID - the application identification number assigned by register()
Returns:
the CapiMessage received by the CAPI

waitForSignal

public void waitForSignal(int appID)
                   throws CapiException
CAPI 2.0 equivalent: CAPI_WAIT_FOR_SIGNAL.
Parameters:
appID - the application identification number assigned by register()

installed

public boolean installed()
                  throws CapiException
CAPI 2.0 equivalent: CAPI_INSTALLED.

This method always returns a true value or even throws an exception if CAPI 2.0 is not installed correctly.

Returns:
true if CAPI 2.0 is installed and ready

getManufacturer

public java.lang.String getManufacturer()
                                 throws CapiException
CAPI 2.0 equivalent: CAPI_MANUFACTURER.
Returns:
the manufacturer identification of the underlying CAPI 2.0 (and probably of the device)

getManufacturer

public java.lang.String getManufacturer(int controller)
                                 throws CapiException
CAPI 2.0 equivalent: CAPI_MANUFACTURER.
Parameters:
controller - the number of the controller requested
Returns:
the manufacturer identification of the underlying CAPI 2.0 (and probably of the device)

getVersion

public int[] getVersion()
                 throws CapiException
CAPI 2.0 equivalent: CAPI_GET_VERSION.
Returns:
an array of four integers: major CAPI version (should be 2), minor CAPI version (should be 0), major and minor manufacturer version

getVersion

public int[] getVersion(int conrtoller)
                 throws CapiException
CAPI 2.0 equivalent: CAPI_GET_VERSION.
Parameters:
controller - the number of the controller requested
Returns:
an array of four integers: major CAPI version (should be 2), minor CAPI version (should be 0), major and minor manufacturer version

getSerialNumber

public java.lang.String getSerialNumber()
                                 throws CapiException
CAPI 2.0 equivalent: CAPI_GET_SERIAL_NUMBER.
Returns:
the serial number coded as a String

getSerialNumber

public java.lang.String getSerialNumber(int controller)
                                 throws CapiException
CAPI 2.0 equivalent: CAPI_GET_SERIAL_NUMBER.
Parameters:
controller - the number of the controller requested
Returns:
the serial number coded as a String

getNumberOfControllers

public int getNumberOfControllers()
                           throws CapiException
CAPI 2.0 equivalent: CAPI_GET_PROFILE with parameter 0.
Returns:
the number of installed controllers

getProfile

public byte[] getProfile(int controller)
                  throws CapiException
CAPI 2.0 equivalent: CAPI_GET_PROFILE with parameter <>0.
Parameters:
controller - the number of the controller; a value of 0 may cause an exception
Returns:
a byte array holding the profile of the requested controller