Chapter 3: Creating the Modem Dialer Application


The Java Communication Application Programming Interface (JCA) supports the javax.comm package. This package provides the CommPort and ParallelPort classes to obtain a list of the ports on a computer. In addition, the javax.comm package enables you to use the DataInputStream and PrintStream classes of the java.io package to send data to and receive data from the Serial port.

This chapter explains how to develop a Modem Dialer application that uses javax.comm to communicate with a modem attached to a computer and make a phone call to a specified number.

Architecture of the Modem Dialer Application

The Modem Dialer application lists all the serial and parallel ports of a computer. The application also allows an end user to select a port to which the modem is connected and make a phone call to a specified number using the modem.

Note

The Modem Dialer application created in this chapter uses the Serial port for the modem.

The Modem Dialer application uses the following files:

  • PortModem.java: Creates the user interface of the Modem Dialer application. The end user can use this user interface to specify a phone number.

  • PortChooser.java: Creates a user interface in which an end user can select the port to which the modem is connected.

Figure 3-1 shows the architecture of the Modem Dialer application:

click to expand: this figure shows the sequence in which the modem dialer application uses the portmodem.java and portchooser.java files.
Figure 3-1: The Architecture of the Modem Dialer Application

The PortModem.java file invokes the PortChooser.java file when the end user selects the Browse button to select the port to which the modem is connected from the user interface of the Modem Dialer application.




Developing Applications Using JCA
Developing Applications Using JCA
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 43

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net