Dictionary pen application framework and dictionary pen
By introducing I/O multiplexing modules, RPC modules, timers and plug-in managers into the dictionary pen application framework, the problem of poor expansion performance of the dictionary pen application framework is solved, and efficient resource utilization and development efficiency are achieved.
Patent Information
- Application Number
- CN202311870306.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-12-24
AI Technical Summary
The existing dictionary pen application framework has poor expansion performance, resulting in wasted system resources and occupies a lot of system memory and CPU resources when processing events, affecting development efficiency.
A dictionary pen application framework is designed, including I/O multiplexing module, RPC module, timer, event loop mechanism and plug-in manager. The system overhead is reduced through I/O multiplexing module, providing scalable functional expansion, and Improve team development efficiency through plug-in manager.
It effectively reduces system overhead, avoids resource waste, provides developers with scalable function expansion, and improves team development efficiency.
Smart Images

Figure CN119179465A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of intelligent devices, and in particular to a dictionary pen application framework and a dictionary pen. Background Art
[0002] In recent years, smart dictionary pens have emerged in the education industry. Querying unfamiliar Chinese and English words is a basic need for primary and secondary school students. Scan the words you want to know with the dictionary pen, and the dictionary pen will display the meaning of the corresponding words on the screen of the dictionary pen. The operation is relatively simple and fast. The dictionary pen has the function of querying the dictionary. There is no need to manually enter the text. You can directly scan the text through optical character recognition (OCR) technology to query the dictionary and obtain the query results of the text. Compared with paper dictionaries, electronic dictionaries, dictionary applications, etc., the dictionary pen is simpler, faster and more convenient in realizing the function of querying the dictionary.
[0003] At present, the application framework of the dictionary pen has poor scalability, and occupies a lot of system memory and CPU resources during event processing, resulting in a large amount of resource waste. Summary of the invention
[0004] The embodiments of the present invention provide a dictionary pen application framework and a dictionary pen, which can provide developers with scalable functional expansion, reduce system overhead, and improve team development efficiency.
[0005] In a first aspect, an embodiment of the present invention provides a dictionary pen application framework, based on which a developer develops a dictionary pen application, the dictionary pen application framework comprising: an I / O multiplexing module, an RPC module, a timer, an event loop mechanism and a plug-in manager;
[0006] The I / O multiplexing module is used to process and / or monitor application I / O events in the execution sequence of each thread;
[0007] The RPC module is used to provide communication between different threads to expand the various capabilities of the application and call different threads to process monitored application I / O events;
[0008] The timer is used to provide a timing function for processing application I / O events, and notify the application to perform a callback after the processing timeout;
[0009] The event loop mechanism is used to process the application event queue and distribute application I / O events, and trigger callbacks associated with application I / O events;
[0010] The plug-in manager is used to store and manage plug-ins.
[0011] Optionally, the I / O multiplexing module is further used to trigger the LVGL clock when processing an application I / O event in the execution sequence of each thread.
[0012] Optionally, the RPC module is Dbus based on the Libdbus function library.
[0013] Optionally, the dictionary pen application framework uses a descriptor to centrally manage the timer.
[0014] Optionally, various functions in the dictionary pen application framework are provided by way of plug-ins.
[0015] Optionally, the plug-in complies with an interface definition.
[0016] In a second aspect, an embodiment of the present invention provides a dictionary pen, comprising a dictionary pen application framework as described in any one of claims 1 to 6.
[0017] In the embodiment of the present invention, a dictionary pen application framework is provided. A developer develops a dictionary pen application based on the dictionary pen application framework. The dictionary pen application framework includes: an I / O reuse module, an RPC module, a timer, an event loop mechanism, and a plug-in manager. The I / O reuse module is used to process and / or monitor application I / O events in the execution sequence of each thread. The RPC module is used to provide communication between different threads to expand the multiple capabilities of the application and call different threads to process the monitored application I / O events. The timer is used to provide a timing function for processing application I / O events and notify the application to make a callback after the processing timeout. The event loop mechanism is used to process the application event queue and distribute the application I / O events, and trigger the callback associated with the application I / O events. The plug-in manager is used to store and manage plug-ins. The I / O reuse module is used to reduce system overhead and avoid waste of resources. The plug-in manager manages the plug-in to provide developers with scalable functional extensions. At the same time, it can provide parallel development for the team and improve the team development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A schematic diagram of the structure of a dictionary pen provided by an embodiment of the present invention;
[0020] Figure 2 A schematic diagram of the structure of a dictionary pen application framework provided by an embodiment of the present invention;
[0021] Figure 3 A schematic diagram of the execution flow of a dictionary pen application framework provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] First, Figure 1 Taking the structure shown as an example, the dictionary pen applicable to the embodiment of the present invention is introduced. In the embodiment of the present invention, the dictionary pen 100 may include but is not limited to a processor, a memory, an audio circuit, an input unit, a communication module, a display unit, a sensor and other components.
[0024] Among them, those skilled in the art can understand that Figure 1 The structure of the dictionary pen 100 shown in the figure is only an example and not a limitation. The dictionary pen 100 may also include more or fewer components than those shown in the figure, or combine certain components, or arrange the components differently.
[0025] The processor 110 is the control center of the dictionary pen 100, and uses various interfaces and lines to connect various parts of the entire dictionary pen 100. By running or executing software programs and / or modules stored in the memory 120, and calling data stored in the memory 120, the processor 110 performs various functions of the dictionary pen 100 and processes data, thereby monitoring the dictionary pen 100 as a whole. Optionally, the processor 110 may include one or more processing units; preferably, the processor 110 may integrate an application processor, wherein the application processor mainly processes the operating system, user interface, and application programs.
[0026] The memory 120 can be used to store software programs and modules. The processor 110 executes various functional applications and data processing of the dictionary pen 100 by running the software programs and modules stored in the memory 120. The memory 120 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the dictionary pen 100 (such as audio data, a phone book, etc.), etc. In addition, the memory 120 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0027] The audio circuit 130 may include a speaker and a microphone, and may provide an audio interface between the user and the dictionary pen 100. The audio circuit 130 may transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 130 and converted into audio data, and then the audio data is output to the processor 110 for processing, and then the audio data is output to the memory 120 for further processing.
[0028] The input unit 140 can be used to receive input digital or character information, and to generate key signals related to user settings and function control of the dictionary pen 100. Specifically, the input unit 140 may include a touch panel, a camera device, and other input devices. The camera device can take a photo or scan the image to be acquired, so as to transmit the image to the processor 110 for processing, and finally present the processed graphics to the user through the display panel. The touch panel, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on or near the touch panel using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact point coordinates, and then sends it to the processor 110, and can receive and execute commands sent by the processor 110. In addition, the touch panel can be implemented by various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel and the camera device, the input unit 140 can also include other input devices. Specifically, the other input devices 132 can include but are not limited to one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a joystick, etc.
[0029] The communication module 150 is mostly a wireless communication method, which may include one or more short-range wireless transmission technologies such as WiFi, Bluetooth, NFC, etc. The dictionary pen 100 can help users transmit data, access the Internet, etc. through the communication module 150.
[0030] The display unit 160 may be used to display information input by the user or information provided to the user and various menus of the dictionary pen 100. The display unit 160 may include a display panel. Optionally, the display panel may be configured in the form of a liquid crystal display unit (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 131 may cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 110 to determine the type of the touch event, and then the processor 110 provides a corresponding visual output on the display panel according to the type of the touch event.
[0031] The visual output external display panel that can be recognized by the human eye can be used as a display device in the embodiment of the present invention to display text information or image information. Although the touch panel and the display panel are two independent components to realize the input and output functions of the dictionary pen 100, in some embodiments, the touch panel and the display panel can be integrated to realize the input and output functions of the dictionary pen 100.
[0032] In addition, the dictionary pen 100 may further include at least one sensor 170 , such as a gesture sensor, a distance sensor, a light sensor, and other sensors.
[0033] Specifically, the posture sensor can also be called a motion sensor, and as one of the motion sensors, an angular velocity sensor (also called a gyroscope) can be listed. When it is configured in the dictionary pen 100, it is used to measure the rotational angular velocity of the dictionary pen 100 in the deflection and tilt state. Thus, the gyroscope can accurately analyze and determine the actual action of the user using the dictionary pen 100, and then perform corresponding operations on the dictionary pen 100. For example: body feeling, shake (shaking the dictionary pen 100 to achieve some functions).
[0034] The sensor 170 may also be a light sensor, which is mainly used to collect information such as the wavelength and intensity of various light rays to adjust the backlight intensity of the display panel.
[0035] The dictionary pen 100 further includes a power source (not shown) for supplying power to various components.
[0036] Preferably, the power supply can be logically connected to the processor 110 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system.
[0037] Based on the above structure, Figure 2The structure of a dictionary pen application framework provided by an embodiment of the present invention is exemplarily shown. The dictionary pen application framework 200 may include an I / O multiplexing module 210, an RPC module 220, a timer 230, an event loop mechanism 240 and a plug-in manager 250.
[0038] Among them, the I / O multiplexing module is used to process and / or monitor the application I / O events in the execution sequence of each thread; the RPC module is used to provide communication between different threads to expand the various capabilities of the application and call different threads to process the monitored application I / O events; the timer is used to provide a timing function for processing application I / O events and notify the application to make a callback after the processing timeout; the event loop mechanism is used to process the application event queue and distribute application I / O events, and trigger the callbacks associated with the application I / O events; the plug-in manager is used to store and manage plug-ins.
[0039] The core of the application framework provided in the embodiment of the present invention adopts the "object-based" programming concept to realize I / O reuse. It mainly relies on the I / O event framework of the operating system kernel, for example, it can include functions such as poll, epoll, select, etc. The execution sequence of each thread (generally the main thread) is an I / O reuse process.
[0040] The above I / O multiplexing module is also used to trigger the LVGL clock when processing the application I / O events in the execution sequence of each thread. One of the functions of I / O multiplexing is to trigger the LVGL clock when the thread is "idle". Because sleep will increase the system overhead, it is not used in the embodiment of the present invention.
[0041] The main responsibility of the I / O multiplexing module is "event monitoring", for example, when a run in main operation is required (a function is requested by a child thread to be executed in the main thread), this operation is constructed as a C language structure stack pointer, and this pointer is passed to the main thread through methods such as pipes, and the read end of the pipe needs to be monitored, that is, the read event is monitored.
[0042] The RPC module is Dbus based on the Libdbus library. Embedded system applications such as dictionary pens usually require RPC, and the most efficient one is Dbus. The asynchronous message processing of the Libdbus library also provides file descriptors. In this way, you can monitor its read (write) events, and it is very convenient to integrate the Dbus communication capability into the framework, and then into the corresponding application. When there is a need for Log (or other capabilities), it is also very convenient to add Log capabilities, and the framework code does not need to be modified.
[0043] The dictionary pen application framework uses a descriptor to centrally manage the timer. 5. Any application will use the timer function more or less (although many waits do not seem so reliable). This framework only uses a file descriptor to centrally manage the timer (using too many file descriptors will inevitably lead to reduced system performance). The application only needs to call the interface to tell the framework when to time out and register the timeout callback.
[0044] The Dictionary Pen application framework is an application framework that integrates the background and front-end UI, and must have an event loop mechanism. The responsibility of the event loop mechanism is to process the event queue, distribute events, and then trigger event-related callbacks. In this way, events in the application are handled in an orderly manner.
[0045] The various functions in the dictionary pen application framework are provided by plug-ins. Plug-ins follow the interface definition. Plug-ins are essentially dynamic libraries, but the framework needs a plug-in manager to manage them, and plug-ins need to follow the interface definition. Here, there are required interfaces for returning file descriptors, readable (write) callback interfaces, and processing result notification interfaces.
[0046] Based on the above dictionary pen application framework, Figure 3 The execution process of the application framework is shown, which specifically includes:
[0047] Step 301, start executing the framework sequence.
[0048] Step 302 , determine whether the monitored registered application I / O event is readable, if so, proceed to step 303 , otherwise proceed to step 304 .
[0049] Step 303: Read the channel information corresponding to the application I / O event.
[0050] Step 304, refresh the LVGL clock.
[0051] Step 305: Call back the corresponding processing function.
[0052] Step 306, determine whether the exit operation is triggered, if so, proceed to step 307, otherwise proceed to step 308.
[0053] Step 307, exit.
[0054] Step 308 , determine whether there is a low priority task, if so, proceed to step 309 , otherwise proceed to step 302 .
[0055] Step 309: Process low priority tasks.
[0056] The above embodiments show that the dictionary pen application framework, developers develop dictionary pen applications based on the dictionary pen application framework, and the dictionary pen application framework includes: an I / O reuse module, an RPC module, a timer, an event loop mechanism, and a plug-in manager. The I / O reuse module is used to process and / or monitor application I / O events in the execution sequence of each thread, and the RPC module is used to provide communication between different threads to expand the multiple capabilities of the application, and call different threads to process the monitored application I / O events. The timer is used to provide a timing function for processing application I / O events, and notifies the application to make a callback after the processing timeout. The event loop mechanism is used to process the application event queue and distribute application I / O events, and trigger the callback associated with the application I / O event. The plug-in manager is used to store and manage plug-ins. The I / O reuse module is used to reduce system overhead and avoid waste of resources. The plug-in manager manages the plug-in to provide developers with scalable functional extensions, and can provide parallel development for the team to improve the team development efficiency.
[0057] On the basis of the above-mentioned dictionary pen application framework, an embodiment of the present invention further provides a dictionary pen, including the above-mentioned dictionary pen application framework.
[0058] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0059] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0060] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0061] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0062] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A dictionary pen application framework, characterized in that: The developer develops a dictionary pen application based on the dictionary pen application framework, which includes: an I / O multiplexing module, an RPC module, a timer, an event loop mechanism, and a plug-in manager; The I / O multiplexing module is used to process and / or monitor application I / O events in the execution sequence of each thread; The RPC module is used to provide communication between different threads to expand the various capabilities of the application and call different threads to process monitored application I / O events; The timer is used to provide a timing function for processing application I / O events, and notify the application to perform a callback after the processing timeout; The event loop mechanism is used to process the application event queue and distribute application I / O events, and trigger callbacks associated with application I / O events; The plug-in manager is used to store and manage plug-ins.
2. The dictionary pen application framework as claimed in claim 1, characterized in that: The I / O multiplexing module is also used to trigger the LVGL clock when processing application I / O events in the execution sequence of each thread.
3. The dictionary pen application framework as claimed in claim 1, characterized in that: The RPC module is Dbus based on the Libdbus function library.
4. The dictionary pen application framework as claimed in claim 1, characterized in that: The dictionary pen application framework uses a descriptor to centrally manage the timer.
5. The dictionary pen application framework as claimed in claim 1, characterized in that: Various functions in the dictionary pen application framework are provided in the form of plug-ins.
6. The dictionary pen application framework as claimed in claim 5, characterized in that: The plugin complies with the interface definition.
7. A dictionary pen, characterized in that: It comprises the dictionary pen application framework as described in any one of claims 1 to 6.
