Function module adding method, operating system, embedded device and storage medium
By dividing functional modules into clients and servers, and integrating and communicating accordingly in the operating system, the problems of high coupling and low versatility when new functional modules are added in traditional operating systems are solved, and more flexible and general functional module management is achieved.
Patent Information
- Application Number
- CN202411656932.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-04
AI Technical Summary
When adding new functional modules in traditional operating systems, they have high coupling, lack flexibility, and are incompatible on different platforms, and have low versatility.
The functional modules are divided into client and server, and are integrated into the functional integration layer and intermediate layer of the operating system respectively, so as to realize the interaction between the client and server through inter-process communication.
It realizes loose coupling between functional modules and operating systems, improves the flexibility of adding, deleting or updating functional modules, and improves the universality of functional modules between different platforms, reducing the cost and difficulty of cross-platform migration.
Smart Images

Figure CN119556963A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method for adding a functional module, an operating system, an embedded device, and a storage medium. Background Art
[0002] At present, the operating systems of some embedded devices such as smart TVs and mobile phones have begun to adopt modular design. Through modular design, the operating system can dynamically add new functional modules to meet diverse application scenarios and user needs.
[0003] However, traditionally, newly added functional modules are directly integrated into the operating system using library files or executable files, which are highly coupled with the operating system, lack flexibility, are incompatible on different platforms, and have low versatility.
[0004] In summary, how to improve the versatility and flexibility of the newly added functional modules of the operating system has become a technical problem that needs to be urgently solved in this field. Summary of the invention
[0005] The main purpose of this application is to provide a method for adding a functional module, an operating system, an embedded device and a storage medium, aiming to improve the versatility and flexibility of adding a new functional module to the operating system.
[0006] To achieve the above object, the present application proposes a method for adding a function module, which is applied to an operating system in an embedded device, wherein the operating system includes a user interface, a function integration layer and an intermediate layer, wherein the user interface, the function integration layer and the intermediate layer are connected in sequence;
[0007] The method for adding a new functional module includes:
[0008] Integrate the client of the functional module into the functional integration layer, and integrate the server of the functional module into the middle layer;
[0009] An inter-process communication is established between the client and the server, and the operation instruction corresponding to the functional module on the user interface is transmitted to the server through the client.
[0010] In one embodiment, the step of integrating the client of the functional module into the functional integration layer includes:
[0011] Creating a client of the functional module, wherein the client is in the form of a library file;
[0012] The client is integrated into the function integration layer, and the client is configured to call the function of the server in a proxy mode and is directly called by the function integration layer.
[0013] In one embodiment, the step of integrating the server of the functional module into the middle layer includes:
[0014] Create a server side of the functional module, the server side is in the form of a service process;
[0015] The server is integrated into the middle layer, and a third-party SDK is called through the server.
[0016] In one embodiment, the step of establishing inter-process communication between the client and the server includes:
[0017] Using CommonIPC code package (an inter-process communication code package) to establish inter-process communication between the client and the server;
[0018] Function calls and data transmission are performed between the client and the server by sending string instructions.
[0019] In one embodiment, after the step of establishing inter-process communication between the client and the server, the method further includes:
[0020] When the server detects a module state change, it generates state change information;
[0021] The state change information is transmitted to the client through a callback function mechanism.
[0022] In one embodiment, before the step of transmitting the operation instruction corresponding to the functional module on the user interface to the server through the client, the method further includes:
[0023] Creating interface elements corresponding to the functional modules in the user interface;
[0024] When the user interface receives an interactive operation corresponding to the functional module, an operation instruction of the interactive operation is generated, and the operation instruction is transmitted to the client.
[0025] In one embodiment, after the step of transmitting the operation instruction corresponding to the functional module on the user interface to the server through the client, the method further includes:
[0026] The server calls a third-party SDK (Software Development Kit) according to the operation instruction to perform processing and obtain a processing result;
[0027] The processing result is returned to the client.
[0028] In addition, to achieve the above-mentioned purpose, the present application also provides a function module adding device, which is applied to an operating system in an embedded device, wherein the operating system includes a user interface, a function integration layer and an intermediate layer, wherein the user interface, the function integration layer and the intermediate layer are connected in sequence; the function module adding device includes:
[0029] An integration module, used to integrate the client of the functional module into the functional integration layer, and integrate the server of the functional module into the middle layer;
[0030] The communication module is used to establish inter-process communication between the client and the server, and transmit the operation instructions corresponding to the functional module on the user interface to the server through the client.
[0031] In addition, to achieve the above-mentioned purpose, the present application also proposes an operating system, which includes a user interface, a function integration layer, an intermediate layer, a kernel layer, a driver layer and a hardware layer, wherein the function integration layer includes a client of the function module, the intermediate layer includes a server of the function module, and inter-process communication is established between the client and the server, and the operating system is used to implement the steps of the function module adding method as described above.
[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes an embedded device, which includes: an operating system, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the functional module addition method as described above.
[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the functional module adding method as described above are implemented.
[0034] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the method for adding new functional modules as described above are implemented.
[0035] The present application proposes a method for adding a functional module. The method of the present application is applied to an operating system in an embedded device. The operating system includes a user interface, a functional integration layer and an intermediate layer. The user interface, the functional integration layer and the intermediate layer are connected in sequence. The client of the functional module is integrated into the functional integration layer, and the server of the functional module is integrated into the intermediate layer. Inter-process communication is established between the client and the server, and the operation instructions corresponding to the functional module on the user interface are transmitted to the server through the client.
[0036] In summary, the present application achieves loose coupling between the functional modules and the operating system by dividing the functional modules into the client and the server, and integrating them into different levels of the operating system respectively, making the addition, deletion or update of functional modules more flexible and convenient, while improving the versatility of functional modules between different platforms and reducing the cost and difficulty of cross-platform migration. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 A flowchart of the first embodiment of the method for adding a new function module to the present application is provided;
[0040] Figure 2 A schematic diagram of the hierarchical structure of an operating system provided for the first embodiment of the method for adding a new functional module of the present application;
[0041] Figure 3 A schematic diagram of a module framework provided for the first embodiment of a method for adding a new function module to the present application;
[0042] Figure 4 This is a schematic diagram of the module structure of the newly added device for the functional module of the embodiment of the present application;
[0043] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the method for adding new functional modules in the embodiments of the present application.
[0044] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0046] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0047] At present, the operating systems of some embedded devices such as smart TVs and mobile phones have begun to adopt modular design. Through modular design, the operating system can dynamically add new functional modules to meet diverse application scenarios and user needs.
[0048] However, traditionally, newly added functional modules are directly integrated into the operating system using library files or executable files, which are highly coupled with the operating system, lack flexibility, are incompatible on different platforms, and have low versatility.
[0049] In summary, how to improve the versatility and flexibility of the newly added functional modules of the operating system has become a technical problem that needs to be urgently solved in this field.
[0050] The main solution of the embodiment of the present application is: an operating system applied to an embedded device, the operating system includes a user interface, a function integration layer and a middle layer, the user interface, the function integration layer and the middle layer are connected in sequence; the client of the function module is integrated into the function integration layer, and the server of the function module is integrated into the middle layer; inter-process communication is established between the client and the server, and the operation instructions corresponding to the function module on the user interface are transmitted to the server through the client.
[0051] In summary, the embodiment of the present application achieves loose coupling between the functional modules and the operating system by dividing the functional modules into the client and the server, and integrating them into different levels of the operating system respectively, making the addition, deletion or update of the functional modules more flexible and convenient, while improving the versatility of the functional modules between different platforms and reducing the cost and difficulty of cross-platform migration.
[0052] Based on this, the present application embodiment provides a method for adding a functional module, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the method for adding new functional modules of this application.
[0053] In this embodiment, the method for adding a function module is applied to an operating system in an embedded device, the operating system includes a user interface, a function integration layer and an intermediate layer, and the user interface, the function integration layer and the intermediate layer are connected in sequence; the method for adding a function module includes steps S10 to S20:
[0054] It should be noted that the operating system in this embodiment is compatible with multiple platforms such as the Linux platform (an operating system platform) and the Android platform. The operating system includes a user interface, a function integration layer and an intermediate layer. The user interface, the function integration layer and the intermediate layer are connected in sequence. The user interface is a window for the operating system to interact with the user. It is responsible for displaying the status information of the functional module, receiving the user's input instructions, and feeding back the processing results to the user. The function integration layer is used to integrate the client part of each functional module into the system, and the intermediate layer is used to integrate the server part of the functional module to provide services for the client of the functional module.
[0055] In addition, the operating system also includes a kernel layer, a driver layer, and a hardware layer. The hierarchical structure diagram of the operating system is shown in the following figure. Figure 2 As shown, the user interface, function integration layer, middle layer, kernel layer, driver layer and hardware layer are connected in sequence, among which the kernel layer is responsible for managing system resources, such as memory, etc., the driver layer is used to control hardware devices so that the operating system can communicate with the hardware, and the hardware layer includes the physical components of the computer, such as CPU (Central Processing Unit), memory, hard disk, etc.
[0056] The functional module in this embodiment is an independent software component used to implement specific functions in the operating system, including a client and a server. The client is used to interact with the user interface, and the server is used to perform core logical operations and data processing tasks. The functional module can be added, deleted or updated according to user needs.
[0057] Step S10, integrating the client of the functional module into the functional integration layer, and integrating the server of the functional module into the middle layer;
[0058] Integrate the client of the functional module into the functional integration layer of the operating system to ensure that the functional module can interact directly and efficiently with the user interface to respond to various user operation instructions.
[0059] The server of the functional module is integrated into the middle layer of the operating system, and the server can be called by the client to execute the corresponding functions of the functional module.
[0060] In a feasible embodiment, the step of "integrating the client of the functional module into the functional integration layer" in step S10 may include steps S101 to S102:
[0061] Step S101, creating a client of the functional module, the client is in the form of a library file;
[0062] According to the specific needs of the functional module, the corresponding client is created and designed as a library file, which helps to achieve code reuse and modularization, and facilitates integration and calling in the functional integration layer.
[0063] Among them, the client in the form of a library file usually includes a series of predefined interfaces and functions, which are used to interact with the user interface and receive operation instructions from the user interface.
[0064] Step S102, integrating the client into the function integration layer, and configuring the client to call the functions of the server in proxy mode, and be directly called by the function integration layer.
[0065] After the functional module client is created, it is integrated into the functional integration layer of the operating system, and the client is configured to call the server's functions in proxy mode. By configuring it in proxy mode, the client can call the server's functions.
[0066] In a feasible embodiment, the step of "integrating the server of the functional module into the middle layer" in step S10 may include steps S103 to S104:
[0067] Step S103, creating a server side of the functional module, the server side is in the form of a service process;
[0068] Create a server corresponding to the functional module. The server is designed as a service process, which helps to achieve loose coupling between the server and the client, while improving the stability and scalability of the operating system. The server in the form of a service process contains a series of background processes to perform logical operations and data processing tasks of the functional module.
[0069] Step S104, integrating the server into the middle layer, and calling the third-party SDK through the server.
[0070] After the server is created, it is integrated into the middle layer of the operating system, and the server calls the third-party SDK to implement the specific functions of the functional module.
[0071] Among them, third-party SDKs usually provide a series of predefined interfaces and functions, which are used to implement specific functions or services of functional modules. By calling third-party SDKs, the server can more efficiently implement the logical operations and data processing tasks of functional modules, while improving the compatibility and scalability of the operating system.
[0072] Step S20, establishing inter-process communication between the client and the server, and transmitting the operation instructions corresponding to the function modules on the user interface to the server through the client.
[0073] Inter-process communication is established between the client and server of the functional module to ensure that information can be transmitted between the client and the server in real time and accurately, so as to realize the collaborative work of the functional modules. When the user initiates an operation on the functional module through the user interface, the corresponding operation instruction will be obtained by the client, and then transmitted to the server through inter-process communication, and the server will perform the corresponding operation.
[0074] In a feasible embodiment, step S20 may include steps S201 to S202:
[0075] Step S201, using CommonIPC code package to establish inter-process communication between the client and the server;
[0076] It should be noted that CommonIPC can provide a complete communication mechanism and interface to support data exchange and function calls between different processes.
[0077] In order to achieve efficient communication between the client and the server, the relevant functions and interfaces in CommonIPC are used to create inter-process communication between the client and the server, so that the client and the server can transmit operation instructions, function parameters, return results and other data in real time and accurately, and realize the collaborative work of functional modules.
[0078] Step S202: Function calls and data transmission are performed between the client and the server by sending string instructions.
[0079] After establishing the inter-process communication between the client and the server of the functional module, function calls and data transmission are performed by sending string instructions, wherein the string instruction may include information such as the function name, parameter list, and return value.
[0080] After the client receives the operation instructions on the user interface, it encapsulates these instructions into a string form and sends them to the server through inter-process communication. After receiving the string instructions, the server will parse and process them, execute the corresponding function and return the result.
[0081] For example, in a feasible implementation, taking the functional module as a karaoke module as an example, the module framework is as follows: Figure 3 As shown, the karaoke client is integrated into the function integration layer of the operating system. The client can monitor karaoke events, such as song playing, pausing, and ending. The karaoke server is integrated into the middle layer of the operating system. The client calls the server's functions through inter-process communication. The server can call a third-party SDK, namely the loostoneSDK in the figure. The loostoneSDK is used to support the functions of the karaoke service, such as audio processing, network communication, etc.
[0082] The following is an example of opening an item in the karaoke module menu: The client executes the function in proxy mode as follows:
[0083]
[0084] The above part is used to illustrate the process communication between the client and the server. The above functions are used to implement the cross-process call of the karaoke module. Among them, "std::lock_guard <std::mutex>"lock(mutex_)" is used to use the mutex lock mutex_ to ensure that the execution of the function in a multi-threaded environment is thread-safe; "CHECK_SVC(false)" is used to check whether the service is available or initialized. If the service is not available, the function returns false; "Json::Valuecmd,resp" defines two Json::Value objects, cmd is used to construct the command sent to the server, and resp is used to receive the response from the server; "ret=g_IPCClient->sendCmd(cmd,resp)" is used to send the command cmd through the global IPC client object g_IPCClient and receive the response resp from the server. The function returns true to indicate that the command was successfully sent and processed by the server, otherwise it returns false; the function finally returns ret, that is, whether the command was sent and processed successfully.
[0085] The karaoke function is implemented on the server side. The specific functions executed by the server side are as follows:
[0086] boolKaraOKeService::enable(constJson::Value¶m,Json::Value&resp)
[0087] {
[0088] std::lock_guard <std::mutex>lock(mutex_);
[0089] if(isEnable_){
[0090] returntrue;
[0091] }
[0092] std::list <micdeviceinfo>list;
[0093] if(!usbMicMonitor_->getDeviceList(&list)||list.size()<1){
[0094] returnfalse;
[0095] }
[0096] MicDeviceInfoinfo=list.front();
[0097] isLoostoneMic_=isLoostoneMic(info);
[0098] if (isLoostoneMic_) {
[0099] loostoneInit();
[0100] isEnable_=true;
[0101] }
[0102] returntrue;
[0103] }.
[0104] Among them, the server also uses "std::lock_guard <std::mutex>lock(mutex_)" to ensure the thread safety of the function in a multi-threaded environment; "if(isEnable_){returntrue;}" means that if the karaoke function is enabled, it will directly return true without doing anything; "std::list <micdeviceinfo>list" defines a list to store microphone device information; "if(!usbMicMonitor_->getDeviceList(&list)||list.size()<1){returnfalse;}" expresses obtaining the microphone device list through the usbMicMonitor_ object. If the acquisition fails or the list is empty, false is returned; "MicDeviceInfoinfo=list.front()" means obtaining the first microphone device information from the list; "isLoostoneMic_=isLoostoneMic(info)" is used to determine whether the microphone is of a specific brand. If it is a microphone of a specific brand, loostoneInit() is called for initialization, and isEnable_ is set to true, indicating that the karaoke function is enabled; the function finally returns true, indicating that the karaoke function is successfully enabled (unless it fails when checking the microphone device list).
[0105] It is worth mentioning that "g_IPCClient->sendCmd(cmd,resp)" is used to complete the inter-process call and send the function actually implemented by the server through a string. This mainly relies on the CommonIPC code package. After the local object receives the corresponding string, it will call the server function through the connection established between the client and the server during initialization. A third-party SDK is used here, so the specific function is implemented by the server calling the third party. Thus, the client sends a command to enable the karaoke function to the server through the IPC mechanism. After receiving the command, the server checks the current status, obtains the microphone device list, selects and initializes the microphone, and finally completes the activation of the karaoke function.
[0106] In summary, the embodiment of the present application achieves loose coupling between the functional modules and the operating system by dividing the functional modules into the client and the server, and integrating them into different levels of the operating system respectively, making the addition, deletion or update of the functional modules more flexible and convenient, while improving the versatility of the functional modules between different platforms and reducing the cost and difficulty of cross-platform migration.
[0107] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be described in detail later. On this basis, after the step of "establishing inter-process communication between the client and the server" in step S20, steps S30 to S40 may also be included:
[0108] Step S30, when the server detects a module state change, it generates state change information;
[0109] When the server is executing logical operations or data processing tasks of a functional module, the server can monitor the internal state or hardware status of the functional module. After the server detects state changes such as data update and hardware plug-in and pull-out, the server can generate corresponding state change information based on these module state changes. The state change information may include data such as the state change type, timestamp, and related parameters.
[0110] Step S40: passing the state change information to the client through the callback function mechanism. After the server generates the state change information, the callback function mechanism is used to pass the state change information from the server to the client. After receiving the state change information, the client will perform corresponding processing according to the type and content of the information, such as updating the user interface, recording logs, triggering warnings, etc.
[0111] Through the callback function mechanism, two-way communication between the server and the client can be achieved, ensuring the real-time transmission and response of state change information, thereby improving the stability of the functional module in the operating system.
[0112] The following uses the karaoke module to detect changes in the port plug-in and unplug status as an example. The server predefines the interface as follows:
[0113] voideventCallback(KaraOKeEvtevtId,Json::Value&data);
[0114] voidKaraOKeService::onPlugEvent(PlugStatestate,MicDeviceInfo&info){
[0115] casePlugState::PLUGIN:
[0116] eventCallback(KaraOKeEvt::PLUGIN,data);
[0117] break;
[0118] casePlugState::PLUGOUT:
[0119] eventCallback(KaraOKeEvt::PLUGOUT,data);
[0120] break;
[0121] }.
[0122] When the server detects a change in the port plug-in or unplug-out status, it calls back the message to the client through eventCallback to notify the function integration layer of hardware plug-in or unplug-out operations. The server executes the following function:
[0123] typedefvoid(*KaraOKeCallback)(intevt,constJson::Value&data);
[0124] staticvoidkaraOKeCallback(intevt,constJson::Value&data)
[0125] {
[0126] LOGGER_DEBUG(LX("karaOKeCallback").d("evt",evt));
[0127] switch((KaraOKeEvt)evt){
[0128] caseKaraOKeEvt::PLUGIN:
[0129] KaraOKeManager::getInstance()->setKaraOKeDeviceMSG(MIC_USB_PL UGIN);
[0130] break;
[0131] caseKaraOKeEvt::PLUGOUT:
[0132] KaraOKeManager::getInstance()->setKaraOKeDeviceMSG(MIC_USB_PL UGOUT);
[0133] break;
[0134] }
[0135] }.
[0136] Specifically, after the karaoke process is started, there will be a usbMicMonitorThread thread that has been detecting the plugging and unplugging of the microphone hardware device of the USB interface / LINEIN interface. Once the state changes, onPlugEvent(state,info) will be called; the event will pass the message to the client through eventCallback(KaraOKeEvt::PLUGIN,data). The client implements this function in the function integration layer, so that the state changes of the device plugging and unplugging can be detected normally.
[0137] In a feasible embodiment, before the step of "transmitting the operation instruction corresponding to the function module on the user interface to the server through the client" in step S20, steps A10 to A20 are also included:
[0138] Step A10, creating interface elements corresponding to the functional modules in the user interface;
[0139] In order to realize the interaction between the user and the functional module, an interface element corresponding to the functional module is created in the user interface. The interface element may include icons, buttons, input boxes, sliders, drop-down menus, etc., depending on the functional requirements of the functional module and the user's interaction habits. This is not specifically limited in this embodiment. The interface element serves as the entry point for the user to interact with the functional module and is used to receive the user's interactive operation.
[0140] Step A20: When the user interface receives an interactive operation corresponding to the functional module, an operation instruction of the interactive operation is generated and the operation instruction is transmitted to the client.
[0141] When the user interacts with the functional module through interface elements, such as clicking a button, entering text, dragging a slider, etc., the user interface will detect these interactive operations and generate corresponding operation instructions, which may include information such as the operation type, operation object, and operation parameters, so that the server of the functional module can accurately understand and execute the corresponding function. After the operation instruction is generated, it is passed to the client, which sends it to the server through inter-process communication for processing.
[0142] In a feasible embodiment, after the step of "transmitting the operation instruction corresponding to the function module on the user interface to the server through the client" in step S20, steps B10 to B20 are also included:
[0143] Step B10, the server calls the third-party SDK according to the operation instruction to perform processing and obtain the processing result;
[0144] After receiving the operation instruction from the client, the server calls the corresponding third-party SDK (software development kit) for processing. The third-party SDK can be provided by the manufacturer corresponding to the functional module and is used to implement the corresponding functions of the functional module. At the same time, the server can obtain the processing results, which can be function execution results, module status change information, error prompts and other information.
[0145] Step B20, returning the processing result to the client.
[0146] After the server completes the processing task, it returns the processing result to the client through the previously established inter-process communication. After receiving the processing result, the client will perform corresponding processing according to the content of the result, such as updating the display information on the user interface, triggering subsequent operation processes, etc. In this way, a complete interactive closed loop is formed between the server and the client, ensuring the accurate transmission of operation instructions and timely feedback of processing results.
[0147] In summary, in this embodiment, the CommonIPC code package is used to establish stable inter-process communication between the client and server of the functional module, ensuring the efficient and secure data transmission between the client and the server. The server uses a third-party SDK to perform data processing related to the functional module, which not only improves the accuracy and efficiency of processing tasks, but also enhances the stability and reliability of the operating system. After the processing is completed, the server returns the results to the client in real time, realizing instant feedback of operation information and rapid response of the system.
[0148] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the new methods of the functional modules of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0149] An embodiment of the present application also provides an operating system, which includes a user interface, a function integration layer, an intermediate layer, a kernel layer, a driver layer and a hardware layer, wherein the function integration layer includes a client of the function module, the intermediate layer includes a server of the function module, and inter-process communication is established between the client and the server.
[0150] The operating system provided in the embodiment of the present application adopts the method for adding function modules in the above embodiment, which can improve the versatility and flexibility of the newly added function modules in the operating system. Compared with the prior art, the beneficial effects of the operating system provided in the embodiment of the present application are the same as the beneficial effects of the method for adding function modules provided in the above embodiment, and other technical features in the operating system are the same as the features disclosed in the method for adding function modules in the previous embodiment, which will not be described in detail here.
[0151] The embodiment of the present application also provides a function module adding device, which is applied to an operating system in an embedded device. The operating system includes a user interface, a function integration layer and an intermediate layer. The user interface, the function integration layer and the intermediate layer are connected in sequence. Please refer to Figure 4 , the new functional modules include:
[0152] Integration module 10, used to integrate the client of the functional module into the functional integration layer, and integrate the server of the functional module into the middle layer;
[0153] The communication module 20 is used to establish inter-process communication between the client and the server, and transmit the operation instructions corresponding to the function modules on the user interface to the server through the client.
[0154] Optionally, the integrated module 10 is further used for:
[0155] Create a client for the functional module, which is in the form of a library file;
[0156] Integrate the client into the function integration layer, and configure the client to call the server's functions in proxy mode and be called directly by the function integration layer.
[0157] Optionally, the integrated module 10 is further used for:
[0158] Create the server side of the functional module, which is in the form of a service process;
[0159] Integrate the server into the middle layer and call the third-party SDK through the server.
[0160] Optionally, the communication module 20 is further used for:
[0161] Use CommonIPC code package to establish inter-process communication between client and server;
[0162] Function calls and data transmission are performed between the client and the server by sending string instructions.
[0163] Optionally, the communication module 20 is further used for:
[0164] When the server detects a module status change, it generates status change information;
[0165] The status change information is transmitted to the client through the callback function mechanism.
[0166] Optionally, the integrated module 10 is further used for:
[0167] Create interface elements corresponding to functional modules in the user interface;
[0168] When the user interface receives an interactive operation corresponding to the functional module, an operation instruction of the interactive operation is generated and the operation instruction is transmitted to the client.
[0169] Optionally, the communication module 20 is further used for:
[0170] The server calls the third-party SDK according to the operation instructions to process and obtain the processing results;
[0171] The processing result is returned to the client.
[0172] The function module adding device provided by the present application adopts the function module adding method in the above embodiment, which can improve the versatility and flexibility of the new function module in the operating system. Compared with the prior art, the beneficial effects of the function module adding device provided by the present application are the same as the beneficial effects of the function module adding method provided by the above embodiment, and other technical features in the function module adding device are the same as the features disclosed in the above embodiment method, which will not be described in detail here.
[0173] An embodiment of the present application provides an embedded device, which includes: an operating system; at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for adding functional modules in the above-mentioned embodiment one.
[0174] Reference below Figure 5 , which shows a schematic diagram of the structure of an embedded device suitable for implementing the embodiment of the present application. The embedded device in the embodiment of the present application can be a control host computer. Figure 5 The embedded device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0175] like Figure 5 As shown, the embedded device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the embedded device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the embedded device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an embedded device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0176] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0177] The embedded device provided in the embodiment of the present application adopts the method for adding a function module in the above embodiment, which can improve the versatility and flexibility of adding a function module to the operating system. Compared with the prior art, the beneficial effects of the embedded device provided in the embodiment of the present application are the same as the beneficial effects of the method for adding a function module provided in the above embodiment, and other technical features in the embedded device are the same as the features disclosed in the method for adding a function module in the previous embodiment, which will not be described in detail here.
[0178] It should be understood that the various parts disclosed in the embodiments of the present application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0179] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0180] An embodiment of the present application provides a computer-readable storage medium having computer-readable program instructions (ie, a computer program) stored thereon, wherein the computer-readable program instructions are used to execute the method for adding a functional module in the above embodiment.
[0181] The computer-readable storage medium provided in the embodiment of the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0182] The computer-readable storage medium may be included in an embedded device, or may exist independently without being installed in the embedded device.
[0183] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the embedded device, the embedded device: integrates the client of the functional module into the functional integration layer, and integrates the server of the functional module into the middle layer; establishes inter-process communication between the client and the server, and transmits the operation instructions corresponding to the functional module on the user interface to the server through the client.
[0184] The computer program code for performing the operation of the embodiment of the present application can be written in one or more programming languages or a combination thereof, and the above-mentioned programming languages include object-oriented programming languages, such as Java, Smalltalk, C++, and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN: Local Area Network) or a wide area network (WAN: Wide Area Network), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).
[0185] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0186] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0187] The readable storage medium provided in the embodiment of the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned method for adding functional modules, and can improve the versatility and flexibility of the new functional modules of the operating system. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the embodiment of the present application are the same as the beneficial effects of the method for adding functional modules provided in the above-mentioned embodiment, and will not be described in detail here.
[0188] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned method for adding new functional modules when the computer program is executed by a processor.
[0189] The computer program product provided by this application can improve the versatility and flexibility of the newly added function modules of the operating system. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the function module addition method provided by the above embodiment, which will not be repeated here.
[0190] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.< / micdeviceinfo> < / std::mutex> < / micdeviceinfo> < / std::mutex> < / std::mutex>
Claims
1. A method for adding a functional module, characterized in that: An operating system applied to an embedded device, the operating system comprising a user interface, a function integration layer and an intermediate layer, the user interface, the function integration layer and the intermediate layer being connected in sequence; The method for adding a new functional module includes: Integrate the client of the functional module into the functional integration layer, and integrate the server of the functional module into the middle layer; An inter-process communication is established between the client and the server, and the operation instruction corresponding to the functional module on the user interface is transmitted to the server through the client.
2. The method for adding a functional module according to claim 1, characterized in that: The step of integrating the client of the functional module into the functional integration layer includes: Creating a client of the functional module, wherein the client is in the form of a library file; The client is integrated into the function integration layer, and the client is configured to call the function of the server in a proxy mode and is directly called by the function integration layer.
3. The method for adding a functional module according to claim 1, characterized in that: The step of integrating the server of the functional module into the middle layer includes: Create a server side of the functional module, the server side is in the form of a service process; The server is integrated into the middle layer, and a third-party SDK is called through the server.
4. The method for adding a functional module according to claim 1, characterized in that: The step of establishing inter-process communication between the client and the server includes: Using CommonIPC code package to establish inter-process communication between the client and the server; Function calls and data transmission are performed between the client and the server by sending string instructions.
5. The method for adding a functional module according to claim 1, characterized in that: After the step of establishing inter-process communication between the client and the server, the method further includes: When the server detects a module state change, it generates state change information; The state change information is transmitted to the client through a callback function mechanism.
6. The method for adding a functional module according to claim 1, characterized in that: Before the step of transmitting the operation instruction corresponding to the functional module on the user interface to the server through the client, the method further includes: Creating interface elements corresponding to the functional modules in the user interface; When the user interface receives an interactive operation corresponding to the functional module, an operation instruction of the interactive operation is generated, and the operation instruction is transmitted to the client.
7. The method for adding a functional module according to claim 1, characterized in that: After the step of transmitting the operation instruction corresponding to the functional module on the user interface to the server through the client, the method further includes: The server calls the third-party SDK to perform processing according to the operation instruction to obtain the processing result; The processing result is returned to the client.
8. An operating system, characterized in that: The operating system includes a user interface, a function integration layer, an intermediate layer, a kernel layer, a driver layer and a hardware layer, wherein the function integration layer includes a client of a function module, the intermediate layer includes a server of a function module, and inter-process communication is established between the client and the server. The operating system is used to implement the steps of the function module adding method as described in any one of claims 1 to 7.
9. An embedded device, characterized in that: The embedded device comprises: an operating system, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for adding a functional module as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the method for adding a functional module as described in any one of claims 1 to 7 are implemented.