A terminal human-computer interaction method and device based on LVGL and MQTT
By using LVGL and MQTT in power terminals to dynamically allocate and reclaim display control, the problems of inflexible human-computer interaction and limited resources in power terminals are solved. This achieves aesthetically pleasing and rapid button response and stable module communication, providing a user-friendly experience.
Patent Information
- Application Number
- CN202311664265.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-12-05
AI Technical Summary
Existing human-machine interaction methods for power terminals are inflexible, slow to respond, and affect user experience. In addition, terminal display resources are limited and communication between modules is unstable.
Employing the embedded graphics library LVGL and the lightweight communication protocol MQTT, the display control right application page is generated on the power terminal interface through the management display right allocation module. Non-management modules execute display functions through the MQTT protocol and reclaim display control rights after completion, thereby realizing multi-module sharing of display resources and real-time communication.
It achieves a beautiful terminal interface, rapid button response, smooth user operation, stable communication between modules, orderly use of display resources, and provides a user-friendly human-computer interaction experience.
Smart Images

Figure CN117667091B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power system technology, and in particular to a terminal human-computer interaction method based on LVGL and MQTT, a terminal human-computer interaction device based on LVGL and MQTT, an electronic device, and a computer-readable medium. Background Technology
[0002] In the power sector, LCD displays and button controls on terminal devices are crucial human-machine interface methods. These displays allow for the setting and querying of terminal parameters and the display of status information. However, existing terminal interaction methods are inflexible and slow, negatively impacting user experience. There is an urgent need for a user-friendly and responsive interaction method. Furthermore, power terminals are embedded system-based devices with limited display resources. Each terminal contains multiple modules, requiring real-time, stable communication and the orderly sharing of limited resources to provide a truly user-friendly human-machine interface. Summary of the Invention
[0003] In view of the above problems, embodiments of the present invention are proposed to provide a terminal human-computer interaction method based on LVGL and MQTT that overcomes or at least partially solves the above problems, and a corresponding terminal human-computer interaction device based on LVGL and MQTT, an electronic device, and a computer-readable medium.
[0004] This invention discloses a terminal human-computer interaction method based on LVGL and MQTT, applied to a power terminal. The power terminal includes multiple functional modules that share a display screen. Each functional module includes a module for managing display rights allocation and at least one functional module that does not manage display rights allocation. The method includes:
[0005] The module for managing the allocation of display rights uses the embedded graphics library LVGL to generate and display a display control right application page in the interface of the power terminal; the display control right application page includes at least one control, and the control corresponds to the functional module that does not manage the allocation of display rights.
[0006] The module that manages the allocation of display rights responds to the user's operation on the control, allocates display control rights to the non-management display rights allocation function module corresponding to the control, and notifies the non-management display rights allocation function module corresponding to the control to execute its corresponding display function through the MQTT protocol;
[0007] The non-management display right allocation function module corresponding to the control executes its corresponding display function and sends a display control right revocation message to the management display right allocation module via the MQTT protocol after execution;
[0008] The module that manages the allocation of display rights reclaims the display control rights of the functional modules that are not assigned to manage the allocation of display rights corresponding to the control.
[0009] Optionally, the method further includes:
[0010] The LVGL calls the hardware abstraction driver to parse the preset page styles and manages each preset page style through a linked list, and draws the corresponding page using the preset page styles;
[0011] The LVGL calls the hardware abstraction driver to add callback functions for each page and control.
[0012] Optionally, the step of the module managing the allocation of display rights using LVGL to generate and display the display control right application page in the interface of the power terminal includes:
[0013] The functional module for allocating non-management display rights is defined as a control in the embedded graphics library LVGL, and the control is drawn on the same page of the power terminal interface. A callback function is added to the page and each control to obtain the display control right application page.
[0014] Optionally, the method further includes:
[0015] The non-management display rights allocation function module sends a registration request to the management display rights allocation module;
[0016] The module that manages the allocation of display rights assigns an ID to each of the functional modules that do not manage the allocation of display rights, so as to manage the functional modules that do not manage the allocation of display rights through the ID.
[0017] Optionally, the method further includes:
[0018] The non-management display rights allocation module sends the target display content to the management display rights allocation module via the MQTT protocol;
[0019] The module that manages the allocation of display rights displays the target display content of the functional modules that do not manage the allocation of display rights.
[0020] Optionally, the method further includes:
[0021] If no user operation on the control is detected within a preset time period during the execution of the corresponding display function by the non-management display right allocation function module corresponding to the control, the non-management display right allocation function module corresponding to the control shall return the display control.
[0022] The module that manages the allocation of display rights forcibly reclaims the display control and displays a pop-up window.
[0023] The embodiments of the present invention have the following advantages:
[0024] This invention presents a terminal human-computer interaction method based on LVGL and MQTT. LVGL is used for display, as it occupies less memory compared to other display technologies, making it more suitable for power terminals based on embedded systems. The various controls provided by LVGL enhance the terminal's interface, and its support for button interaction and callback function handling mechanisms results in faster button responses and smoother user operation. MQTT, unlike other communication protocols, is more lightweight and simple, making it suitable for terminals based on embedded systems. This invention uses the lightweight, simple, and easy-to-implement MQTT protocol to achieve real-time and stable communication between multiple modules within the terminal. Furthermore, this invention uses one module of the power terminal to manage the allocation of display rights, enabling multiple modules within the terminal to share display resources while ensuring more orderly use of the terminal's public display resources, thus achieving a user-friendly human-computer interaction function.
[0025] This invention also discloses a terminal human-computer interaction device based on LVGL and MQTT, applied to a power terminal. The power terminal includes multiple functional modules that share a display screen. Each functional module includes a module for managing display rights allocation and at least one functional module that does not manage display rights allocation. The device includes:
[0026] The application page generation module, used by the module for managing the allocation of display rights, uses the embedded graphics library LVGL to generate and display the display control right application page in the interface of the power terminal; the display control right application page includes at least one control, and the control corresponds to the functional module that does not manage the allocation of display rights.
[0027] The allocation module is used by the module that manages the allocation of display rights to respond to the user's operation on the control, allocate display control rights to the non-management display rights allocation function module corresponding to the control, and notify the non-management display rights allocation function module corresponding to the control to execute its corresponding display function through the MQTT protocol.
[0028] The display function execution module is used by the non-management display right allocation function module corresponding to the control to execute its corresponding display function and send a display control right revocation message to the management display right allocation module through the MQTT protocol after execution.
[0029] The display right reclamation module is used by the module that manages the allocation of display rights to reclaim the display control rights of the functional modules that do not manage the allocation of display rights corresponding to the control.
[0030] Optionally, the device further includes:
[0031] The page drawing management module is used for the LVGL to call the hardware abstraction driver to parse the preset page style and manage each preset page style through a linked list, and to draw the corresponding page using the preset page style;
[0032] The callback function addition management module is used to add callback functions for each page and control by calling the hardware abstraction driver in LVGL.
[0033] Optionally, the application page generation module includes:
[0034] The application page generation submodule is used to define the non-management display right allocation function module as a control in the embedded graphics library LVGL, draw the control on the same page of the power terminal interface, and add callback functions to the page and each control to obtain the display control right application page.
[0035] Optionally, the device further includes:
[0036] The registration request module is used by the non-management display right allocation function module to send a registration request to the management display right allocation module;
[0037] The ID allocation management module is used by the module that manages the allocation of display rights to assign an ID to each of the functional modules that do not manage the allocation of display rights, so as to manage the functional modules that do not manage the allocation of display rights through the ID.
[0038] Optionally, the device further includes:
[0039] The display content sending module is used by non-management display right allocation functional modules to send target display content to the management display right allocation module via the MQTT protocol;
[0040] The substitute display module is used by the module that manages the allocation of display rights to display the target display content of the functional module that does not manage the allocation of display rights.
[0041] Optionally, the device further includes:
[0042] The timeout return of display rights module is used to return the display control if no user operation on the control is detected within a preset time period during the execution of the corresponding display function by the non-management display rights allocation function module corresponding to the control.
[0043] The forced reclamation module is used by the module that manages the allocation of display rights to forcibly reclaim the display control rights and display a pop-up window.
[0044] The embodiments of the present invention have the following advantages:
[0045] This invention presents a terminal human-computer interaction device based on LVGL and MQTT. LVGL is used for display, as it occupies less memory compared to other display technologies, making it more suitable for power terminals based on embedded systems. The various controls provided by LVGL enhance the terminal's interface, and its support for button interaction and callback function handling mechanisms results in faster button responses and smoother user operation. MQTT, unlike other communication protocols, is more lightweight and simple, making it suitable for terminals based on embedded systems. This invention uses the lightweight, simple, and easy-to-implement MQTT protocol, enabling real-time and stable communication between multiple modules within the terminal. This invention uses one module of the power terminal to manage the allocation of display rights, allowing multiple modules within the terminal to share display resources while ensuring more orderly use of the terminal's public display resources, thus achieving a user-friendly human-computer interaction function.
[0046] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0047] The memory is used to store computer programs;
[0048] When the processor executes the program stored in the memory, it implements the terminal human-computer interaction method based on LVGL and MQTT as described in the embodiments of the present invention.
[0049] This invention also discloses one or more computer-readable media storing instructions that, when executed by one or more processors, cause the processors to perform the terminal human-computer interaction method based on LVGL and MQTT as described in this invention. Attached Figure Description
[0050] Figure 1 This is a flowchart of the steps of a terminal human-computer interaction method based on LVGL and MQTT provided in an embodiment of the present invention;
[0051] Figure 2 This is a flowchart of the creation and execution of LVGL tasks provided in an embodiment of the present invention;
[0052] Figure 3 This is a communication diagram for the allocation of management and display control rights provided in an embodiment of the present invention;
[0053] Figure 4 This is a structural block diagram of a terminal human-computer interaction device based on LVGL and MQTT provided in an embodiment of the present invention;
[0054] Figure 5 This is a structural block diagram of another terminal human-computer interaction device based on LVGL and MQTT provided in this embodiment of the invention;
[0055] Figure 6 This is a block diagram of an electronic device provided in an embodiment of the present invention;
[0056] Figure 7 This is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. Detailed Implementation
[0057] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0058] A power terminal can be an electric energy data acquisition terminal, which is a device that collects electricity consumption information from various data collection points. It is also known as an acquisition terminal. It can collect electricity meter data, manage the data, transmit data bidirectionally, and forward or execute control commands.
[0059] LVGL is an embedded GUI graphics library. It is implemented in pure C language, which makes it easy to port and has good performance. At the same time, it supports a wide range of controls and content, and has been widely used.
[0060] MQTT is a client-server message publish / subscribe transport protocol. The MQTT protocol is lightweight, simple, open, and easy to implement, making it widely applicable.
[0061] Reference Figure 1 The diagram illustrates a flowchart of a terminal human-computer interaction method based on LVGL and MQTT provided in an embodiment of the present invention, which may specifically include the following steps:
[0062] Step 101: The module for managing the allocation of display rights uses the embedded graphics library LVGL to generate and display the display control right application page in the interface of the power terminal; the display control right application page includes at least one control, and the controls correspond to the functional modules that do not manage the allocation of display rights.
[0063] A power terminal may have multiple functional modules that require display functionality. In this embodiment of the invention, one of these modules can be designated as the module responsible for managing the allocation of display rights, while the others are designated as modules that do not require display rights (i.e., modules that require display but do not have the authority to manage display rights). This allows all modules to share a single display screen and the power terminal's display resources. Furthermore, the modules communicate with each other using MQTT, enabling real-time information exchange.
[0064] In this embodiment of the invention, an embedded graphics library is used to implement the display in order to provide users with a user-friendly and immediate experience. Specifically, the module that manages the allocation of display rights can use the embedded graphics library LVGL to generate and display a display control right application page in the interface of the power terminal. At least one control can be displayed on the display control right application page. These controls correspond to the functional modules that do not manage the allocation of display rights, so that users can select the information they want to know by viewing the display control right application page and clicking on the controls.
[0065] In one embodiment of the present invention, the terminal human-computer interaction method based on LVGL and MQTT further includes:
[0066] LVGL calls the hardware abstraction driver to parse the preset page styles and manages each preset page style through a linked list, and draws the corresponding page using the preset page style;
[0067] LVGL calls the hardware abstraction driver to add callback functions for each page and control.
[0068] In addition to generating a display control request page, this embodiment of the invention may also include a pop-up prompt page, and pages generated for each control after each user click, etc. These pages can all have corresponding page styles. The embedded graphics library LVGL can call the hardware abstraction driver to parse the page style corresponding to each page and manage these page styles through a linked list, as well as draw the corresponding page using a preset page style. Furthermore, the embedded graphics library LVGL can call the hardware abstraction driver to add callback functions for each page and control. When a click is detected on a control, the click operation can be responded to according to the callback function, making the response to the control faster and providing a smoother click experience for the user.
[0069] Reference Figure 2The flowchart illustrating the creation and execution of an LVGL task provided in an embodiment of the present invention is shown.
[0070] The embedded graphics library LVGL in the power terminal is initialized first. Then, LVGL can add abstract drivers for display and buttons. LVGL can then call the hardware abstract drivers to draw images, parse the default page style and manage it through a linked list so that the page can be drawn using the default page style. LVGL can also call the hardware abstract drivers to detect buttons, adding callback functions to the page and buttons so that a response can be made when a button is detected. After setting up the page and button callback functions, LVGL tasks can be created. LVGL tasks include screen drawing, real-time page switching, and real-time button response. The execution of LVGL tasks can be set to a timer, such as 10ms, 15ms, 20ms, etc., which is not limited in this invention.
[0071] In one embodiment of the present invention, the step of the module managing the allocation of display rights using LVGL to generate and display a display control right application page in the interface of the power terminal includes:
[0072] The functional module for allocating non-management display rights is defined as a control in the embedded graphics library LVGL, and the control is drawn on the same page of the power terminal interface. Callback functions are added to the page and each control to obtain the display control right application page.
[0073] The generation of the display control request page involves defining the non-management display right allocation function module as controls in the embedded graphics library LVGL, drawing these controls on the same page of the power terminal interface, and adding callback functions to the page and each control to obtain the display control request page. The various controls provided by LVGL make the terminal interface more aesthetically pleasing, and the control click interaction method based on the callback function processing mechanism is very flexible and responsive.
[0074] In one embodiment of the present invention, the terminal human-computer interaction method based on LVGL and MQTT further includes:
[0075] The non-management display rights allocation function module sends a registration request to the management display rights allocation module;
[0076] The module that manages the allocation of display rights assigns an ID to each of the functional modules that do not manage the allocation of display rights, so as to manage the functional modules that do not manage the allocation of display rights through the ID.
[0077] In this embodiment of the invention, one of the functional modules of the power terminal is defined as the module that manages the allocation of display rights, while the other functional modules are modules that have display requirements but do not have the authority to manage the allocation of display rights. In this embodiment, the module that manages the allocation of display rights can assign a unique ID to each non-management display rights module. The module manages these non-management display rights modules through the unique ID. Specifically, each non-management display rights module that already exists or is newly added in the power terminal can send a registration request to the module that manages the allocation of display rights, so that the module that manages the allocation of display rights can know that these functional modules have potential display requirements. Thus, the module that manages the allocation of display rights can assign an ID to the non-management display rights module, and then manage the display control rights of the non-management display rights module through the ID.
[0078] Step 102: The module that manages the allocation of display rights responds to the user's operation on the control, allocates display control rights to the functional module that does not manage the allocation of display rights corresponding to the control, and notifies the functional module that does not manage the allocation of display rights corresponding to the control to execute its corresponding display function through the MQTT protocol.
[0079] When the power terminal interface displays a page for requesting display control rights, users can click on the corresponding controls to view the information they want. When the module managing the allocation of display rights detects a click on a control, it can respond to the user's action according to a callback function, allocate display control rights to the corresponding non-management display control module, and notify the corresponding non-management display control module to execute its corresponding display function via the MQTT protocol. This achieves orderly allocation of display control rights for the shared display screen and timely notification of non-management display control modules to execute their corresponding display functions via MQTT messages, enabling rapid response and providing users with a user-friendly human-computer interaction experience.
[0080] Step 103: The non-management display right allocation function module corresponding to the control executes its corresponding display function and sends a display control right revocation message to the management display right allocation module via MQTT protocol after execution;
[0081] After gaining display control and receiving notification from the module managing display rights allocation, the corresponding non-managed display rights module can execute its corresponding display function. This updates the page corresponding to the displayed function on the power terminal interface, allowing users to see the desired information. Furthermore, after completing its display function, the non-managed module can send a display control revocation message to the module managing display rights allocation via the MQTT protocol. This informs the managing module that it no longer needs display permissions, allowing it to promptly reclaim display control of the shared display screen and make it available to other modules requiring display access. By managing the allocation of display control for the shared display screen, the limited display resources are allocated in an orderly and rapid manner.
[0082] Step 104: The module that manages the allocation of display rights reclaims the display control rights of the functional modules that do not manage the allocation of display rights corresponding to the control.
[0083] When the module that manages display rights allocation receives a message from the functional module that does not manage display rights corresponding to the control requesting the revocation of display control rights, it can know that the control no longer needs display permissions and can promptly revoke the display control rights of the functional module that does not manage display rights allocation to the control request.
[0084] In one embodiment of the present invention, the terminal human-computer interaction method based on LVGL and MQTT further includes:
[0085] The non-management display rights allocation module sends the target display content to the management display rights allocation module via the MQTT protocol;
[0086] The module that manages display rights allocation displays the target display content of functional modules that do not manage display rights allocation.
[0087] In this embodiment of the invention, the non-management display rights allocation functional module can also actively send its target display content to the management display rights allocation module through the MQTT protocol. That is, at this time, the non-management display rights allocation functional module does not need to obtain the display control of the display screen from the management display rights allocation module, but directly sends the content it needs to display to the management display rights allocation module, and the management display rights allocation module displays the target display content.
[0088] When the module that manages the allocation of display rights receives the target display content from a functional module that does not have the allocation of display rights, it can directly use the display control of the shared display screen to display the target display content of the functional module that does not have the allocation of display rights. This eliminates the need to allocate and reclaim display control, improves the speed of information presentation, and provides users with the information they want to view more quickly.
[0089] In one embodiment of the present invention, the terminal human-computer interaction method based on LVGL and MQTT further includes:
[0090] If no user operation on the control is detected within a preset time period during the execution of the corresponding display function by the non-management display right allocation function module corresponding to the control, the non-management display right allocation function module corresponding to the control shall return the display control.
[0091] The module that manages the allocation of display rights forcibly reclaims display control and displays a pop-up window.
[0092] During the process of a non-management display rights allocation module acquiring display control of a shared display screen and executing its corresponding display functions, users can click on controls on the real-time updated page to change the displayed content according to their actual needs. However, sometimes users may not exit the display page after obtaining the information they want or may leave early during the operation. If the display page is kept running indefinitely, it will waste resources. Therefore, the non-management display rights allocation module corresponding to the control can return the display control when no user operation on the control is detected within a preset time period. Thus, the management display rights allocation module can forcibly reclaim its display control and update the page to display a pop-up.
[0093] Reference Figure 3 The diagram illustrates a communication diagram for the allocation of management display control rights according to an embodiment of the present invention.
[0094] Modules requiring display functionality can register their IDs by sending MQTT messages to the module managing display rights. The module managing display rights can then return the registered ID to the module requiring display functionality. After ID registration is complete, the module managing display rights can respond to user key presses, send an MQTT activation notification, and allocate display control to the module requiring display functionality. If no user key press is detected within this process, the module requiring display functionality can send an active exit message to the module managing display rights, relinquishing display control. This allows the module managing display rights to forcibly reclaim display control.
[0095] This invention presents a terminal human-computer interaction method based on LVGL and MQTT. LVGL is used for display, as it occupies less memory compared to other display technologies, making it more suitable for power terminals based on embedded systems. The various controls provided by LVGL enhance the terminal's interface, and its support for button interaction and callback function handling mechanisms results in faster button responses and smoother user operation. MQTT, unlike other communication protocols, is more lightweight and simple, making it suitable for terminals based on embedded systems. This invention uses the lightweight, simple, and easy-to-implement MQTT protocol to achieve real-time and stable communication between multiple modules within the terminal. Furthermore, this invention uses one module of the power terminal to manage the allocation of display rights, enabling multiple modules within the terminal to share display resources while ensuring more orderly use of the terminal's public display resources, thus achieving a user-friendly human-computer interaction function.
[0096] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0097] Reference Figure 4 This diagram illustrates a structural block diagram of a terminal human-computer interaction device based on LVGL and MQTT provided in an embodiment of the present invention. Applied to a power terminal, the power terminal includes multiple functional modules that share a display screen. Each functional module includes a module for managing display rights allocation and at least one functional module that does not manage display rights allocation. Specifically, it may include the following modules:
[0098] The application page generation module 401, which is used to manage the allocation of display rights, uses the embedded graphics library LVGL to generate and display the display control right application page in the interface of the power terminal; the display control right application page includes at least one control, and the control corresponds to the functional module that does not manage the allocation of display rights.
[0099] The allocation module 402 is used to manage the allocation of display rights. The module responds to the user's operation on the control, allocates display control rights to the non-management display rights allocation function module corresponding to the control, and notifies the non-management display rights allocation function module corresponding to the control to execute its corresponding display function through the MQTT protocol.
[0100] The display function execution module 403 is used by the non-management display right allocation function module corresponding to the control to execute its corresponding display function and send a display control right revocation message to the management display right allocation module through the MQTT protocol after execution.
[0101] The display right reclamation module 404 is used to manage the display control rights of non-managing display right allocation functional modules corresponding to the module reclamation control of the display right allocation.
[0102] Reference Figure 5 This diagram illustrates a structural block diagram of another terminal human-computer interaction device based on LVGL and MQTT provided in an embodiment of the present invention. Applied to a power terminal, the power terminal includes multiple functional modules that share a display screen. Each functional module includes a module for managing display rights allocation and at least one functional module that does not manage display rights allocation. Specifically, it may include the following modules:
[0103] The application page generation module 501, which is used to manage the allocation of display rights, uses the embedded graphics library LVGL to generate and display the display control right application page in the interface of the power terminal; the display control right application page includes at least one control, and the control corresponds to the functional module that does not manage the allocation of display rights.
[0104] The allocation module 502 is used to manage the allocation of display rights. The module responds to the user's operation on the control, allocates display control rights to the non-management display rights allocation function module corresponding to the control, and notifies the non-management display rights allocation function module corresponding to the control to execute its corresponding display function through the MQTT protocol.
[0105] The display function execution module 503 is used by the non-management display right allocation function module corresponding to the control to execute its corresponding display function and send a display control right revocation message to the management display right allocation module through the MQTT protocol after execution.
[0106] The display right reclamation module 504 is used to manage the display control rights of non-managing display right allocation functional modules corresponding to the module reclamation control of the display right allocation.
[0107] Optionally, the terminal human-computer interaction device based on LVGL and MQTT also includes:
[0108] The page drawing management module 505 is used for LVGL to call the hardware abstraction driver to parse the preset page style and manage each preset page style through a linked list, as well as to draw the corresponding page using the preset page style;
[0109] The callback function is added to the management module 506, which is used by LVGL to call the hardware abstraction driver to add callback functions for each page and control.
[0110] Optionally, the application page generation module includes:
[0111] The application page generation submodule 5011 is used to define the non-management display right allocation function module as a control in the embedded graphics library LVGL, draw the control on the same page of the power terminal interface, and add callback functions to the page and each control to obtain the display control right application page.
[0112] Optionally, the terminal human-computer interaction device based on LVGL and MQTT also includes:
[0113] The registration request module 507 is used by non-management display right allocation functional modules to send registration requests to the management display right allocation module;
[0114] ID allocation management module 508 is used to manage the allocation of display rights and assign an ID to each functional module that does not manage the allocation of display rights, so as to manage the functional modules that do not manage the allocation of display rights through the ID.
[0115] Optionally, the terminal human-computer interaction device based on LVGL and MQTT also includes:
[0116] The display content sending module 509 is used by non-management display right allocation functional modules to send target display content to the management display right allocation module via the MQTT protocol;
[0117] The substitute display module 510 is used to manage the allocation of display rights and display the target display content of functional modules that do not manage the allocation of display rights.
[0118] Optionally, the terminal human-computer interaction device based on LVGL and MQTT also includes:
[0119] The timeout return of display rights module 511 is used to return the display control to the non-management display rights allocation function module corresponding to the control if no user operation on the control is detected within a preset time period during the execution of the corresponding display function by the non-management display rights allocation function module corresponding to the control.
[0120] The forced reclamation module 512 is used to manage the allocation of display rights, forcibly reclaim the display control rights, and display a pop-up window.
[0121] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0122] In addition, embodiments of the present invention also provide an electronic device, such as... Figure 6As shown, it includes a processor 601, a communication interface 602, a memory 603, and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.
[0123] Memory 603 is used to store computer programs;
[0124] When the processor 601 executes the program stored in the memory 603, it implements the terminal human-computer interaction method based on LVGL and MQTT as described in the above embodiments.
[0125] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0126] The communication interface is used for communication between the aforementioned terminal and other devices.
[0127] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0128] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0129] like Figure 7As shown, in another embodiment of the present invention, a computer-readable storage medium 701 is also provided, which stores instructions that, when executed on a computer, cause the computer to perform the terminal human-computer interaction method based on LVGL and MQTT described in the above embodiment.
[0130] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the terminal human-computer interaction method based on LVGL and MQTT described in the above embodiments.
[0131] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0132] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0133] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0134] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A terminal human-computer interaction method based on LVGL and MQTT, characterized in that, The method is applied to a power terminal, which includes multiple functional modules that share a display screen. Each functional module includes a module for managing display rights allocation and at least one functional module that does not manage display rights allocation. The module for managing the allocation of display rights uses the embedded graphics library LVGL to generate and display a display control right application page in the interface of the power terminal; the display control right application page includes at least one control, and the control corresponds to the functional module that does not manage the allocation of display rights. The module that manages the allocation of display rights responds to the user's operation on the control, allocates display control rights to the non-management display rights allocation function module corresponding to the control, and notifies the non-management display rights allocation function module corresponding to the control to execute its corresponding display function through the MQTT protocol; The non-management display right allocation function module corresponding to the control executes its corresponding display function and sends a display control right revocation message to the management display right allocation module via the MQTT protocol after execution; The module that manages the allocation of display rights reclaims the display control rights of the functional modules that are not assigned to manage display rights corresponding to the control; The method further includes: The LVGL calls the hardware abstraction driver to parse the preset page styles and manages each preset page style through a linked list, and draws the corresponding page using the preset page styles; The LVGL calls the hardware abstraction driver to add callback functions for each page and control; The module for managing the allocation of display rights uses LVGL to generate and display a display control right application page on the interface of the power terminal, including the following steps: The functional module for allocating non-management display rights is defined as a control in the embedded graphics library LVGL, and the control is drawn on the same page of the power terminal interface. A callback function is added to the page and each control to obtain the display control right application page.
2. The method according to claim 1, characterized in that, The method further includes: The non-management display rights allocation function module sends a registration request to the management display rights allocation module; The module that manages the allocation of display rights assigns an ID to each of the functional modules that do not manage the allocation of display rights, so as to manage the functional modules that do not manage the allocation of display rights through the ID.
3. The method according to claim 1, characterized in that, The method further includes: The non-management display rights allocation module sends the target display content to the management display rights allocation module via the MQTT protocol; The module that manages the allocation of display rights displays the target display content of the functional modules that do not manage the allocation of display rights.
4. The method according to claim 1, characterized in that, The method further includes: If no user operation on the control is detected within a preset time period during the execution of the corresponding display function by the non-management display right allocation function module corresponding to the control, the non-management display right allocation function module corresponding to the control shall return the display control. The module that manages the allocation of display rights forcibly reclaims the display control and displays a pop-up window.
5. A terminal human-computer interaction device based on LVGL and MQTT, characterized in that, An apparatus for use in a power terminal, the power terminal comprising multiple functional modules sharing a display screen, the functional modules including a module for managing display rights allocation and at least one functional module not for managing display rights allocation, the apparatus comprising: The application page generation module, used by the module for managing the allocation of display rights, uses the embedded graphics library LVGL to generate and display the display control right application page in the interface of the power terminal; the display control right application page includes at least one control, and the control corresponds to the functional module that does not manage the allocation of display rights. The allocation module is used by the module that manages the allocation of display rights to respond to the user's operation on the control, allocate display control rights to the non-management display rights allocation function module corresponding to the control, and notify the non-management display rights allocation function module corresponding to the control to execute its corresponding display function through the MQTT protocol. The display function execution module is used by the non-management display right allocation function module corresponding to the control to execute its corresponding display function and send a display control right revocation message to the management display right allocation module through the MQTT protocol after execution. The display right reclamation module is used by the module that manages the allocation of display rights to reclaim the display control rights of the functional modules that do not manage the allocation of display rights corresponding to the control. The device further includes: The page drawing management module is used for the LVGL to call the hardware abstraction driver to parse the preset page style and manage each preset page style through a linked list, and to draw the corresponding page using the preset page style; A callback function addition management module is used to add callback functions for each page and control by calling the hardware abstraction driver in LVGL. The application page generation module includes: The application page generation submodule is used to define the non-management display right allocation function module as a control in the embedded graphics library LVGL, draw the control on the same page of the power terminal interface, and add callback functions to the page and each control to obtain the display control right application page.
6. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes the program stored in the memory, it implements the terminal human-computer interaction method based on LVGL and MQTT as described in any one of claims 1-4.
7. One or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the terminal human-computer interaction method based on LVGL and MQTT as described in any one of claims 1-4.
Citation Information
Patent Citations
System and method for sharing display unit
CN101232383A
MQTT-protocol-based screen-oriented information processing system and realization method
CN107861703A
