Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cnrg.itx.gtwy
Class ChannelControl

    java.lang.Object
      |
      +--cnrg.itx.gtwy.ChannelControl

public class ChannelControl
extends java.lang.Object

This is the building block interface between a class and a Gateway channel hardware control. NOTE: This accesses the native C code

Constructor Summary
`ChannelControl()`

Method Summary
`protected void` | `channelOffHook(int chDev)` Sets the channel off hook to allow for passing voice data through.
`protected void` | `channelOnHook(int chDev)` Sets the channel on hook.
`protected int` | `channelSetUp(int channelNum, int xferFactor)` Used for channel initialization.
`protected boolean` | `dialPhone(java.lang.String digits, int chDev)` Dials a phone.
`protected void` | `endPlayConnection(int lineNumber)` Stops audio playout from computer to phone
`protected void` | `endRecordConnection(int lineNumber)` Terminates the data flow from phone to computer.
`protected java.lang.String` | `getExtension(int chDev, boolean isSecondTime)` This is where the channel gets the phone's requested extension number.
`protected void` | `initialize(int numLines, int bufferSize, int dataSize, int pXferFactor)` Initializes parameters in the .cpp file.
`protected void` | `playDTMF(java.lang.String digits, int chDev)` Plays DTMF tones to the telephone connected to the line.
`protected void` | `playPacket(int chDev, int lineNumber)` Plays voice data from a buffer to a phone.
`protected java.lang.String` | `recordPacket(RecordSource dataChannel, int chDev, int lineNumber)` Sends voice data from phone to computer.
`protected void` | `rejectCallMessage(int chDev)` Plays out a message to a phone when a call has been rejected.
`protected void` | `reroute(int chDev, int secDev)` Reroutes the second channel's playout to the primary channel's playout.
`protected void` | `resetPlaySequence(int lineNumber, boolean isStartCall)` Resets handlers for a playout on a phone.
`protected void` | `resetRecordSequence(int lineNumber, boolean isStartCall)` Resets handlers for sending data from phone to computer.
`protected void` | `shutDown(int[] chDevArray)` Closes all Gateway channels and cleans up memory.
`protected void` | `unroute(int chDev)` "Releases" the second channel from playing out on the primary channel.
`protected void` | `waitForCall(int chDev)` Sets up the channel to wait for a phone to dial in.
`protected void` | `writeToPlay(int lineNumber, byte[] data)` Writes voice data from computer to buffers in native code.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ChannelControl

    public ChannelControl()

Method Detail

### initialize

    protected void initialize(int numLines,
                              int bufferSize,
                              int dataSize,
                              int pXferFactor)

  Initializes parameters in the .cpp file. Called when Gateway starts.
  Parameters:
    `numLines` - the number of lines in the gateway.
    `bufferSize` - the packet transfer rate between the gateway and phone.
    `dataSize` - the packet transfer rate of data exchange.
    `pXferFactor` - factor bufferSize is multiplied by to define size of packets played to phone.
  See Also:
    `Gateway#Gateway(boolean)`

### shutDown

    protected void shutDown(int[] chDevArray)

  Closes all Gateway channels and cleans up memory. Called at termination of the Gateway.
  Parameters:
    `chDevArray` - array of all channel device handlers.

### channelSetUp

    protected int channelSetUp(int channelNum,
                               int xferFactor)

  Used for channel initialization. Called during the initialization of the Gateway.
  Parameters:
    `channelNum` - the channel's designated number.
    `xferFactor` - to be multiplied with the packet transfer rate. Meant to increase transfer rate if desired.
  Returns:
    the channel's device handler.
  See Also:
    `Gateway#Gateway(boolean)`

### reroute

    protected void reroute(int chDev,
                           int secDev)

  Reroutes the second channel's playout to the primary channel's playout. Necessary for a full duplex connection.
  Parameters:
    `chDev` - the primary channel's device handler.
    `secDev` - the second channel's device handler. This channel is responsible for playout.
  See Also:
    `Gateway.setUpConnection(Line, Connection)`

### unroute

    protected void unroute(int chDev)

  "Releases" the second channel from playing out on the primary channel.
  Parameters:
    `chDev` - the primary channel's device handler.

### channelOnHook

    protected void channelOnHook(int chDev)

  Sets the channel on hook. Channel is available to receive incoming calls from a phone.
  Parameters:
    `chDev` - the channel's device handler.

### channelOffHook

    protected void channelOffHook(int chDev)

  Sets the channel off hook to allow for passing voice data through.
  Parameters:
    `chDev` - the channel's device handler.
  See Also:
    `Gateway.setUpConnection(Line, Connection)`

### waitForCall

    protected void waitForCall(int chDev)

  Sets up the channel to wait for a phone to dial in.
  Parameters:
    `chDev` - the channel's device handler.
  See Also:
    `ListenChannel.run()`

### getExtension

    protected java.lang.String getExtension(int chDev,
                                            boolean isSecondTime)

  This is where the channel gets the phone's requested extension number. Number corresponds with whomever phone user wishes to contact.
  Parameters:
    `chDev` - the channel's device handler.
    `isSecondTime` - true if this is not the first call to getExtension during session.
  Returns:
    the extension number.
  See Also:
    `ListenChannel.run()`

### rejectCallMessage

    protected void rejectCallMessage(int chDev)

  Plays out a message to a phone when a call has been rejected.
  Parameters:
    `chDev` - the channel's device handler.
  See Also:
    `ListenChannel.run()`

### dialPhone

    protected boolean dialPhone(java.lang.String digits,
                                int chDev)

  Dials a phone. Returns as soon as the phone starts ringing or something goes wrong.
  Parameters:
    `digits` - the phone number being dialed.
    `chDev` - the channel's device handler.
  Returns:
    true if phone rings; false if something went wrong or the phone is busy.
  See Also:
    `Gateway.dialPhone(String, Line)`

### playDTMF

    protected void playDTMF(java.lang.String digits,
                            int chDev)

  Plays DTMF tones to the telephone connected to the line.
  Parameters:
    `digits` - the DTMF digits being played.
    `chDev` - the channel's device handler.
  See Also:
    `Gateway.playDTMF(String, Line, Connection)`

### recordPacket

    protected java.lang.String recordPacket(RecordSource dataChannel,
                                            int chDev,
                                            int lineNumber)

  Sends voice data from phone to computer.
  Parameters:
    `dataChannel` - the object whose methods are used to send data to a PC.
    `chDev` - the channel's device handler.
    `lineNumber` - the channel's corresponding line number.
  Returns:
    any DTMF digits that were pressed during recording or an indication of a hangup.
  See Also:
    `RecordChannel.run()`

### playPacket

    protected void playPacket(int chDev,
                              int lineNumber)

  Plays voice data from a buffer to a phone.
  Parameters:
    `chDev` - the channel's device handler.
    `lineNumber` - the channel's corresponding line number.
  See Also:
    `PlayChannel.run()`

### writeToPlay

    protected void writeToPlay(int lineNumber,
                               byte[] data)

  Writes voice data from computer to buffers in native code. `playPacket` plays out the data in the buffers.
  Parameters:
    `lineNumber` - the line's designated number.
    `data` - the data being sent.
  See Also:
    `playPacket(int, int)`, `PlayDestination.write(byte[])`

### resetRecordSequence

    protected void resetRecordSequence(int lineNumber,
                                       boolean isStartCall)

  Resets handlers for sending data from phone to computer. Handlers are set to designate that the connection is still alive.
  Parameters:
    `lineNumber` - the channel's corresponding line number.
    `isStartCall` - true if this is the beginning of a connection session; false otherwise.

### resetPlaySequence

    protected void resetPlaySequence(int lineNumber,
                                     boolean isStartCall)

  Resets handlers for a playout on a phone. Handlers are set to designate that playout is still active.
  Parameters:
    `lineNumber` - the channel's corresponding line number.
    `isStartCall` - true if this is the beginning of a connection session; false otherwise.

### endRecordConnection

    protected void endRecordConnection(int lineNumber)

  Terminates the data flow from phone to computer.
  Parameters:
    `lineNumber` - the channel's corresponding line number.

### endPlayConnection

    protected void endPlayConnection(int lineNumber)

  Stops audio playout from computer to phone
  Parameters:
    `lineNumber` - the channel's corresponding line number.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD