/* ***************************************************************************+
 * ITX package (cnrg.itx) for telephony application programming.              *
 * Copyright (c) 1999  Cornell University, Ithaca NY                          *
 *                                                                            *
 * 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.                                            *
 *                                                                            *
 * The ITX package 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.                                                          * 
 *                                                                            *
 * A copy of the license is distributed with this package.  Look in the docs  *
 * directory, filename GPL.                                                   *
 *                                                                            * 
 * Contact information:                                                       *
 * Donna Bergmark                                                             *
 * 484 Rhodes Hall                                                            *
 * Cornell University                                                         *
 * Ithaca, NY 14853-3801                                                      *
 * bergmark@cs.cornell.edu                                                    *
 ******************************************************************************/

package cnrg.itx.gtwy;
import cnrg.itx.datax.*;
import cnrg.itx.datax.devices.*;
import cnrg.itx.signal.*;

/**
 * This class controls the second channel in a data connection.  Second channel's only purpose is to send
 * data to the phone.
 * 
 * @author James Wann
 * @version 1.0a
 */
public class PlayChannel implements Runnable
{
	/**
	 * The Line instance corresponding to PlayChannel's line.
	 */
	private Line myLine;
	
	/**
	 * The ChannelControl instance.
	 */
	private ChannelControl myControl;
	
	/**
	 * @param lin the <code>Line</code> instance corresponding to <code>PlayChannel's</code> line.
	 * Contains information regarding that line.
	 * @param cc the <code>ChannelControl</code> instance used to control <code>PlayChannel's</code> 
	 * second channel.
	 * @see Line
	 * @see ChannelControl
	 */
	protected PlayChannel(Line lin, ChannelControl cc)
	{
		myLine = lin;
		myControl = cc;
	}
	
	/**
	 * @see java.lang.Runnable
	 */
	public void run()
	{
		int myLineNumber = myLine.getLineNumber();
		int myChDev = myLine.getSecondDev();
		
		myControl.playPacket(myChDev, myLineNumber);
	}
}