Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded |
|
This document describes the implementation requirements for specific devices and makes recommendations for the optimal installation of Qtopia on a handheld device. How Qtopia is installed on a given device is determined by the functionality of that device.
See Also
In some cases it is desirable to have a customized launcher interface better suited to the application on the target device. Qtopia supports custom launcher user-interfaces via the ServerInterface. This interface provides the infrastructure necessary to implement a launcher while maintaining compatibility with the Qtopia application and document models.
The launcher user-interface is part of the Qtopia server - $QPEDIR/src/server which provides services such as syncing and file-system management.
The default Qtopia launcher is implemented by the Launcher class. The first step when writing a user-interface is to implement a class derived from ServerInterface. This interface provides the functionality to display the applications and documents available on a Qtopia device.
The createGUI() and destroyGUI() functions must be implemented to create and show the launcher and any other user interface components.
The functions provided by the ServerInterface manage the addition and removal of applications and documents as necessary. The ServerInterface documentation describes the functions in detail.
In addition to the launcher it is necessary to provide some system components, such as input methods and status display.
There are several classes in the default Qtopia user-interface that may be re-used in a custom interface. Most user-interfaces make use of some of these classes to ensure a usable system:
An interface providing these components will support the Qtopia launcher default functionality.
The Qtopia libraries also assume that QPE/Taskbar QCOP channel is available and supports the following functions:
The default Qtopia launcher uses the TaskBar class to encapsulate the above functionality.
When planning to customize and install Qtopia on a specific device a number of factors that must be taken into consideration:
All of the changes required to add these device specific customizations are centralized in Qtopia and involve a small number of files (described below). This document should make it easy for OEMs and system integrators to understand how to make Qtopia aware of any special hardware that a device might have.
During configure, the -xplatform option is used to select which custom-<xplatform-spec>.h file will be used when compiling Qtopia. The following macros can be defined or undefined in a custom.h file to customize Qtopia for the specific hardware. The associated custom-<xplatform-spec>.cpp file will be compiled and linked to provide any custom functions that are required.
In addition to the above macros and defines, the following three functions must be implemented in the custom-<platform-spec>.cpp file.
For reference implementations of the device specific code, the existing custom-*.* files found in src/libraries/qtopia/ may be of guidance.
There are a number of applications/features supplied with Qtopia that are not intended to be shipped with production devices:
The following applications are unsupported 3rd party applications/ports intended purely to demonstrate the flexibility of Qtopia:
If Qtopia crashes twice in quick succession "Safe Mode" will be entered and no plugins will be loaded in case the crash was caused by a misbehaving plugin. In some cases there are plugins that are required for correct operation of the device. These plugins can be specified in the .directory file in $QPEDIR/plugins/<type>/.directory. For example, if the simple8 text codec is always required:
[Desktop Entry] Name[]=Text Codecs Comment[]=Provides support for various international languages. Required=simple8 Apply=QPE/System restart()
A number of points should be considered when integrating Qtopia with a device that has power management.
Qtopia's power management is handled by Qt embedded. The QWSServer uses the QWSScreenSaver interface in order to decide what to do. Qtopia provides the screensaver behavior by extending from QWSScreenSaver. This screensaver (QPEScreenSaver) is implemented in qpeapplication.cpp and provides the following three screensaver levels:
Qtopia will call the platform-specific function qpe_setBrightness(int) in order to adjust the light for the display.
The last level depends on the specific version of Qtopia. The PDA version will use the APM daemon and suspends the execution of Qtopia whereas the phone edition closes open applications and returns to the home screen. For further information please refer to: For PDA Edition and For Phone Edition.
The QWSServer provides the following interface which allows the registration and customization of arbitrary screensavers:
Qtopia's screensaver can be adjusted by the user via the power management (Light & Power) application.
Qtopia runs the 'apm' command to suspend. The system's AT daemon is used to unsuspend upon RTC alarms. The system's AT daemon is used to write the RTC clock (because on some systems only one process can manipulate the RTC).
The system's "Power" key or the third screensaver level just sends a key (Qt::KeyF34) to Qtopia, which then does the actual suspend. It triggers the execution of ServerApplication::togglePower(). All CPU functions are suspended once
system("apm --suspend");
is executed. Normal operation will resume once a "Wake up" event comes from apmd.
Suspension is not enabled in the phone edition.
"apm --suspend"would suspend the CPU and shutdown the device. This behavior is acceptable for PDA's because they don't need to listen for incoming calls. However, the qpe server must be running in order to receive calls. If Qtopia shuts down the power, everything would stop working. We will assume that Qtopia Phone does not do that (or that if it does, Linux ensures resume on modem activity).
Rather than suspending the device the number of CPU cycles has been minimized while the qpe server is showing the home screen. In addition to the first and second screensaver level (already known from the PDA edition) Qtopia Phone automatically closes applications and returns to the home screen. Background activities (like time/date updates and the execution of the battery monitor) are reduced to ensure that the CPU consumption is at the lowest possible level.
Qtopia's memory management is divided into two segments. These parts can be controlled via QPE_HAVE_MEMALERTER and QPE_MEMALERTER_IMPL. QPE_HAVE_MEMALERTER enables Qtopia to alert the user if the device is running under low memory conditions. It relies on the macro QPE_MEMALERTER_IMPL which should be defined if a customized memory alerter implementation is available. Otherwise Qtopia will use it's own default implementation which is based on page faults. It is recommended to use initMemalerter() if the device has some kind of hardware support to detect the memory situation.
The memory alerter should return five different memory states. The following list describes these states and their consequences for the server.
Qtopia has 3 ways that it identifies storage locations.
This is the original method and is generally not suitable to new devices. You can modify the algorithm but it it much easier to specify the locations you want with Storage.conf.
If $QPEDIR/etc/default/Storage.conf exists, it is used when deciding what parts of the filesystem are available for Qtopia's use. It must define 1 non-removable and any number of removable locations.
Note: Due to the way the config system works, $HOME/Settings/Storage.conf will override $QPEDIR/etc/default/Storage.conf. This should not matter on released devices as the available devices will not change. On a development system you should ensure $HOME/Settings/Storage.conf is removed when $QPEDIR/etc/default/Storage.conf is changed.
Here is a simple example of a Storage.conf file.
[/dev/hda1] Name = Internal Storage Removable = 0 [/dev/sda1] Name = CF card Removable = 1
This file specifies the device /dev/hda1 as the non-removable storage. It calls this location "Internal Storage". There is also a removable storage location called "CF card" that uses the device /dev/sda1.
It is possible to add translation to the names in Storage.conf. If you require this ability, please contact support-embedded@trolltech.com as a patch needs to be applied to your Qtopia tree.
The "device" in Storage.conf must correspond to the first column of /etc/mtab. Here are some examples of devices.
If no storage locations are found a fallback is used. When this happens $HOME is used as the "Internal Storage" location. As $HOME is generally writable this tends to work but you will not have access to removable storage if this happens. Provide a Storage.conf file so that your devices are explicitely noted.
Application data is stored in the non-removable location. Documents can be in any location. Removable locations are re-scanned on insertion and removal.
The scanning is triggered when the Qtopia library receives one of the following messages via the QPE/Card QCOP channel:
If QPE_SYSTEM_SYSFILEMONITOR (see above) is defined, Qtopia assumes that the surrounding system generates these messages (eg. by using the qcop command in the system HotPlug scripts). Otherwise, Qtopia polls every few seconds (wasting CPU).
Qtopia uses UTF8 for all file formats. System functions are also expected to use UTF8 encoding. For example, with $LANG set to "ja", strftime() must return a string in UTF8 encoding. Depending on the underlying operating system, this may require "ja" to be an alias for the "ja_JP.utf8" locale.
Note that Qtopia expects all file systems to use utf8 encoding. This usually requires attention in /etc/mtab and /usr/share/locale. Particular attention should be paid to removable media.
Qtopia can run as any user, provided that user has read and write permissions to certain file areas for certain functionality:
| Path | Use | Notes |
|---|---|---|
| /dev/fb0 | Painting Frame Buffer | Requires write permissions. |
| $HOME | User settings and documents | Requires write permissions. |
| /opt/Qtopia/... | Qtopia core files | Requires write permissions for installing additional software. |
| /etc/ppp/... | PPP configuration options | Requires write permissions for Network Settings. |
| /etc/pcmcia/... | LAN/wireless network options | Requires write permissions for Network Settings. |
Using read-only filesystems can have a number of benefits. Compressed read-only filesystems such as cramfs and squashfs often have better compression than read-write filesystems such as jffs2. Also read-only filesystems provide a measure of protection for important system files.
If the device does not require that users can install additional applications or plugins it is possible to compile Qtopia as a single, statically built executable. This uses less space than the dynamic build but does not allow other applications to link to Qtopia libraries.
If Qtopia is build as a single, statically built executable /opt/Qtopia does not require write permissions and can be mounted on a read-only filesystem.
See Qtopia Single Exec.
Symbolic links are the easiest way of mixing read-only and read-write filesystems. Set QPEDIR to be a location on the read-write filesystem and use symbolic links to link individual files to their respective locations on the read-only filesystem. For example /opt/Qtopia/apps/Applications/calculator.desktop would be a symbolic link to /opt/Qtopia-ROM/apps/Applications/calculator.desktop.
This has better flash usage than using just a read-write filesystem and allows installing additional applications and updating components of Qtopia.
Improved support for multiple Qtopia paths was added in Qtopia 2.1. Some components of Qtopia can reside in a number of directory locations. This reduces the need for symbolic links when mixing read-only and read-write file systems, reducing flash ram usage. The subdirectories of Qtopia that support multiple Qtopia paths include:
If the QTOPIA_PATHS environment variable is set to include an appropriate directory on the read-only filesystem, then for the above subdirectories symbolic linking of files to the read-only filesystem is not required. It is still necessary to use symbolic links for the apps subdirectory to allow installable applications.
The QTOPIA_PATH environment variable is set as a colon-separated list of directories. For example "/opt/Qtopia:/opt/Qtopia-ROM". It is also required that the PATH and LD_LIBRARY_PATH environment variables are set appropriately.
The Qtopia Phone Edition includes MMS functionality in the messages client.
Qtopia does not include a WAP stack with the MMS client. Instead, an interface is provided which allows any WAP stack to be integrated. The MmsComms class must be subclassed and the virtual functions implemented and signals emitted as appropriate. The MmsCommsHttp class provides a sample implementation using HTTP over TCP/IP see : $QPEDIR/src/applications/qtmail/mmscomms_http.{cpp,h}
To choose an alternate WAP stack connection method
The AMR encoder included with Qtopia is a reference implementation only. It is recommended that an encoder optimized for the target platform be installed. The media recorder plugin interface provides a convenient method of integrating the codec. See MediaRecorderEncoder class.
We have found that the implementation of the GSM specification varies from GSM module to GSM module. It is therefore highly likely that modifications will be needed to $QPEDIR/src/libraries/qtopiaphone.
To simplify matters, most of the module-specific code can be placed in a vendor-specific plugin, located under $QPEDIR/src/plugins/phonevendors. The plugin should inherit the PhoneVendorAt class and override its methods to implement the vendor specifics.
Qtopia Phone will load every vendor plugin that is installed and queries each one to see which is capable of handling the GSM modem. A vendor plugin will typically issue vendor-specific AT commands to determine if the modem is supported.
The QTOPIA_PRELOAD_PHONE_PLUGIN macro in custom.h can be used to force Qtopia Phone to load that plugin and only that plugin, ignoring any others that may be present in the system.
GSM 07.10 multiplexing, implemented in muxdevice.*, is a common cause of problems. During initial testing, you can disable it by setting the QTOPIA_PHONE_MUX environment variable to "no". Qtopia Phone will still function, but you will be unable to make GPRS calls without multiplexing support.
The MAX_GSM0710_FRAME_SIZE, QTOPIA_EXTRA_CMUX_PARAMS, and QTOPIA_ADVANCED_CMUX macros in custom.h can be used to customize the behavior of the GSM 07.10 implementation a little. Otherwise it may be necessary to modify muxdevice.cpp.
The Qtopia source code also supports Wavecom-style multiplexing, as an example of how to implement a non-CMUX multiplexing system. This mode is enabled with the use of the QTOPIA_WAVECOM_MUX macro in custom.h.
To support a GSM module the follow guide may be used:
| Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.1.2
|