package dialer;

/*
 * CommPortModem.java
 *
 * Created on 13 de Junho de 2002, 22:59
 */
import java.io.*;
import javax.comm.*;
import java.util.*;
/**
* Dial a phone using the Java Communications Package.
*
*/
public class CommPortDial extends CommPortModem {

    public CommPortDial(String port)
    throws IOException, NoSuchPortException, PortInUseException,
    UnsupportedCommOperationException {
        super(port);
    }

    protected void converse(String number) throws IOException {
        String resp;// the modem response.
        // Send the reset command
        System.out.println("converse!!!");
        send("ATZ");
        expect("OK");
        System.out.println("discando...");
        send("ATM0DT" + number);
        expect("OK");
        System.out.println("ok");
        try {
            System.out.println("waiting...");
            Thread.sleep(5000);
            System.out.println("finished!!!");
        } catch (InterruptedException e) {
        // nothing to do
        }
        is.close();
        os.close();
    }
}

