Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

Modem Simulator

Introduction

Qt Extended provides a Modem Simulator, phonesim, to allow testing of telephony applications without the need for access to an actual modem. The simulator provides an AT command channel with responses defined by an XML description.

Note: It is preferred that a fully functioning modem be used where possible as phonesim is a simulated tool and not designed as a total replacement for a functioning modem.

Using the Modem Simulator

The command used to run the Modem Simulator is:

    phonesim [-p port] [-gui] filename

where the default port number is 12345 and filename indicates the XML Response File to be used (usually troll.xml from the src/tools/phonesim source directory).

To use the Qt Extended dialer with the modem simulator, the QTOPIA_PHONE_DEVICE environment variable must be set to sim:hostname, where hostname is the name of the host where the simulator resides. For most implementations this is set to localhost.

The -gui option tells phonesim to display its control GUI when Qt Extended connects to it. This control GUI provides options to simulate calls, send SMS messages, adjust operator registration, etc.

Using the Modem Simulator on the target device

The command used to run the Modem Simulator is:

    phonesim_target [-p port] filename

where filename has the same meaning as stated in the previous paragraph.

Special Phone Numbers

The Modem Simulator utilizes the following special phone numbers to simulate events:

Phone NumberFunction
199Initiate a Dial Back, that is, the simulator will immediately hang-up and then dial the user back after a delay of 5 seconds. This is used to test incoming connections in a single-user environment.
1993Same as 199, but use a delay of 30 seconds.
177Dials back after 2 seconds, but then hangs up after waiting 5 seconds for the call to be accepted. This is used to simulate an incoming call that does not connect.
166Same as 177, but dials back after 1 second and hangs up after 4.
155Immediately responds with BUSY to indicate that the call could not be connected to the other party due to them being busy.
12399Simulates a call control event of "allowed".
12388Simulates a call control event of "allowed with modifications". The number will modified to 12389.
12377Simulates a call control event of "disallowed".

GSM 07.10 Multiplexing

The Modem Simulator includes support for GSM 07.10 multiplexing, which is started using the AT+CMUX command. It will be activated as soon as Qt Extended sends this command to the simulator. Up to 63 channels are supported, using the basic GSM 07.10 multiplexing mode and any valid GSM 07.10 packet size. Advanced mode is not supported.

XML Response File Format

Modem Simulator responses are defined by an XML file (for example, troll.xml) with the following format:

tagdescription
<simulator>Root element for the XML document.
<state name="X">Define commands that only apply in a specific state.
<chat>(child of top-level or <state>) Define a chat command/response sequence. A top-level <chat> applies to all states unless there is a state-specific override.
<command>(child of <chat>) Contains the text of the command to respond to. The wildcard character "*" at the end of the text can be used to match everything starting with a specific prefix.
<response delay="N" eol="true|false">(child of <chat>) Contains the text of the response, with an optional delay prior to sending it back to the client. The delay is in milliseconds. The sequence "${X}" can be used in a response to indicate "substitute the value of script variable X". If "eol" is "true" (the default), then the response will be followed by an end-of-line sequence.
<switch name="X"/>(child of <chat>) Switch into the specified state after issuing the response. An unspecified state name indicates to return to the top-level state. The name "default" can be used to switch back to the default state.
<unsolicited delay="N" switch="X" [once="true"]>(child of top-level or <state>) Indicates an unsolicited response to issue to the client after "N" milliseconds after switching into the current state. The optional "switch" tells the simulator to enter the specified state after sending the unsolicited response (e.g. an unsolicited RING may put the simulator into a different state from the default). The sequence "${X}" can be used in a response to indicate "substitute the value of script variable X". If once="true" is supplied, then the unsolicited command will only be issued once, not every time the current state is entered.
<set name="X" value="Y"/>(child of top-level or <chat>) When used at the top level, this sets the default value of a script variable called "X" to "Y". When used within a <chat> element, this will set the value of the script variable "X" when the <chat>'s command is successfully matched. The value "*" can be used for the "*" part of a prefix command match. This allows parameter information to be copied from a command into a variable.
<start name="X"/>Starting state, if not the same as the top-level state.
<phonebook name="XX" size="N">Define the phonebook called XX to have a size of N entries. Each entry is defined by an <entry> tag.
<entry index="IDX" number="NUM" name="NAME"/>Define an entry in the surrounding <phonebook> definition.

SIM Application Toolkit Support

Prior to Qtopia 4.3, the SIM Application Toolkit application was defined in the simulator rule file using the <toolkit> tag. This was not flexible enough to handle all SIM Application Toolkit implementation scenarios.

From Qtopia/Qt Extended 4.3 onwards, the modem simulator source code must be modified to change the definition of the builtin SIM Toolkit Application, in the source files simapplication.h and simapplication.cpp. An alternative is to use the QtUiTest system test framework, which can be used to modify the modem simulator's behavior dynamically during a system test.

SIM File System Commands

The <filesystem> tag is used to define the contents of the SIM file system for access via the AT+CRSM command. The body of the tag should be zero or more <file> tags, each of which defines the hexadecimal contents of a SIM file. The following attributes may be present for each file:

attributedescription
nameName of the file, which is one of the EFxxx names from GSM 51.011.
recordsizeSize of records within the file if it is record-based. Leave this attribute off for binary files.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3