Design of vehicle-mounted GUI platform based on embedded Qt

2020-05-19 12:13:02

1 Introduction With the continuous development of the economy and society, cars have entered ordinary families, and car users have continuously increased their requirements for in-vehicle entertainment systems. I hope that the functions of car-borne entertainment systems will be more powerful and entertainment facilities will be more perfect. Embedded GUI (Graphical User Interface) can meet user needs and has good human-computer interaction. As a development platform for human-computer interaction interface in car entertainment system, it plays a decisive role in the design of the entire system and is increasingly favored by developers. Currently popular GUI platforms include Qt / Embedded, the compact X Windows system, MicroWindows, and MiniGUI system. The X Window system is a window system based on the client / server structure, which is displayed on the terminal (server) based on X. This system is configured in most UNIX systems, DEC's VAX / VMS operating systems, and Linux systems. It can be copied and spread freely, but the system is huge and takes up more kernel resources. MicroWindows is a classic GUI system with completely open source and hierarchical design. It can replace the X Window system, but some key codes use assembly language. The MiniGUI system is adapted to the embedded GUI platform of small and medium-sized enterprises, adopts a hierarchical structure, and adopts a hash table at the core layer. The Qt / Embedded used in this article is also a layered architecture, and uses C ++-like methods in terms of function provision.

2 Implementation platform of embedded GUI GUI is a graphical user interface, generally used for the design of human-computer interaction interface on PC. For embedded GUI, because embedded devices have strict resource requirements, different embedded devices need to customize different embedded systems, so the requirements for GUI are also different. Therefore, for different embedded systems The GUI must also be customizable. For embedded hardware, the customized embedded GUI should have the characteristics of light weight, less resource consumption, high performance, high reliability, and configurability. Because the Linux operating system has the advantages of open source, portability, tailorability and flexibility, the development of embedded GUI is often carried out under the Linux environment. Qt / Embedded is the ongoing Qt version for embedded systems under the famous Qt library developers. It is a toolkit specifically designed for embedded system graphical user interfaces, including a complete window system. It is characterized by better portability. Designers can easily add various display devices and hardware input devices. Many XWindow based on Qt can be easily transplanted to the embedded version. Qt / Embedded provides developers with rich API calling functions and public source code. Qt / Embedded provides very rich widgets (Widgets), and also supports the customization of widgets, so it can provide users with a beautiful graphical interface, but at the same time rich window objects also increase the size of the software, Qt / Embedded is generally used in embedded devices that are not too harsh on the operating environment.

3 Characteristics of the embedded Qt system Qt / Embedded transplants a large number of original XWindows programs based on Qt, and provides a very complete embedded GUI solution. It is a mature GUI platform with the following characteristics: (1) Qt follows the GPL agreement and opens the main source code. Users can freely add new features under the GPL. (2) Compared with other embedded GUIs, embedded Qt is not only a complete window system, but also an application framework, which is more conducive to application development. (3) Qt has a rich API, including more than 250 C ++ classes, supports many functions such as graphics, network, database, I / O operations, various controls and XMI, and can meet most embedded application systems Development needs. (4) Qt is a GUI simulation toolkit, which uses low-level drawing functions on their respective platforms to simulate MS Windows and MoTIf (commercial Llnix standard GUI library), so the program runs fast. (5) Qt's good packaging mechanism makes Qt's modularity very high, with good reliability and easy program development. Based on these characteristics of Qt, in the development process of this vehicle's embedded entertainment system, this article uses embedded Qt as the GUI support platform for GUI development, which effectively improves the speed of application development.

4 Design of vehicle-mounted GUI based on embedded Qt 4.1 The overall design of the in-vehicle GUI based on embedded Qt The operating environment of the in-vehicle entertainment system based on Linux is shown in Table 1, the bottom layer is composed of Linux kernel and driver. The kernel is a cut-down embedded Linux 2.4, which includes a power management system; the driver provides support for various interface hardware; the middle layer is an embedded Qt library based on QT / Embedded. It simplifies and optimizes various graphics operations, without additional system support when the program is running, which can effectively reduce memory consumption and CPU burden. QT / Embedded itself is extensible and can be continuously upgraded. Developers can make appropriate reductions based on the actual needs of the embedded devices they face. The QT / Embedded obtained by the reduction can save about 800k to 3MB of memory space, which means that using Qt to develop is more cost-effective Other toolkits develop the same application. After generating the executable file, the memory space occupied by the code should be small. The top layer is the entire car entertainment application system, which is a collection of applications that implement specific functions of car entertainment.

The vehicle-mounted embedded entertainment system software based on embedded Qt satisfies the requirements of vehicle-mounted audio-visual entertainment to the greatest extent. Provide multimedia software such as video playback, audio playback, personal information management software, wireless network services, etc. Its system architecture is shown in Figure 1.

4.2 Window system structure design based on embedded Qt The upper GUI window system designed in this paper adopts the client / server system structure. The window system includes: a server process, one or more client processes. The server is responsible for allocating the display area for the client and itself, generating mouse, keyboard, or touch screen events. It usually contains the user interface that starts the client. The client communicates with the server to apply for the display area and accepts mouse or touch screen events. Customers can directly access the assigned display area to provide GUI services for users. The server and the client communicate the information on the allocated display area by sharing memory. The window system architecture is shown in Figure 2.

The server (process) maintains a set of areas. When windows are created, moved, resized, and destroyed, each client's application is changed through this set of areas. This area is stored in shared memory, and clients can read information from them when performing drawing operations; the server is connected to some system devices, such as a mouse, keyboard, or touch screen, and the server is responsible for sending events generated by these devices to the appropriate client process . The server can generate a device-independent mouse or keyboard event and send it to the corresponding client process. Stylus devices usually do not have a mouse cursor, but stylus operations can be converted into device-independent mouse events, which are then handled by customers as standard events. Embedded Qt provides APIs for customers (processes). When customers use the Qt API to draw lines, the QT / Embedded library can directly access the video memory to complete the line drawing work; in some cases, the embedded Qt client library needs to establish a connection with the server process. For example, when the client process is started, an operation occurs that affects the global consequences and communicates with the server. For example, when a client performs a drag-and-drop operation, the display area changes due to the window covering, so when the mouse and keyboard events are received from the user, such a connection needs to be established; the embedded Qt client library is responsible for handling all painting operations , Including text display and font processing. 4.3 Event Response Design Based on Embedded Qt In the aforementioned client / server system structure, the press and release of each key are issued as QWSKeyEvent events. A QWSKeyEvent event usually includes the following fields: Unicode: Unicode value. Keycode: Qt key code value, defined in qnamespace. h header file. Modifier: Bit field, including Qt :: ShiftButton, Qt :: ControlButton and Qt :: AltButton. Is press: true when the key is pressed and false when it is released. Is auto repeat: True when the key is in auto repeat state. The process of embedded Qt processing key events is: the keyboard driver is responsible for reading data from the device and sending the key events to the server. When the server receives a key event from the keyboard driver, it first goes through an event filter, and then sends it to each client process, and finally the client process is responsible for handling the key event and sending it to the appropriate window . The specific process is shown in Figure 3.

Here, not all key events come from keyboard devices, including touch screens, and styluses can generate key events. The server can call the function QWSServer :: sendKeyEvent () at any time to generate key events. According to this feature, combined with the characteristics of the event filter, the required input server platform can be constructed. In Qt, an event is sent to an object inherited from QObject by calling QObject :: event (). Event sending means that an event has been generated, just expressed by QEvent, and QObject needs to respond. Most events come from window system class QWidget, such as QMouseEvent and QkeyEvent events. Some events come from other sources, such as QTImerEvent, and some from applications, Qt will treat them equally. The event filter processes events before the target object is processed. The filter is implemented by calling QObject :: eventFilter (), which can accept or discard the filter, and can also allow or refuse to further process the event. If all event filters allow further processing of the event, the event itself is delivered to the target object. This article arranges event filters in the server process, receives key events, and after processing, sends the results to the client process. In the client process, handle key events and send them to the appropriate window.

5 Conclusion Embedded Linux is the current popular embedded system solution, and embedded GUI is an indispensable part of embedded Linux. This paper analyzes and compares several popular GUIs currently popular, selects embedded Qt as the research object and conducts in-depth discussions on it. On this basis, the design and implementation of vehicle-mounted GUIs based on embedded Qt are completed. High economic value, and can provide reference value for other embedded entertainment systems.

It adopts high-quality battery monomers grouped and screened and designed by special mechanical structure to assemble all ranges of built-in BMS batteries.