The guides provide detailed guidance on performing specific tasks or utilize specific features provided by Apertis.

For higher level descriptions of the technology employed in Apertis, please see the architecture documents.

Contents

Memory Management

Apertis is predominantly written in C, so dynamically allocated memory has to be managed manually. Through use of GLib convenience APIs, memory management can be trivial, but programmers always need to keep memory in mind when writing code. It is assumed that users of Apertis are familiar with the idea of heap allocation of memory using malloc() and free(), and know of the GLib equivalents, g_malloc() and g_free(). Summary There are three situations to avoid, in order of descending importance: [Read More]

Processes

There are various things which affect an entire application process. They are not all related, so are covered in separate subsections; some apply to all applications, others to specific functionality. Summary Use libraries instead of subprocesses where possible. Use closed-loop subprocess management to keep track of when subprocesses exit. Do not use sigaction(): use g_unix_signal_add() instead. Do not use sleep(): use g_timeout_add_seconds() instead. Do not use system(): use libraries or single subprocesses instead. [Read More]

Tooling

Development tools are much more than just a text editor and a compiler. Correct use of the right tools can drastically ease debugging and tracking down of complex problems with memory allocation and system calls, amongst other things. Some of the most commonly used tools are described below; other tools exist for more specialised use cases, and should be used when appropriate. Summary Compile frequently with a second compiler. Enable a large selection of compiler warnings and make them fatal. [Read More]

Unit Testing

Unit testing should be the primary method of testing the bulk of code written, because a unit test can be written once and run many times — manual tests have to be planned once and then manually run each time. Development of unit tests starts with the architecture and API design of the code to be tested: code should be designed to be easily testable, or will potentially be very difficult to test. [Read More]

Using the SQLite database

SQLite is a lightweight database library suitable for single user or low throughput databases. It is used for storing some user data in Apertis. Summary Use SQLite for appropriate use cases: not configuration data (use GSettings). Consider your vacuuming policy before committing to using SQLite. Avoid SQL injection vulnerabilities by using prepared statements. When to use SQLite Even though it is lightweight for a database, SQLite is a fairly heavyweight solution to some problems. [Read More]

Connectivity documentation

Writing ConnMan plugins The plugin documentation in ConnMan was improved and submitted upstream. The documentation about writing plugins can be found on ConnMan sources in the following files: doc/plugin-api.txt, src/device.c and src/network.c. Example plugins are plugins/bluetooth.c plugins/wifi.c, plugins/ofono.c, among others. Customs ConnMan Session policies The documentation to create Session policies files for specifics users and/or groups can be found in ConnMan sources doc/session-policy-format.txt. The policies files shall be placed in STORAGEDIR/session_policy_local directory, where STORAGEDIR by default points to /var/lib/connman. [Read More]

SDK Basic Usage

Overview of SDK features Take a moment to familiarize yourself with some of the more commonly used tools in the SDK. These include the file browser, Eclipse, DevHelp and the simulator. All of these tools have shortcut links placed on the desktop. File browser This icon opens the file manager so you can access the local folders and use the shared folder for exchanging documents between your host system and the virtual machine. [Read More]

Boot Optimisation and Profiling

Apertis has a fairly standard boot process which utilises systemd to perform user space initialisation. This document describes steps that can be taken to profile and optimise the boot process. Startup sequence modification rules A number of simple steps need to be followed when adding services to the boot process to ensure that an optimal boot process can be achieved: Do Configure systemd services to only depend upon other services they absolutely require to function: This helps simplify and shorten the boot process. [Read More]

How to Customize GTK Widgets Used by WebKit2GTK+

Recent gtk+ provides an useful way to style gtk widget without re-compiling. You can cusmotize your widgets by adding css like rules to ./Source/WebCore/css/gtk.css. See GtkCssProvider for more details. Widgets and tips Here are some information and tips which help you write rules in gtk.css. When defining style rules, you can use a class name for some widgets as its selector. For instance, it is possible to use ‘.button’ instead of ‘GtkButton’. [Read More]

D-Bus Services

D-Bus services Most Apertis components communicate with various daemons via D-Bus. The D-Bus interfaces exposed by those daemons are public API, and hence must be designed as carefully as any C API — changing them is not easy once other projects depend on them. D-Bus interfaces are described using an XML format which gives the parameters and types of every method. Summary Use GDBus rather than libdbus or libdbus-glib. (Dependencies) Install D-Bus interface XML files. [Read More]