Detailed design of lightweight GUI system solution in embedded environment

1 Introduction

In recent years, with the rapid development of information appliances, handheld devices, and wireless devices, people's demand for embedded systems has gradually increased and the requirements have become higher and higher. This makes it a very urgent requirement to provide a friendly, convenient, stable and reliable G UI system for embedded systems. Embedded technology is an important branch of current microelectronics and computer technology. It refers to the application as the center and computer technology as the basis. The software and hardware can be tailored to adapt to the application system’s impact on function, reliability, cost, volume, and power. A dedicated computer system with strict requirements such as energy consumption. The GUI on the commonly used PC is too large due to the strict resource requirements of embedded devices, and is not suitable for embedded systems. Compared with the GUI system under normal environment. The GUI system in the embedded environment requires light weight, less resources, high performance, high reliability, and configurability. At the same time, due to the diversity of embedded environments, cross-platform and high portability are also characteristics that embedded GUI systems must have.

Although the demand for GUI in embedded systems is becoming more and more obvious, the current implementation methods of GUI are different, there are mainly two kinds; the first method is that some large manufacturers independently develop GUI systems that meet their own needs according to their own needs; The second method is that some manufacturers use some mature GUI systems. For most manufacturers, the second method is a time-saving and labor-saving method that can achieve better results.

2 Overview of GUI system development

At present, many Linux-based GUI products have been launched at home and abroad. The more mature embedded GUI systems include QtEmbedded, MicroWindows, MiniGUI, WinCE, etc.

1) Microwindows is an open source (LGPL) project. It is committed to providing some features of the modern graphical window environment for some small devices and platforms. Its main feature is a GUI system based on a client/server architecture, which uses a hardware-oriented driver layer and a hardware interface layer. , To the three-tier architecture of the API layer of the high-level operating system. And provides relatively complete graphics functions, as well as some other higher-level functions, such as Alpha blending, 3D support, TrueType font support, etc. But it has the following shortcomings: without any hardware acceleration capabilities, there are many inefficient algorithms in the graphics engine, and the code quality is poor.

2) MiniGUI runs on the Linux console, a multi-window graphical user interface support system based on SVGALib and LinuxThread libraries. The main feature is that it is written based on threads, and all application research programs run in the same address space, which can improve the efficiency of the system. The bottom layer adds graphics abstraction layer GAL and input device-based input abstraction layer to provide graphics interface and input interface on the underlying Linux console or XWindow. However, the API is not encapsulated, it is inconvenient to transplant, and the function limits it cannot be used in larger embedded systems.

3) Qt/Embedded is developed by the famous Qt library developer Trolltech. It is a graphical user interface toolkit specially designed for embedded systems. Its main feature is that it can be transplanted to different platforms, has its own window system, has its own powerful development tools and programming interface, provides compressed font formats, supports Unicode, and can easily make the program support multiple languages. But Qt/Embedded is not free, users must support the license fee.

4) OpenGL is released under LGPL terms. OpenGUI is more suitable for real-time systems based on the x86 platform. It is based on a kernel implemented by assembly and optimized using MMX instructions to make it run faster, but its portability is slightly poor.

The design goal of these types of GUIs is still versatility. Most of them support free switching and overlay of multiple windows, as well as windows that can be moved and dynamically changed in size. These features are almost never used in most embedded applications. Many unnecessary details must be considered in the development of an application.

The above embedded GUI system is very mature, but the above products are not a good choice for some users who need to independently develop a light-weight GUI system with simple functions and strong specificity. Part of the above GUI system is a commercial product for a fee, and the other is a general-purpose GUI function system. For embedded systems where hardware resources are highly valued, redundant and useless functions are not a good choice to waste hardware resources. This paper studies the development of a small-scale dedicated embedded GUI system and realizes the development of a dedicated GUI system.

3 Design and implementation of lightweight GUI The embedded GUI system adopts a hierarchical design structure to encapsulate different levels. At the lowest level, a hardware abstraction layer (HAL, Hard Abstract Layer) is established, which is a Graphic Abstract Layer (GAL) based on graphics display devices (such as VGA cards) and input based on input devices (such as keyboards, touch screens, etc.) Abstract layer (Input Abstract Layer, IAL). The graphics abstraction layer GAL is built on top of various popular drawing engines, shielding the specific implementation of various drawing engines, and providing a unified bottom drawing interface to the upper layer. The input abstraction layer IAL is built on top of each hardware device driver, shields the hardware implementation of various input devices, and provides a unified application input interface to the upper layer; the graphics engine is obtained through FrameBuffer, but there is no unified interface for the processing of input devices. . On a PC, a keyboard and a mouse are usually used, while on an embedded system, there may be only a touch screen or a few keys. In this case, it is extremely important to provide an abstract input layer. Ggraphic Device Interface (GDI, Ggraphic Device Interface) is built on top of the graphics abstraction layer and mainly includes the functions of drawing points, lines, surfaces, text, and so on. The graphical user interface and related APIs are built on the graphical device interface to implement various functions such as message queues, windows, controls, and application management. The hierarchical structure of the system is shown in Figure 1.

Detailed design of lightweight GUI system solution in embedded environment

The GAL layer completes the operation of the system on specific display hardware devices, hides the technical implementation details of various hardware to a large extent, and provides a unified graphical programming interface for application developers. The IAL layer needs to implement control operations for various input devices and provide a unified calling interface. The design of GAL layer and IAL layer shields the diversity of the underlying hardware, which can greatly improve the portability of embedded GUI. In addition, the use of GAL can greatly improve the portability of GUI and make program development and expansion easier. The graphics abstraction layer uses the GFX data structure to represent the graphics engine system; through the input device layer, the system uniformly maps the various devices at the bottom to the two basic input devices supported by the upper application—the mouse device and the keyboard device. For specific hardware devices, as long as you write a program to implement the corresponding abstract interface according to the interface provided by the driver, you can simulate various devices as a mouse or keyboard for input.

The system maintains an array of registered graphics engines and saves pointers to the data structure of each graphics engine. The system uses a pointer to save the graphics engine currently in use. The data structure of each graphics engine defines some information of the graphics engine, and implements various interfaces defined by GAL, including initialization and termination, drawing point processing function, drawing line processing function, rectangular box filling function, palette function, etc.

3.2 Graphics Device Interface (GDI) The graphics device interface is an independent drawing application interface built on the graphics abstraction layer. It further encapsulates and expands the interface functions provided by the graphics abstraction layer, making it easier to use for higher-level applications. , Complete drawing function. lightGUI uses Windows similar to the GDI module in Windows. It provides device context operations, basic GDI object operations (including pens, brushes, fonts, bitmaps, regions, etc.). In this system, the definition of device context adopts the following data structure: typedef struct gdi_DC{ int DrawPointx; int DrawPointy; int DrawOrgx; int DrawOrgy; int DrawRangx; int DrawRangy; int DrawRop; COLORREF BackColor;

COLORREF FontColor;

}DC, *PDC

The main APIs of the system settings and device context are shown in the table

CreateDC(): Create a new device context

DispatchDC (PDC): Release the device context

GetDrawDes (PDC, POINT*): Get the origin of the upper and lower drawing coordinates of the device

GetDrawRange (PDC, POINT*): Get the context drawing coordinate range

GetBackColor (PDC, int*): Get the context drawing background color

3.3 The design of message-driven mechanism The basic communication mechanism of the realization system is an event-driven message mechanism. The system thread and all windows in the system have their own message queues. System thread, the queue stores all kinds of control messages received from the underlying input device, waiting for the system thread to be allocated to the application window; all windows in the system private message queue is used to store all messages sent to the window, waiting for the window Further processing. Messages in the system are divided into four categories: system messages, external time messages, window menu messages, and window control messages. In a message-driven application, events that occur on peripherals (such as keystrokes) are collected by the support system and translated into specific messages in a pre-agreed format. The application generally contains its own message queue, and the system sends messages to the message queue of the application. The application can establish a loop in which messages are read and processed until a specific message arrives. When there are no messages to process in the window, the message loop processing is blocked, and CPU resources are not consumed at this time. In the GUI, the application processing messages in the message queue is divided into GetMessage() to obtain messages from the message queue. GetMe

The ssage() function has 2 parameters, one is used to store the received message data, and the other is the handle of the application's main window. When a message is received, the target window of the message is confirmed as the main window of the application. If the received message is not MSG_QUIT

Detailed design of lightweight GUI system solution in embedded environment

3.4 Window design and realization The window management module supports simultaneous display of multiple windows, and can perform operations such as window creation, movement, and size adjustment. The window design includes the main window, window menu, window controls, window main process and window-related API functions. In the design, each window adopts its own main process to complete the processing of its own messages. 3.5 Controls The control layer is a child window of the window. The behavior of these sub-windows is the same as that of the main window. They can receive external input such as keyboard and mouse, and can also output in their own area, but all their activities are restricted in the main window. The control layer design implements basic controls, including buttons, static text boxes, single-select (multiple-select) boxes, drawing boxes, and many other common controls. The control layer fully taps the potential of the basic window system. Provide users with the most commonly used functions, greatly simplifying the process of user development.

4 Conclusion

This article introduces the basic architecture and implementation principles of the embedded graphical user interface system, and proposes a solution for an autonomous, lightweight, configurable GUI system that takes up less resources in an embedded environment. The lightweight GUI system has been tested on Linux systems. The architecture used in the development of this article and the development of window user controls for technology have greatly improved the development efficiency and code reuse rate, and have certain reference and reference value for the development of independent GUI systems. The author of this article is innovative: use the Linu x development platform to develop a dedicated GUI system suitable for small embedded systems, use hierarchical structure and object-oriented control development technology, shorten the development cycle, reduce development costs, and provide for the development of embedded GUI systems Reference to the development method.

Maskking Vape

The utility model provides a disposable electronic cigarette, comprising: a hollow shell, the bottom of the shell is provided with a lower cover; the shell contains an atomizer, and the outer side of the atomizer is sheathed with a disposable cigarette A bomb, a microphone cover is arranged under the atomizer, a microphone is covered under the microphone cover, a battery is arranged on one side of the atomizer, and an upper cover is arranged on the top of the casing; The atomizer includes an atomizing core, an oil-absorbing cotton sleeved on the outside of the atomizing core, and an atomizer outer tube sleeved on the outside of the oil-absorbing cotton. The disposable electronic cigarette provided by the utility model absorbs the smoke oil on the surface through the absorbing cotton, and then atomizes the smoke through the atomizing core, which greatly reduces the risk of oil leakage, at the same time, reduces the burning of cotton and ensures the smoking taste.The utility model provides a disposable electronic cigarette, comprising: a hollow shell, the bottom of the shell is provided with a lower cover; the shell contains an atomizer, and the outer side of the atomizer is sheathed with a disposable cigarette A bomb, a microphone cover is arranged under the atomizer, a microphone is covered under the microphone cover, a battery is arranged on one side of the atomizer, and an upper cover is arranged on the top of the casing; The atomizer includes an atomizing core, an oil-absorbing cotton sleeved on the outside of the atomizing core, and an atomizer outer tube sleeved on the outside of the oil-absorbing cotton. The disposable electronic cigarette provided by the utility model absorbs the smoke oil on the surface through the absorbing cotton, and then atomizes the smoke through the atomizing core, which greatly reduces the risk of oil leakage, at the same time, reduces the burning of cotton and ensures the smoking taste.The utility model provides a disposable electronic cigarette, comprising: a hollow shell, the bottom of the shell is provided with a lower cover; the shell contains an atomizer, and the outer side of the atomizer is sheathed with a disposable cigarette A bomb, a microphone cover is arranged under the atomizer, a microphone is covered under the microphone cover, a battery is arranged on one side of the atomizer, and an upper cover is arranged on the top of the casing; The atomizer includes an atomizing core, an oil-absorbing cotton sleeved on the outside of the atomizing core, and an atomizer outer tube sleeved on the outside of the oil-absorbing cotton. The disposable electronic cigarette provided by the utility model absorbs the smoke oil on the surface through the absorbing cotton, and then atomizes the smoke through the atomizing core, which greatly reduces the risk of oil leakage, at the same time, reduces the burning of cotton and ensures the smoking taste.

maskking vape,maskking vape price,maskking vape review,maskking vape shop,,maskking vape cost,maskking vape disposable,maskking vape informacion

Suizhou simi intelligent technology development co., LTD , https://www.msmvape.com