Using a Modem

An application that uses a modem must be able to handle such tasks as dialing the appropriate phone number and breaking the connection when the session is over. To simplify the process of using a modem, Windows CE supports a subset of the Microsoft telephony application programming interface (TAPI), which handles only outbound calls. TAPI provides a set of functions that applications can use to handle the process of making and managing a modem connection, but not the actual transfer of data.

    To make a modem connection using TAPI
  1. Call lineInitialize to initialize TAPI.

    This function returns the number of line devices available. You must provide the name of the callback function that TAPI should use to return data. See TAPI Callback Function.

  2. Call lineOpen to open the line.
  3. Call lineMakeCall.

    When the call is set up, TAPI returns a LINE_REPLY message through the callback function. This message indicates only that the call has been established at the local end, perhaps indicated by a dial tone.

    As the connection process proceeds, TAPI returns a series of LINE_CALLSTATE messages through the callback function indicating the progress of the connection, for example, dialtone and ringing. When the connection is completed, TAPI returns a LINECALLSTATE_CONNECTED message.

    During information transfer, TAPI continues to manage the connection, but the application handles data transmission and reception. When transmission is finished, TAPI returns a LINE_CALLSTATE message, such as one indicating that a remote disconnect has occurred.

  4. Call lineClose to close the line.
  5. Call lineShutdown to terminate the session.