In-device communication method and device, electronic device and storage medium
By introducing proxy modules and different communication protocols in electronic devices, decoupling the direct communication between UI modules and functional modules, the coupling problem caused by the difference in data format between UI modules and functional modules is solved, and the portability and ability of the system are improved Scalability simplifies the development process.
Patent Information
- Application Number
- CN202310751102.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-25
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2043-06-25
AI Technical Summary
In electronic devices, the data formats between UI modules and functional modules are different, resulting in high coupling, reducing the portability and scalability of new functional modules, and increasing the difficulty of development.
A proxy module is introduced, through message transmission between the proxy module and the framework module and the functional module, decouple the direct communication between the framework module and the UI module, and different communication protocols are used to support inter-process communication between the same core and different cores.
It reduces the difficulty of developing new functional modules, improves the portability and scalability of the system, and simplifies the communication process between UI modules and functional modules.
Smart Images

Figure CN119211321A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronics, and in particular to an intra-device communication method, apparatus, electronic device, and storage medium. Background Art
[0002] In an electronic device, there are usually multiple UI modules that can interact with a user, and different UI modules are used to implement different UI functions. In addition, the bottom layer of the electronic device also has a functional module that supports the implementation of each UI function.
[0003] Since the UI module and the corresponding functional module are located at different layers and use different data formats, when the UI module communicates with the corresponding functional module, it is necessary to establish a communication method between each UI module and the corresponding functional module based on the quick application framework in the electronic device, resulting in a high degree of coupling between the UI module, the quick application framework and the corresponding functional module, which in turn leads to poor portability and scalability of the solution, and increases the difficulty of developing new functional modules in electronic devices. Summary of the invention
[0004] Embodiments of the present application provide an intra-device communication method, apparatus, electronic device, and storage medium.
[0005] According to a first aspect of an embodiment of the present application, a method for communication within a device is provided, which is performed by an agent module in a first device, and the method includes:
[0006] Receive messages to be forwarded;
[0007] In response to the message to be forwarded being a first message forwarded by a framework module of the first device, the first message is sent to a corresponding functional module; wherein the framework module is connected to a plurality of user interface UI modules of the first device, and different UI modules are used to implement different UI functions; and the proxy module is connected to a plurality of functional modules of the first device;
[0008] In response to the message to be forwarded being a second message from at least one of the functional modules, the second message is sent to the framework module; wherein the second message is used by the framework module to forward to the corresponding UI module.
[0009] Optionally, sending the first message to a corresponding functional module includes:
[0010] In response to the first message having a first format, the first message having the first format is converted into a second format and sent to the corresponding functional module, wherein the first format is a data format recognizable by the framework module and the second format is a data format recognizable by the functional module.
[0011] Optionally, sending the second message to the framework module includes:
[0012] In response to the second message having a second format, the second message is converted into a first format and then sent to the framework module.
[0013] Optionally, sending the first message to a corresponding functional module includes:
[0014] Obtaining a first identifier in the first message;
[0015] Based on the first identifier, the first message is sent to the functional module identified by the first identifier.
[0016] Optionally, the method further includes:
[0017] The proxy module and the framework module use a first communication protocol to transmit messages;
[0018] The proxy module and the functional module use a second communication protocol to transmit messages;
[0019] The first communication protocol supports communication between processes running on the same kernel, and the second communication protocol supports communication between processes running on different kernels.
[0020] Optionally, the proxy module includes multiple first interfaces, wherein one of the first interfaces is used to forward a second message from a corresponding functional module.
[0021] Optionally, in response to the message to be forwarded being a second message from at least one of the functional modules, sending the second message to the framework module includes:
[0022] In response to the message to be forwarded being a second message from a first functional module, the second message is sent to the framework module through a first interface corresponding to the first functional module.
[0023] Optionally, the first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
[0024] In a second aspect of an embodiment of the present application, a device for communication within a device is provided, the device comprising:
[0025] A receiving module, used for receiving a message to be forwarded;
[0026] A first sending module, configured to send the first message to a corresponding functional module in response to the message to be forwarded being a first message forwarded by a framework module of the first device; wherein the framework module is connected to a plurality of user interface UI modules of the first device, and different UI modules are used to implement different UI functions; and the proxy module is connected to a plurality of functional modules of the first device;
[0027] The second sending module is used to send the second message to the framework module in response to the message to be forwarded being a second message from at least one of the functional modules; wherein the second message is forwarded by the framework module to the corresponding UI module.
[0028] Optionally, the first sending module is used to:
[0029] In response to the first message having a first format, the first message having the first format is converted into a second format and sent to the corresponding functional module, wherein the first format is a data format recognizable by the framework module and the second format is a data format recognizable by the functional module.
[0030] Optionally, the second sending module is used to:
[0031] In response to the second message having a second format, the second message is converted into a first format and then sent to the framework module.
[0032] Optionally, the first sending module is used to:
[0033] Obtaining a first identifier in the first message;
[0034] Based on the first identifier, the first message is sent to the functional module identified by the first identifier.
[0035] Optionally, the device further comprises:
[0036] A first transmission module, used for transmitting messages between the proxy module and the framework module using a first communication protocol;
[0037] A second transmission module, used for transmitting messages between the proxy module and the functional module using a second communication protocol;
[0038] The first communication protocol supports communication between processes running on the same kernel, and the second communication protocol supports communication between processes running on different kernels.
[0039] Optionally, the proxy module includes multiple first interfaces, wherein one of the first interfaces is used to forward a second message from a corresponding functional module.
[0040] Optionally, the second message sending module is used to:
[0041] In response to the message to be forwarded being a second message from a first functional module, the second message is sent to the framework module through a first interface corresponding to the first functional module.
[0042] Optionally, the first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
[0043] According to a third aspect of the present application, an electronic device is provided, including:
[0044] a memory for storing processor-executable instructions;
[0045] A processor connected to the memory;
[0046] The processor is used to execute the intra-device communication method as described in any one of the above items.
[0047] In a fourth aspect of an embodiment of the present application, a non-temporary computer-readable storage medium is provided, which, when instructions in the storage medium are executed by a processor of a computer, enables the computer to execute any of the above-mentioned intra-device communication methods.
[0048] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0049] In the embodiment of the present application, since there is a proxy module in the first device, and the proxy module is connected to multiple functional modules, based on this, when the proxy module receives a first message generated by any UI module forwarded by the framework module, the first message can be sent to the corresponding functional module, and when the proxy module receives a second message sent by any functional module, the second message can be sent to the framework module, so that the framework module sends the second message to the corresponding UI module.
[0050] It can be seen that through the proxy module in the embodiment of the present application, decoupling between the framework module and multiple functional modules can be achieved, that is, all functional modules communicate with the proxy module, without the need to communicate with each UI module based on the framework module. In this way, in the development process of new functional modules, it is only necessary to pay attention to the communication method between the new functional module and the proxy module, which reduces the difficulty of developing new functional modules in the first device.
[0051] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] 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.
[0053] Figure 1 is a flow chart of an intra-device communication method;
[0054] Figure 2 is a flow chart of a method for communication within a device according to an exemplary embodiment;
[0055] Figure 3 is a flow chart of an intra-device communication method according to another exemplary embodiment;
[0056] Figure 4 is a flow chart of an intra-device communication method according to another exemplary embodiment;
[0057] Figure 5 is an information interaction diagram between a first device and a second device according to another exemplary embodiment;
[0058] Figure 6 is an information interaction diagram between a first device and a second device according to another exemplary embodiment;
[0059] Figure 7 is an information interaction diagram between a first device and a second device according to another exemplary embodiment;
[0060] Figure 8 is a flow chart of an intra-device communication method according to another exemplary embodiment;
[0061] Fig. 9 is an information interaction diagram between a first device and a second device according to another exemplary embodiment;
[0062] Fig.10 is a schematic structural diagram of an intra-device communication apparatus according to an exemplary embodiment;
[0063] Fig.11 The diagram is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0064] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.
[0065] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0066] It should be understood that, although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at..." or "when..." or "in response to determination".
[0067] Before explaining the embodiments of the present application in detail, the application scenarios involved in the embodiments of the present application are first explained.
[0068] refer to Figure 1 In electronic devices, multiple UI (User Interface) modules are usually designed to implement different UI functions. For example, a UI module designed to adjust the brightness of the screen can be used to adjust the screen brightness, and a UI module designed to automatically turn off the screen can be used to turn off the screen.
[0069] For each UI module in the electronic device, there is a corresponding functional module inside the electronic device, wherein each functional module includes a Native process for implementing a corresponding UI function.
[0070] For example, Figure 1 The electronic device shown is designed with a first UI module, a second UI module and a third UI module, etc., and also includes a first functional module corresponding to the first UI module, a second functional module corresponding to the second UI module and a third functional module corresponding to the third UI module.
[0071] When implementing any UI function in an electronic device, the UI module needs to communicate with the corresponding functional module. However, since the UI module and the corresponding functional module are located in different layers and the data formats used are also different, when the UI module communicates with the corresponding functional module, it is necessary to establish a communication method between each UI module and the corresponding functional module, resulting in a high degree of coupling between the UI module, the quick application framework and the corresponding functional module, which in turn leads to poor portability and scalability of the solution, increasing the difficulty of developing new functional modules in electronic devices.
[0072] In order to solve the above problems, in the embodiment of the present application, a device communication method is provided. Figure 2 , Figure 2 is a flow chart of a method for communication within a device, such as Figure 2 As shown, the intra-device communication method of the embodiment of the present application is executed by a proxy module of the first device, and the method includes:
[0073] S201: receiving a message to be forwarded;
[0074] S202: In response to the message to be forwarded being a first message forwarded by a framework module of the first device, sending the first message to a corresponding functional module; wherein the framework module is connected to a plurality of UI modules of the first device, and different UI modules are used to implement different UI functions; and the proxy module is connected to a plurality of functional modules of the first device;
[0075] S203: In response to the message to be forwarded being a second message from at least one of the functional modules, sending the second message to the framework module; wherein the second message is used by the framework module to forward to the corresponding UI module.
[0076] The first device mentioned above is an electronic device with a display screen, for example, terminal devices such as smart TVs, smart watches, learning machines, smart phones, smart refrigerators and tablet computers.
[0077] The first device may be a terminal device using an Android system.
[0078] The proxy module may be a program module. The proxy module has a plurality of first interfaces and at least one second interface, wherein the plurality of first interfaces are used for the proxy module to communicate with the framework module, and the at least one second interface is used for the proxy module to communicate with the functional module.
[0079] The proxy module can determine whether the message to be converted comes from the framework module or the functional module according to the interface of the received message to be forwarded, and perform a corresponding forwarding operation.
[0080] A framework module and an agent module are installed in the first device of the embodiment of the present application.
[0081] refer to Figure 3 and Figure 4 The framework module is connected to the proxy module and multiple UI modules in the first device. The framework module can be as follows Figure 3 and / or Figure 4 The quick application framework can forward the first message received from any UI module to the proxy module, and can also forward the second message received from the proxy module to the corresponding UI module.
[0082] The proxy module is connected to the framework module and multiple functional modules in the first device. The proxy module can forward the first message received from the framework module to the corresponding functional module, and can also forward the message received from any functional module to the framework module.
[0083] The functional module may be a hardware module related to the bottom layer. Exemplarily, different functional modules may correspond to different processes and the like.
[0084] Exemplarily, the above-mentioned framework module may be an application framework or a quick application framework installed in the first device, and all UI functions in the first device are implemented based on the quick application framework in the first device.
[0085] The above-mentioned proxy module may be a proxy service process installed in the first device.
[0086] The above-mentioned UI module is used to implement different UI functions, for example, a function for adjusting the brightness of the screen, a function for automatically turning off the screen, a function for waking up any application installed in the first device, etc.
[0087] The above-mentioned functional modules may be processes related to implementing corresponding UI functions.
[0088] For each UI module on the first device, there is a functional module related to the UI module in the first device.
[0089] Based on this, when the first UI module in the first device detects a trigger operation by the user, a first message is sent to the framework module. After receiving the first message, the framework module forwards the received first message to the proxy module, and the proxy module sends the first message to the first functional module to be received by the first message.
[0090] In addition, after the first functional module starts the first UI function in the first device based on the received first message, the first functional module sends a second message to the proxy module. Accordingly, the proxy module sends the received second message to the framework module so that the framework module can send the second message to the first UI module, so that the first UI module can display the startup result of the first function on the display screen.
[0091] The above-mentioned first functional module is any functional module in the first device.
[0092] Exemplarily, when the UI module for implementing screen brightness adjustment in the first device detects that the user adjusts the screen brightness value to a first brightness, it sends a first message to the framework module, so that the framework module converts the first message to the proxy module, and the first message is used to request that the brightness of the display screen be adjusted to the first brightness.
[0093] Correspondingly, the proxy module receives the first message and sends the first message to the functional module related to the screen brightness, so that the functional module related to the screen brightness calls the corresponding hardware interface based on the first request message, and sets the brightness value corresponding to the first brightness to the hardware used to adjust the screen brightness, thereby making the display brightness of the screen the first brightness.
[0094] Afterwards, the functional module related to the screen brightness can also send a second message to the proxy module, and the second message is used to indicate the adjustment result of the screen brightness. After receiving the second message, the proxy module forwards the second message to the framework module. Accordingly, the framework module sends the received second message to the UI module related to the screen brightness adjustment, so that the UI module related to the screen brightness adjustment controls the display screen to display the adjustment result of the screen brightness.
[0095] Among them, the UI module related to screen brightness adjustment controls the display screen to display the adjustment result of the screen brightness, which can be to display the current screen brightness value, or to display an icon that can indicate the current brightness value.
[0096] In another embodiment, the second message received by the proxy module may also be a notification message actively sent by the first functional module in the first device when detecting that a function related to the first functional module in the first device is started.
[0097] Exemplarily, when the functional module related to the first application in the first device detects that the first application installed in the first device is started, the functional module related to the first application will actively send a second message to the proxy module, where the second message is used to indicate that the first application has been started.
[0098] After receiving the second message, the proxy module sends the second message to the framework module. Accordingly, the framework module forwards the received second message to the UI module related to the first application, so that the UI module related to the first application controls the first device to display the application interface of the first application.
[0099] In another embodiment, the second message received by the proxy module may also be sent by any functional module in the first device when receiving a third message sent by a second device connected to the first device.
[0100] Among them, the second device is also an electronic device with a display screen and using the Android system, for example, terminal devices such as smart TVs, smart watches, learning machines, smart phones and tablet computers.
[0101] It should be noted that the first device and the second device may be devices of the same type or devices of different types, and this embodiment of the present application does not limit this.
[0102] For example, the first device may be a smart TV, the second device may be a smart phone, or both the first device and the second device may be smart phones.
[0103] refer to Figure 5 and Figure 6 The first device of the embodiment of the present application can also be communicatively connected with a second device, wherein the second device is installed with a second application for controlling at least one functional module in the first device.
[0104] Based on this, when the user starts the first function in the first device through the second application installed in the second device, the second device can send a third message to the first function module in the first device based on the second application. Accordingly, the first function module receives the third message sent by the second device and starts the first function in the first device.
[0105] Afterwards, the first function module sends a second message to the proxy module, and the second message is used to indicate that the first function in the first device has been started. After receiving the second message, the proxy module forwards the second message to the framework module, so that the framework module sends the second message to the first UI module, so that the first UI module controls the first device to display the startup result of the first function.
[0106] In addition, after the first function is started, the first function module will also send a fourth message to the second device, and the fourth message is used for the second device to display the start-up result of the first function on the second application.
[0107] For example, reference Figure 5 and Figure 6 , when the second application ( Figure 5and Figure 6 APP in the first server ( Figure 5 and Figure 6 server1) sends a third message to the second server.
[0108] Correspondingly, the second server receives the third message sent by the first server, and sends the third message to the first device through the message channel ( Figure 5 and Figure 6 OT in the first device) sends a third message to a functional module related to the first application in the first device. After receiving the third message sent by the second server, the functional module related to the first application starts the first application in the first device and sends a fourth message to the second server through the OT channel, wherein the fourth message is used to indicate the startup result of the first application in the first device.
[0109] After receiving the fourth message, the second server sends the fourth message to the first server, so that the first server forwards the fourth message to the second device for controlling the second application in the second device to display the startup result of the first application.
[0110] In addition, after the first application is started, the functional module related to the first application in the first device sends a second message to the proxy module. Accordingly, the proxy module receives the second message and sends the received second message to the framework module, so that the framework module forwards the second message to the UI module related to the first application, which is used by the UI module related to the first application to control the first device to display the application interface of the first application.
[0111] Exemplarily, when the property of the first component in the first device changes, the functional module related to the first component will actively send a second message to the proxy module. After receiving the second message, the proxy module sends the second message to the framework module so that the framework module can forward the second message to the UI module related to the first component, so that the UI module can display the corresponding interface.
[0112] In addition, the functional module related to the first component will also send a fourth message to the second server through the OT channel, and forward the fourth message to the second device via the second server and the first server, so that the second device controls the second application to record the latest attribute information of the first component in the first device.
[0113] In an embodiment of the present application, when the first function in the first device is started by controlling the second device, the start result of the first function is fed back to the second device, so that the user can know the device status of the first device in a timely manner, thereby improving the user experience.
[0114] In one embodiment, after the first function module starts the first function based on the received first message sent by the proxy module, the first function module may also actively send a fourth message to the second device so that the second device displays the start result of the first function in the first device.
[0115] Exemplarily, when the first UI module in the first device detects a start-up operation of the first function triggered by the user, a first message may be generated and sent to the framework module, so that the framework module may forward the first message to the proxy module.
[0116] After receiving the first message, the proxy module sends the first message to the first functional module, so that the first functional module starts the first function.
[0117] After the first function is started, the first function module not only sends a second message to the proxy module, but also sends a fourth message to the second device, so that the second device can control the second application to record the startup result of the first function in the first device based on the fourth message.
[0118] For example, reference Figure 7 When the UI module related to screen brightness adjustment detects a screen brightness adjustment operation triggered by a user, it sends a first message to the framework module, the framework module forwards the first message to the proxy module, and the proxy module forwards the first message to the function module related to the screen brightness, so that the function module related to the screen brightness calls the hardware interface related to the screen brightness based on the first message to update the screen brightness parameters.
[0119] After completing the screen brightness parameter update, the functional module related to the screen brightness sends a second message to the proxy module, and the second message is forwarded to the UI module related to the screen brightness adjustment through the proxy module and the framework module, so that the UI module related to the screen brightness adjustment controls the screen to display the new screen brightness value.
[0120] In addition, after completing the screen brightness parameter update, the functional module related to the screen brightness will also send a fourth message to the second server through the OT channel, and forward it to the second device via the first server, so that the second application in the second device records the current screen brightness of the first device.
[0121] The above-mentioned first server and second server may be the same server or different servers. There may also be other servers for forwarding the third message and the fourth message between the first server and the second server, which is not limited in this embodiment of the present application.
[0122] In the embodiment of the present application, since there is a proxy module in the first device, and the proxy module is connected to multiple functional modules, based on this, when the proxy module receives a first message forwarded by the framework module, the first message can be sent to the corresponding functional module, and when the proxy module receives a second message sent by any functional module, the second message can be sent to the framework module, so that the framework module sends the second message to the corresponding UI module.
[0123] It can be seen that through the proxy module in the embodiment of the present application, decoupling between the framework module and multiple functional modules can be achieved, that is, all functional modules communicate with the proxy module, without the need to communicate with each UI module based on the framework module. In this way, in the development process of new functional modules, it is only necessary to pay attention to the communication method between the new functional module and the proxy module, which reduces the difficulty of developing new functional modules in the first device.
[0124] In one embodiment, the first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
[0125] From the above introduction, it can be seen that multiple UI modules are designed on the first device, each UI module is used to implement different UI functions, and since the UI module is a module that directly interacts with the user, when any UI module in the first device detects that the user starts a trigger operation of the corresponding UI function, a first message is generated and the generated first message is sent to the framework module.
[0126] Exemplarily, when a user's adjustment operation on screen brightness is detected, a UI module related to screen brightness adjustment generates a first message, generates a first message for requesting to call a functional module related to screen brightness, and sends the generated first message to the framework module.
[0127] When detecting a user's startup operation on a first application installed in the first device, the UI module related to the first application generates a first message for calling a functional module related to starting the first application, and sends the generated first message to the framework module.
[0128] In one embodiment, sending the first message to the corresponding functional module includes:
[0129] In response to the first message having a first format, the first message having the first format is converted into a second format and sent to the corresponding functional module, wherein the first format is a data format recognizable by the framework module and the second format is a data format recognizable by the functional module.
[0130] From the above introduction, it can be seen that since all UI functions in the first device are implemented based on the framework module, the data format of the first message generated by the UI module needs to be a data format that can be recognized by the framework module. However, since the framework module and the functional module are located at different layers of the first device, the data format of the first message generated by the UI module may not be a data format that can be recognized by the corresponding functional module. Based on this, in an embodiment of the present application, when the first message received by the proxy module is in a first format that cannot be recognized by the functional module, the first message in the first format is converted into a second format that can be recognized by the functional module and then sent to the corresponding functional module.
[0131] For example, when the above-mentioned framework module is a quick application framework, the data format that the quick application framework can recognize is the BP (proto buf) format. Therefore, the first message forwarded by the framework module received by the proxy module is a message in the BP format, but the data format that the functional module can recognize is the json format.
[0132] Based on this, when the proxy module receives the first message in the BP format, it converts the first message into the json format and sends it to the corresponding functional module.
[0133] In one embodiment, sending the second message to the framework module includes:
[0134] In response to the second message having a second format, the second message is converted into a first format and then sent to the framework module.
[0135] From the above introduction, it can be seen that since the data formats that the framework module and the functional module can recognize are different, when the second message received by the proxy module is a second message in json format, since the framework module and the UI module cannot recognize the second message in json format, the proxy module converts the second message in json format into BP format and sends it to the framework module, so that the framework module can send the second message in BP format to the corresponding UI module.
[0136] In one embodiment, sending the first message to the corresponding functional module includes:
[0137] Obtaining a first identifier in the first message;
[0138] Based on the first identifier, the first message is sent to the functional module identified by the first identifier.
[0139] In the embodiment of the present application, considering that the proxy module is connected to multiple functional modules, when the proxy module receives the first message sent by the framework module, it needs to know to which functional module the first message is sent. Therefore, when the UI module generates the first message, a first identifier can also be added to the first message. Based on this, when the proxy module receives the first message converted by the framework module, it can obtain the first identifier in the first message, and based on the first identifier, send the first message to the functional module identified by the first identifier in the first message.
[0140] Exemplarily, when the first message is the first message sent by a UI module related to screen brightness adjustment, the first message can carry a first identifier that can identify the UI module related to screen brightness adjustment. Based on this, when the proxy module receives the first message forwarded by the framework module, it can determine to send the first message to the functional module related to screen brightness based on the first identifier.
[0141] The first identifier mentioned above may be identification information that can uniquely identify each UI module.
[0142] In an embodiment, a second identifier may also be added to the second message.
[0143] In one embodiment, the method further includes:
[0144] The proxy module and the framework module use a first communication protocol to transmit messages;
[0145] The proxy module and the functional module use a second communication protocol to transmit messages;
[0146] The first communication protocol supports communication between processes running on the same kernel, and the second communication protocol supports communication between processes running on different kernels.
[0147] In the embodiments of the present application, considering the development of electronic technology, in order to improve the operating speed of electronic devices, multiple cores may be set in the first device, and the communication protocol used for inter-process communication collection running on the same core is different from the communication protocol used for inter-process communication running on different cores.
[0148] Therefore, when it is determined that the framework module and the proxy module run on the same kernel, the framework module and the proxy module can communicate using the first communication protocol. When the framework module and the proxy module run on different kernels, the framework module and the proxy module can communicate using the second communication protocol.
[0149] Exemplarily, when the framework module and the proxy module run on the same kernel, the framework module and the proxy module can communicate using the unix domain socket (network domain socket) communication method; when the framework module and the proxy module run on different kernels, the framework module and the proxy module can communicate using the rpmsg socket (Remote Processor Messaging socket) communication method.
[0150] In one embodiment, the proxy module includes a plurality of first interfaces, wherein one of the first interfaces is used to forward a second message from a corresponding functional module.
[0151] In the embodiment of the present application, the proxy module is provided with the same number of first interfaces as the UI modules, and the framework module is provided with third interfaces corresponding to each first interface on the proxy module.
[0152] Exemplarily, assuming that the first device has three UI modules, namely, a first UI module, a second UI module and a third UI module, a third interface 1 for forwarding a first message sent by the first UI module, a third interface 2 for forwarding a first message sent by the second UI module, and a third interface 3 for forwarding the first message sent by the third UI module are provided on the framework module.
[0153] Correspondingly, a first interface 1 communicating with the third interface 1 , a first interface 2 communicating with the third interface 2 , and a first interface 3 communicating with the third interface 3 are provided on the proxy module.
[0154] Based on this, when the proxy module receives the first message through the first interface 1, the first message is sent to the first functional module corresponding to the first UI module. When the proxy module receives the first message through the first interface 2, the first message is sent to the second functional module corresponding to the second UI module. Similarly, when the proxy module receives the first message through the first interface 3, the first message is sent to the third functional module corresponding to the third UI module.
[0155] When the proxy module receives the second message, it can determine which functional module the second message comes from based on the second identifier in the second message. If the proxy module determines that the second message comes from the first functional module based on the second identifier in the second message, the second message is sent to the framework module through the first interface 1 so that the framework module can send the second message to the first UI module.
[0156] If the proxy module determines that the second message comes from the second functional module based on the second identifier in the second message, the second message is sent to the framework module through the first interface 2 so that the framework module can send the second message to the second UI module.
[0157] Similarly, if the proxy module determines that the second message comes from the third functional module based on the second identifier in the second message, the second message is sent to the framework module through the first interface 3 so that the framework module can send the second message to the third UI module.
[0158] refer to Figure 3 , the embodiment of the present application also provides a method for communication within a device, including:
[0159] Downlink message: The user operates the device control (Set / Get) function on the first device UI, such as adjusting the screen brightness. The UI module sends the Set control message (first message) to the quick application framework, and the quick application framework sends the message to the proxy module (Service Agent) through the rpmsg socket; the Service Agent sends the message to the Spec module (functional module related to screen brightness) of the Native process through the Unix domainsocket. The Spec module sets the corresponding screen brightness value to the corresponding hardware by calling the underlying bsp interface, so that the new screen brightness value takes effect, and returns the result to the UI for display.
[0160] Uplink message: The underlying state change is notified to the UI and displayed to the user. For example, after the Mico module (functional module related to the first application) detects that the first application is awakened, it will actively send a second message to the Service Agent through the Unix domain socket. The Service Agent internally sends the second message to the quick application framework through the rpmsg socket, and the quick application framework notifies the UI to display the application interface of the first application to the user.
[0161] The embodiment of the present application defines a general method for communication between the UI and Native of smart screen devices. The Service Agent module implements the communication between the UI and Native functional modules, and realizes the establishment of an inter-process communication channel and message forwarding between the Native process (Mico / Midess / Spec, etc.) and the quick application framework.
[0162] Service Agent can serve as a unified communication channel between UI and Native processes (Mico / Midess / Spec, etc.), and can be applied to all functional modules involving interaction with UI, including device initialization network configuration, device settings (such as screen brightness adjustment, automatic screen off, button and other Spec functions), OT, first application services, device scenario services and other functional modules.
[0163] Service Agent module IPC communication mechanism:
[0164] The cross-core rpmsg socket communication between the Service Agent and the quick application framework implements the message channel between the Service Agent and the UI.
[0165] The Unix domain socket communication between Service Agent and Native implements the message channel between Service Agent and local modules (Native).
[0166] In the embodiment of the present application, rpmsg cross-core communication can be adjusted accordingly according to project needs. If it does not involve the cross-core communication scenario between UI and Native, the unix domain socketserver can also be uniformly implemented by Service Agent, and the UI side is connected to the server as a client to realize the UI and Native message forwarding channel.
[0167] The specific operation process mentioned above is as follows Figure 4 and Figure 8 as shown.
[0168] S801: The UI module sends a first message to the quick application framework;
[0169] S802: The quick application framework sends the first message to the Service Agent through the socket;
[0170] S803: The Service Agent sends the first message to the corresponding Native module according to a preset format;
[0171] S804: The Native module returns the execution result to the Service Agent, which forwards it to the corresponding quick application framework, which then forwards it to the UI for display.
[0172] S805: The upstream notify message (second message) is actively reported by the Native module to the Service Agent according to the business scenario. The Service Agent forwards it to the quick application framework according to the message format, and the quick application framework forwards it to the UI for display.
[0173] refer to Figure 6 and Fig. 9 , Figure 6 The implementation process of controlling the start of the first function in the first device by the second application in the second device is specifically as follows:
[0174] S901: The user sets / gets device attributes through the second application, which is forwarded by server1 to server2, and server2 forwards the Set / Get corresponding attributes to the Native module through the OT channel;
[0175] S902: Native reports the result to server1 through the OT channel, and server1 forwards it to the second application through server2 for display;
[0176] S903: The device Native module actively reports the attribute change to server1 through the OT module, and server1 forwards it to the second application for display via server2.
[0177] The product-defined spec is implemented by the Spec module. In order to synchronize the data between the UI module in the first device and the second application in the second device, when the UI module of the first device and the second application perform the Set property operation, the Spec module needs to actively report a property_changed message to synchronize the second application of the second device and the UI module of the first device.
[0178] refer to Fig.10 , an embodiment of the present application further provides an intra-device communication device, the device comprising:
[0179] Receiving module 1001, used for receiving a message to be forwarded;
[0180] A first sending module 1002 is configured to send the first message to a corresponding functional module in response to the message to be forwarded being a first message forwarded by a framework module of the first device; wherein the framework module is connected to a plurality of user interface UI modules of the first device, wherein different UI modules are used to implement different UI functions; and the proxy module is connected to a plurality of functional modules of the first device;
[0181] The second sending module 1003 is used to send the second message to the framework module in response to the message to be forwarded being a second message from at least one of the functional modules; wherein the second message is forwarded by the framework module to the corresponding UI module.
[0182] Optionally, the first sending module 1002 is used to:
[0183] In response to the first message having a first format, the first message having the first format is converted into a second format and sent to the corresponding functional module, wherein the first format is a data format recognizable by the framework module and the second format is a data format recognizable by the functional module.
[0184] Optionally, the second sending module 1003 is used to:
[0185] In response to the second message having a second format, the second message is converted into a first format and then sent to the framework module.
[0186] Optionally, the first sending module 1002 is used to:
[0187] Obtaining a first identifier in the first message;
[0188] Based on the first identifier, the first message is sent to the functional module identified by the first identifier.
[0189] Optionally, the device further comprises:
[0190] A first transmission module, used for transmitting messages between the proxy module and the framework module using a first communication protocol;
[0191] A second transmission module, used for transmitting messages between the proxy module and the functional module using a second communication protocol;
[0192] The first communication protocol supports communication between processes running on the same kernel, and the second communication protocol supports communication between processes running on different kernels.
[0193] Optionally, the proxy module includes multiple first interfaces, wherein one of the first interfaces is used to forward a second message from a corresponding functional module.
[0194] Optionally, the second message sending module 1003 is used to:
[0195] In response to the message to be forwarded being a second message from a first functional module, the second message is sent to the framework module through a first interface corresponding to the first functional module.
[0196] Optionally, the first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
[0197] refer to Fig.11 In an embodiment of the present application, an electronic device 1100 is provided, wherein the electronic device 1100 is the first device or the second device mentioned above, and the electronic device includes:
[0198] Memory 1104 for storing processor executable instructions;
[0199] A processor 1120 connected to the memory 1104;
[0200] The processor 1120 is configured to execute the intra-device communication method provided by any of the aforementioned technical solutions.
[0201] A block diagram of an electronic device 1100 is shown according to an exemplary embodiment. For example, the electronic device 1100 may be a mobile phone, a tablet computer, a notebook computer, a portable learning machine, and the like.
[0202] refer to Fig.11 , the electronic device 1100 may include one or more of the following components: a processing component 1102 , a memory 1104 , a power component 1106 , a multimedia component 1108 , an audio component 1110 , an input / output (I / O) interface 1112 , a sensor component 1114 , and a communication component 1118 .
[0203] The processing component 1102 generally controls the overall operation of the electronic device 1100, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1102 may include one or more processors 1120 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1102 may include one or more modules to facilitate the interaction between the processing component 1102 and other components. For example, the processing component 1102 may include a multimedia module to facilitate the interaction between the multimedia component 1108 and the processing component 1102.
[0204] The memory 1104 is configured to store various types of data to support operations on the electronic device 1100. Examples of such data include instructions for any application or method operating on the electronic device 1100, contact data, phone book data, messages, pictures, videos, etc. The memory 1104 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0205] The power supply component 1106 provides power to various components of the electronic device 1100. The power supply component 1106 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1100.
[0206] The multimedia component 1108 includes a screen that provides an output interface between the electronic device 1100 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1108 includes a front camera and / or a rear camera. When the electronic device 1100 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0207] The audio component 1110 is configured to output and / or input audio signals. For example, the audio component 1110 includes a microphone (MIC), and when the electronic device 1100 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1104 or sent via the communication component 1118. In some embodiments, the audio component 1110 also includes a speaker for outputting audio signals.
[0208] I / O interface 1112 provides an interface between processing component 1102 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0209] The sensor assembly 1114 includes one or more sensors for providing various aspects of status assessment for the electronic device 1100. For example, the sensor assembly 1114 can detect the open / closed state of the electronic device 1100, the relative positioning of the components, such as the display and keypad of the electronic device 1100, and the sensor assembly 1114 can also detect the position change of the electronic device 1100 or a component of the electronic device 1100, the presence or absence of user contact with the electronic device 1100, the orientation or acceleration / deceleration of the electronic device 1100, and the temperature change of the electronic device 1100. The sensor assembly 1114 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1114 may also include an optical sensor, such as a CMOS or CCD biometric information sensor, for use in imaging applications. In some embodiments, the sensor assembly 1114 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0210] The communication component 1118 is configured to facilitate wired or wireless communication between the electronic device 1100 and other devices. The electronic device 1100 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1118 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1118 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0211] In an exemplary embodiment, the electronic device 1100 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0212] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1104 including instructions, and the instructions can be executed by a processor 1120 of the electronic device 1100 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0213] An embodiment of the present application provides a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by a processor of a computer, the computer can execute the intra-device communication method described in one or more of the aforementioned technical solutions.
[0214] When the processor executes the instruction, it can at least perform the following steps:
[0215] Receive messages to be forwarded;
[0216] In response to the message to be forwarded being a first message forwarded by a framework module of the first device, the first message is sent to a corresponding functional module; wherein the framework module is connected to a plurality of user interface UI modules of the first device, wherein different UI modules are used to implement different UI functions; and the proxy module is connected to a plurality of functional modules of the first device;
[0217] In response to the message to be forwarded being a second message from at least one of the functional modules, the second message is sent to the framework module; wherein the second message is used by the framework module to forward to the corresponding UI module.
[0218] Optionally, sending the first message to a corresponding functional module includes:
[0219] In response to the first message having a first format, the first message having the first format is converted into a second format and sent to the corresponding functional module, wherein the first format is a data format recognizable by the framework module and the second format is a data format recognizable by the functional module.
[0220] Optionally, sending the second message to the framework module includes:
[0221] In response to the second message having a second format, the second message is converted into a first format and then sent to the framework module.
[0222] Optionally, sending the first message to a corresponding functional module includes:
[0223] Obtaining a first identifier in the first message;
[0224] Based on the first identifier, the first message is sent to the functional module identified by the first identifier.
[0225] Optionally, the method further includes:
[0226] The proxy module and the framework module use a first communication protocol to transmit messages;
[0227] The proxy module and the functional module use a second communication protocol to transmit messages;
[0228] The first communication protocol supports communication between processes running on the same kernel, and the second communication protocol supports communication between processes running on different kernels.
[0229] Optionally, the proxy module includes multiple first interfaces, wherein one of the first interfaces is used to forward a second message from a corresponding functional module.
[0230] Optionally, in response to the message to be forwarded being a second message from at least one of the functional modules, sending the second message to the framework module includes:
[0231] In response to the message to be forwarded being a second message from a first functional module, the second message is sent to the framework module through a first interface corresponding to the first functional module.
[0232] Optionally, the first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
[0233] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0234] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for communication within a device, characterized in that: The method is performed by an agent module of the first device, and includes: Receive messages to be forwarded; In response to the message to be forwarded being a first message forwarded by a framework module of the first device, sending the first message to a corresponding functional module; wherein the framework module is connected to a plurality of user interface UI modules of the first device; and the proxy module is connected to a plurality of functional modules of the first device; In response to the message to be forwarded being a second message from at least one of the functional modules, the second message is sent to the framework module; wherein the second message is used by the framework module to forward to the corresponding UI module.
2. The method according to claim 1, characterized in that The sending the first message to the corresponding functional module includes: In response to the first message having a first format, the first message having the first format is converted into a second format and sent to the corresponding functional module, wherein the first format is a data format recognizable by the framework module and the second format is a data format recognizable by the functional module.
3. The method according to claim 2, characterized in that The sending the second message to the framework module includes: In response to the second message having a second format, the second message is converted into a first format and then sent to the framework module.
4. The method according to claim 1, characterized in that The sending the first message to the corresponding functional module includes: Obtaining a first identifier in the first message; Based on the first identifier, the first message is sent to the functional module identified by the first identifier.
5. The method according to claim 1, characterized in that The method further comprises: The proxy module and the framework module use a first communication protocol to transmit messages; The proxy module and the functional module use a second communication protocol to transmit messages; The first communication protocol supports communication between processes running on the same kernel, and the second communication protocol supports communication between processes running on different kernels.
6. The method according to claim 1, characterized in that The proxy module includes a plurality of first interfaces, wherein one of the first interfaces is used to forward a second message from a corresponding functional module.
7. The method according to claim 6, characterized in that In response to the message to be forwarded being a second message from at least one of the functional modules, sending the second message to the framework module comprises: In response to the message to be forwarded being a second message from a first functional module, the second message is sent to the framework module through a first interface corresponding to the first functional module.
8. The method according to any one of claims 1 to 7, characterized in that: The first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
9. An intra-device communication device, characterized in that: The device comprises: A receiving module, used for receiving a message to be forwarded; A first sending module, configured to send the first message to a corresponding functional module in response to the message to be forwarded being a first message forwarded by a framework module of a first device; wherein the framework module is connected to a plurality of user interface UI modules of the first device; and the proxy module is connected to a plurality of functional modules of the first device; The second sending module is used to send the second message to the framework module in response to the message to be forwarded being a second message from at least one of the functional modules; wherein the second message is forwarded by the framework module to the corresponding UI module.
10. The device according to claim 9, characterized in that The first sending module is used for: In response to the first message having a first format, the first message having the first format is converted into a second format and sent to the corresponding functional module, wherein the first format is a data format recognizable by the framework module and the second format is a data format recognizable by the functional module.
11. The device according to claim 10, characterized in that The second sending module is used for: In response to the second message having a second format, the second message is converted into a first format and then sent to the framework module.
12. The device according to claim 9, characterized in that The first sending module is used for: Obtaining a first identifier in the first message; Based on the first identifier, the first message is sent to the functional module identified by the first identifier.
13. The device according to claim 9, characterized in that The device further comprises: A first transmission module, used for transmitting messages between the proxy module and the framework module using a first communication protocol; A second transmission module, used for transmitting messages between the proxy module and the functional module using a second communication protocol; The first communication protocol supports communication between processes running on the same kernel, and the second communication protocol supports communication between processes running on different kernels.
14. The device according to claim 9, characterized in that The proxy module includes a plurality of first interfaces, wherein one of the first interfaces is used to forward a second message from a corresponding functional module.
15. The device according to claim 14, characterized in that The second message sending module is used for: In response to the message to be forwarded being a second message from a first functional module, the second message is sent to the framework module through a first interface corresponding to the first functional module.
16. The device according to any one of claims 9 to 15, characterized in that: The first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
17. An electronic device, characterized in that: include: a memory for storing processor-executable instructions; A processor connected to the memory; The processor is configured to execute the intra-device communication method as described in any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a computer, enables the computer to perform the intra-device communication method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Middleware interface and middleware interface generator
CN109643252A
Method and system for message forwarding framework in heterogeneous computer system of multi-CPU (central processing unit) system
CN115827266A
Interaction control method and device of operation interface and electronic equipment
CN115904198A
Techniques for managing a storage environment
US20040006616A1
System and method for invoking WebDAV methods via non-WebDAV protocols
US20040163037A1
