Modem Manager API

If you are writing a custom driver to accept incoming modem calls, then you must use the Modem Manager interface. Fundamental tasks include:

Register a modem

You must call the Modem Manager's Register subroutine, passing the driver's discriminator object value, its station number, and a priority relative to other drivers. Here is a sample call with a priority setting of 10:

\ModemManager\Register(Root, Station, 10 { Priority });

Unregister a modem

If a driver needs to change its Station address, it must first unregister. You must call the Modem Manager's Unregister subroutine, passing the driver's discriminator object value, and the station number with which it previously registered.

\ModemManager\Unregister(Discriminator, Station);

Provide a discriminator subroutine

You must provide a discriminator subroutine. The Modem Manager will call this subroutine when it offers you an incoming call. The Modem Manager passes a BUFFER as a parameter. This Buffer contains the initial data received from the line (see HelloPacketLength). You should parse this data and decide whether your driver supports it, and for which STATION it is intended.

  • Return INVALID to reject this call.
  • Return a valid STATION number to accept the call.
  • If you accept the call, then the Port\IsConnected() module will go true. You can then obtain the serial port semaphore \PortManager.PortConnectSem to read and write data via the serial port.
  • If Port\IsConnected() becomes false, the call has been disconnected.
  • If you wish to hang up the call, call the subroutine Port\CallComplete().

Monitor call progress

The Port\DataPort variable is VALID if a call is being setup or is active. At all other times, it is INVALID. During call setup, the value is a SHORT INTEGER indicating the progress of the call, changing to a STREAM when the call connects (this is what IsConnected() indicates).

Log events

If required, you may insert entries into the Modem Manager's event log. To do this, call the EventLog subroutine as follows:

\ModemManager\EventLog("Text message to be logged");

You should set the application property ModemManagerLogSize to at least 256. Failing to do so will result in the loss of all logging events that occur prior to the first display of the event log.