Communication methods, devices, electronic equipment and storage media within the device
By introducing a proxy module into electronic devices, the framework module is decoupled from multiple functional modules, which solves the problem of high coupling caused by different data formats between UI modules and functional modules, reduces the development difficulty of new functional modules, and improves the portability and scalability of devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING XIAOMI MOBILE SOFTWARE CO LTD
- Filing Date
- 2023-06-25
- Publication Date
- 2026-06-30
AI Technical Summary
In electronic devices, the different data formats between UI modules and functional modules lead to high coupling, affecting portability and scalability, and increasing the difficulty of developing new functional modules.
A proxy module is introduced, which connects to multiple functional modules to decouple the framework modules from the functional modules. The proxy module forwards messages, reducing the development difficulty of new functional modules.
By introducing the proxy module, the framework module is decoupled from multiple functional modules, reducing the development difficulty of new functional modules and improving the portability and scalability of electronic devices.
Smart Images

Figure CN119211321B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronics, and more particularly to a communication method, apparatus, electronic device, and storage medium within a device. Background Technology
[0002] Electronic devices typically contain multiple UI modules that interact with the user, each implementing different UI functions. Additionally, the underlying layers of the electronic device contain functional modules that support the implementation of each UI function.
[0003] Because the UI module and its corresponding functional module are located on different layers and use different data formats, when the UI module communicates with its corresponding functional module, a communication method needs to be established between each UI module and its corresponding functional module based on the Quick App framework in the electronic device. This results in a high degree of coupling between the UI module, the Quick App 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] This application provides an in-device communication method, apparatus, electronic device, and storage medium.
[0005] According to a first aspect of the embodiments of this application, an intra-device communication method is provided, executed by a proxy module in a first device, the method comprising:
[0006] Receive messages to be forwarded;
[0007] In response to the message to be forwarded being a first message forwarded by the framework module of the first device, the first message is sent to the corresponding functional module; wherein, the framework module is connected to multiple user interface (UI) modules of the first device, and different UI modules are used to implement different UI functions; the proxy module is connected to multiple 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 the 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 then sent to the corresponding functional module, wherein the first format is a data format that the framework module can recognize, and the second format is a data format that the functional module can recognize.
[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 the corresponding functional module includes:
[0014] Obtain the first identifier from 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 for message transmission;
[0018] The proxy module and the functional module use a second communication protocol for message transmission.
[0019] The first communication protocol supports communication between processes running on the same kernel, while 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 the first functional module, the second message is sent to the framework module through the 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] A second aspect of this application provides an in-device communication device, the device comprising:
[0025] The receiving module is used to receive messages to be forwarded;
[0026] The first sending module is configured to, in response to the message to be forwarded being a first message forwarded by the framework module of the first device, send the first message to the corresponding functional module; wherein, the framework module is connected to multiple user interface (UI) modules of the first device, and different UI modules are used to implement different UI functions; the proxy module is connected to multiple functional modules of the first device;
[0027] The second sending module is configured 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 used by the framework module to forward 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 then sent to the corresponding functional module, wherein the first format is a data format that the framework module can recognize, and the second format is a data format that the functional module can recognize.
[0030] Optionally, the second transmitting 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] Obtain the first identifier from 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 includes:
[0036] The first transmission module is used for message transmission between the proxy module and the framework module using a first communication protocol;
[0037] The second transmission module is used for message transmission 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, while 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 the first functional module, the second message is sent to the framework module through the 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] A third aspect of this application provides an electronic device, comprising:
[0044] Memory used to store processor-executable instructions;
[0045] The processor is connected to the memory;
[0046] The processor is configured to execute the in-device communication method as described in any of the preceding claims.
[0047] A fourth aspect of this application provides a non-transitory computer-readable storage medium that, when instructions in the storage medium are executed by a computer's processor, enables the computer to execute any of the aforementioned in-device communication methods.
[0048] The technical solutions provided in this application embodiment may include the following beneficial effects:
[0049] In this embodiment, a proxy module exists in the first device, and this proxy module is connected to multiple functional modules. Therefore, when the proxy module receives a first message generated by any UI module forwarded by the framework module, it can send the first message to the corresponding functional module. When the proxy module receives a second message sent by any functional module, it can send the second message to the framework module, which then sends the second message to the corresponding UI module.
[0050] As can be seen, the proxy module in this embodiment can decouple the framework module from multiple functional modules. That is, all functional modules communicate with the proxy module, without the need for the framework module to communicate with each UI module. In this way, during the development of new functional modules, only the communication method between the new functional module and the proxy module needs to be considered, which reduces the development difficulty of new functional modules in the first device.
[0051] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0052] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0053] Figure 1 This is a flowchart illustrating a device-internal communication method.
[0054] Figure 2 This is a schematic flowchart illustrating an intra-device communication method according to an exemplary embodiment;
[0055] Figure 3 This is a flowchart illustrating an intra-device communication method according to another exemplary embodiment;
[0056] Figure 4 This is a flowchart illustrating an intra-device communication method according to another exemplary embodiment;
[0057] Figure 5 This is a diagram illustrating information interaction between a first device and a second device according to another exemplary embodiment;
[0058] Figure 6 This is a diagram illustrating information interaction between a first device and a second device according to another exemplary embodiment;
[0059] Figure 7 This is a diagram illustrating information interaction between a first device and a second device according to another exemplary embodiment;
[0060] Figure 8 This is a flowchart illustrating an intra-device communication method according to another exemplary embodiment;
[0061] Figure 9 This is a diagram illustrating information interaction between a first device and a second device according to another exemplary embodiment;
[0062] Figure 10 This is a schematic diagram illustrating the structure of an in-device communication device according to an exemplary embodiment;
[0063] Figure 11 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation
[0064] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates 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 those of this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0065] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the embodiments of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the 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 this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0067] Before providing a detailed explanation of the embodiments of this application, the application scenarios involved in the embodiments of this application will be described first.
[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 is designed to adjust the screen brightness, and a UI module is designed to automatically turn off the screen.
[0069] For each UI module in an electronic device, there is a corresponding functional module inside the electronic device. Each functional module includes a Native process for implementing the corresponding UI function.
[0070] For example, Figure 1 The electronic device shown includes a first UI module, a second UI module, and a third UI module. Inside the electronic device, there is also 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 on different layers and use different data formats, a communication method needs to be established between each UI module and the corresponding functional module when the UI module communicates with the corresponding functional module. This results in a high degree of coupling between the UI module, the quick app 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.
[0072] To address the aforementioned problems, this application provides an intra-device communication method, as referenced in its embodiments. Figure 2 , Figure 2 This is a flowchart of a device-internal communication method, such as... Figure 2 As shown, the intra-device communication method of this application embodiment is executed by the proxy module of the first device, and the method includes:
[0073] S201: Receive message to be forwarded;
[0074] S202: In response to the message to be forwarded being a first message forwarded by the framework module of the first device, the first message is sent to the corresponding functional module; wherein, the framework module is connected to multiple UI modules of the first device, and different UI modules are used to implement different UI functions; the proxy module is connected to multiple 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, the second message is sent to the framework module; wherein the second message is used by the framework module to forward it to the corresponding UI module.
[0076] The first device mentioned above is an electronic device with a display screen, such as a smart TV, smartwatch, learning machine, smartphone, smart refrigerator, and tablet computer.
[0077] The first device can be a terminal device using the Android system.
[0078] The proxy module can be a program module. The proxy module has multiple first interfaces and at least one second interface. The multiple first interfaces are used for communication between the proxy module and the framework module, and the at least one second interface is used for communication between the proxy module and the functional module.
[0079] The proxy module can determine whether the message to be forwarded comes from the framework module or the functional module based on the interface of the received message to be forwarded, and then perform the corresponding forwarding operation.
[0080] The first device in this application embodiment is equipped with a frame module and a proxy module.
[0081] refer to Figure 3 and Figure 4 The framework module connects with the proxy module and multiple UI modules in the first device. The framework module can, for example... Figure 3 and / or Figure 4 The Quick App framework can forward the first message received from any UI module to the proxy module, and it 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, or forward the message received from any functional module to the framework module.
[0083] This functional module can be a hardware module involving the underlying layers. For example, different functional modules can correspond to different processes, etc.
[0084] For example, the framework module described above can be an application framework or a quick app framework installed in the first device, and all UI functions in the first device are implemented based on the quick app framework within the first device.
[0085] The aforementioned proxy module can be a proxy service process installed on the first device.
[0086] The aforementioned UI modules are used to implement different UI functions, such as adjusting screen brightness, automatically turning off the screen, and waking up any application installed on the first device.
[0087] The aforementioned functional modules can be processes related to implementing the corresponding UI functions.
[0088] For each UI module on the first device, there is a functional module related to that UI module within the first device.
[0089] Based on this, when the first UI module in the first device detects the user's trigger operation, it sends a first message to the framework module. After receiving the first message, the framework module forwards the received first message to the proxy module, which then sends the first message to the first functional module that is waiting to receive 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, it sends a second message to the agent module. Correspondingly, the agent module sends the received second message to the frame module so that the frame module can send the second message to the first UI module, so that the first UI module can display the start result of the first function on the display screen.
[0091] The first functional module mentioned above can be any functional module in the first device.
[0092] For example, when the UI module in the first device that implements screen brightness adjustment detects that the user has adjusted the screen brightness value to the first brightness, it sends a first message to the framework module. The framework module then forwards the first message to the proxy module. The first message is used to request that the brightness of the display be adjusted to the first brightness.
[0093] Accordingly, the proxy module receives the first message and sends it to the functional module related to screen brightness. The functional module related to screen brightness calls the corresponding hardware interface based on the first request message to set the brightness value corresponding to the first brightness to the hardware used to adjust the screen brightness, so that the screen display brightness is the first brightness.
[0094] Subsequently, the functional modules related to screen brightness can also send a second message to the agent module. The second message is used to indicate the adjustment result of the screen brightness. After receiving the second message, the agent module forwards the second message to the frame module. Correspondingly, the frame module sends the received second message to the UI module related to screen brightness adjustment, so that the UI module related to screen brightness adjustment can control the display to show the adjustment result of the screen brightness.
[0095] The UI module related to screen brightness adjustment controls the display to show the result of the screen brightness adjustment, which can be either displaying the current screen brightness value or displaying an icon that indicates the current brightness value.
[0096] In another embodiment, the second message received by the agent module may also be a notification message actively sent by the first functional module in the first device when it detects the activation of a function related to the first functional module in the first device.
[0097] For example, when the functional module related to the first application in the first device detects that the first application installed in the first device has started, the functional module related to the first application will actively send a second message to the agent module, which is used to indicate that the first application has started.
[0098] After the agent module receives the second message, it 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 can control the first device to display the application interface of the first application.
[0099] In another embodiment, the second message received by the above-mentioned proxy module may also be sent by any functional module in the first device when it receives a third message sent by the second device connected to the first device.
[0100] The second device is also an electronic device with a display screen and using the Android system, such as smart TVs, smartwatches, learning machines, smartphones, and tablets.
[0101] It should be noted that the first device and the second device can be of the same type or different types of devices, and this application embodiment does not limit this.
[0102] For example, the first device can be a smart TV and the second device can be a smartphone, or both the first device and the second device can be smartphones.
[0103] refer to Figure 5 and Figure 6 The first device in this application embodiment can also be communicatively connected to a second device, wherein the second device is equipped with a second application for controlling at least one functional module in the first device.
[0104] Based on this, when a user activates the first function in the first device through the second application installed on 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. Correspondingly, the first function module receives the third message sent by the second device and activates the first function in the first device.
[0105] Subsequently, the first functional module sends a second message to the agent module, which indicates that the first function in the first device has been activated. After receiving the second message, the agent module forwards it to the framework module, so that the framework module sends the second message to the first UI module, which then controls the first device to display the activation result of the first function.
[0106] In addition, after the first function is activated, the first function module will also send a fourth message to the second device. This fourth message is used by the second device to display the activation result of the first function on the second application.
[0107] For example, refer to Figure 5 and Figure 6 When the second application in the second device ( Figure 5and Figure 6 When the app detects that a user is controlling the launch of a first app on a first device through a second app on a second device, it sends a message through the first server of the second app. Figure 5 and Figure 6 In the second server, server1 sends a third message to the second server.
[0108] Accordingly, the second server receives the third message sent by the first server and communicates with the first device through the message channel established therewith. Figure 5 and Figure 6 The OT (Operational Technology) in the first device sends a third message to the 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. 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, which controls the second application on 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 agent module. Accordingly, the agent 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, so that the UI module related to the first application can control the first device to display the application interface of the first application.
[0111] For example, when the properties of the first component in the first device change, 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 will send 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 modules related to the first component will also send a fourth message to the second server through the OT channel, and the fourth message will be forwarded to the second device by the second server and the first server, so that the second device can control the second application to record the latest attribute information of the first component in the first device.
[0113] In this embodiment of the application, when the first function in the first device is started by 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 functional module starts the first function based on the first message sent by the agent module, it can 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] For example, when the first UI module in the first device detects the user-triggered activation of the first function, it can generate a first message and send the first message to the framework module so that the framework module can 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 can start the first function.
[0117] After the first function is started, the first function module will not only send a second message to the agent module, but also a fourth message to the second device, so that the second device can control the second application to record the start result of the first function in the first device based on the fourth message.
[0118] For example, refer to Figure 7 When the UI module related to screen brightness adjustment detects a screen brightness adjustment operation triggered by the 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 functional module related to screen brightness, so that the functional module related to screen brightness can call the hardware interface related to screen brightness to update the screen brightness parameters based on the first message.
[0119] After the screen brightness parameters are updated, the functional modules related to screen brightness send a second message to the proxy module. This second message is forwarded to the UI module related to screen brightness adjustment through the proxy module and the framework module. The UI module related to screen brightness adjustment controls the screen to display the new screen brightness value.
[0120] In addition, after the screen brightness parameters are updated, the functional modules related to screen brightness will also send a fourth message to the second server through the OT channel, and then forward it to the second device through the first server, so that the second application in the second device can record the current screen brightness of the first device.
[0121] The first server and the second server mentioned above can be the same server or different servers. There may also be other servers between the first server and the second server for forwarding the third and fourth messages. This application embodiment does not limit this.
[0122] In this embodiment, a proxy module exists in the first device, and this proxy module is connected to multiple functional modules. Therefore, when the proxy module receives a first message forwarded by the framework module, it can send the first message to the corresponding functional module. When the proxy module receives a second message sent by any functional module, it can send the second message to the framework module, which then sends the second message to the corresponding UI module.
[0123] As can be seen, the proxy module in this embodiment can decouple the framework module from multiple functional modules. That is, all functional modules communicate with the proxy module, without the need for the framework module to communicate with each UI module. In this way, during the development of new functional modules, only the communication method between the new functional module and the proxy module needs to be considered, which reduces the development difficulty of 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] As can be seen from the above introduction, the first device is designed with multiple UI modules, each of which is used to implement different UI functions. Since the UI module is the module that directly interacts with the user, when any UI module in the first device detects the user's trigger operation to start the corresponding UI function, it generates a first message and sends the generated first message to the framework module.
[0126] For example, when a user's adjustment of screen brightness is detected, the UI module related to screen brightness adjustment generates a first message, and generates a first message for requesting to call the functional module related to screen brightness, and sends the generated first message to the framework module.
[0127] When a user launches a first application installed on a first device, the UI module associated with the first application generates a first message to call the functional module associated with launching 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 then sent to the corresponding functional module, wherein the first format is a data format that the framework module can recognize, and the second format is a data format that the functional module can recognize.
[0130] As can be seen from the above introduction, 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 the framework module can recognize. However, since the framework module and the functional module are located in 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 the corresponding functional module can recognize. Based on this, in this embodiment, when the first message received by the proxy module is in a first format that the functional module cannot recognize, the first message with the first format is converted into a second format that the functional module can recognize and then sent to the corresponding functional module.
[0131] For example, when the aforementioned framework module is a quick app framework, the quick app framework can recognize the data format as BP (proto buf) format. Therefore, the first message received by the proxy module from the framework module is a message with BP format, but the functional module can recognize the data format as JSON format.
[0132] Based on this, when the agent module receives the first message in BP format, it converts the first message into 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] As can be seen from the above introduction, since the framework module and the functional module can recognize different data formats, when the proxy module receives a second message in JSON format, the framework module and the UI module cannot recognize the JSON format second message. Therefore, the proxy module converts the JSON format second message into BP format and sends it to the framework module, so that the framework module can send the BP format second message to the corresponding UI module.
[0136] In one embodiment, sending the first message to the corresponding functional module includes:
[0137] Obtain the first identifier from 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 this embodiment, 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 which functional module to send the first message to. 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 send the first message to the functional module identified by the first identifier based on the first identifier.
[0140] For example, when the first message is a first message sent by a UI module related to screen brightness adjustment, a first identifier that can identify the UI module related to screen brightness adjustment can be carried in the first message. 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 can be an identifier that can uniquely identify each UI module.
[0142] In one 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 for message transmission;
[0145] The proxy module and the functional module use a second communication protocol for message transmission.
[0146] The first communication protocol supports communication between processes running on the same kernel, while the second communication protocol supports communication between processes running on different kernels.
[0147] In this embodiment of the application, considering that with the development of electronic technology, in order to improve the operating speed of electronic devices, multiple kernels may be set in the first device, and the communication protocol used for inter-process communication acquisition running on the same kernel is different from the communication protocol used for inter-process communication running on different kernels.
[0148] Therefore, when the framework module and the agent module are running on the same kernel, they can communicate using the first communication protocol. When the framework module and the agent module are running on different kernels, they can communicate using the second communication protocol.
[0149] For example, when the framework module and the agent module run on the same kernel, they can communicate using Unix domain sockets. When the framework module and the agent module run on different kernels, they can communicate using rpmsg sockets (Remote Processor Messaging sockets).
[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 this embodiment of the application, the proxy module is provided with the same number of first interfaces as the UI modules, and the framework module is provided with a third interface corresponding to each of the first interfaces on the proxy module.
[0152] For example, assuming that the first device has three UI modules: a first UI module, a second UI module, and a third UI module, the framework module is provided with a third interface 1 for forwarding the first message sent by the first UI module, a third interface 2 for forwarding the first message sent by the second UI module, and a third interface 3 for forwarding the first message sent by the third UI module.
[0153] In response, the proxy module is provided with a first interface 1 for communicating with the third interface 1, a first interface 2 for communicating with the third interface 2, and a first interface 3 for communicating with the third interface 3.
[0154] Based on this, when the proxy module receives the first message through the first interface 1, it sends the first message to the first functional module corresponding to the first UI module. When the proxy module receives the first message through the first interface 2, it sends the first message 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, it sends the first message 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, it will send the second message 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, it will send the second message 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, it sends the second message 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 This application also provides an intra-device communication method, including:
[0159] Downlink message: When a user operates the device control function (Set / Get) on the first device UI, such as adjusting the screen brightness, the UI module sends a Set control message (first message) to the Quick App framework. The Quick App framework sends the message to the agent module (Service Agent) via the rpmsg socket. Internally, the Service Agent sends the message to the Spec module (the function module related to screen brightness) of the Native process via a Unix domain socket. The Spec module calls the underlying BSP interface to set the corresponding screen brightness value in the corresponding hardware, thereby making the new screen brightness value effective and returning the result to the UI for display.
[0160] Uplink message: The underlying state changes are notified to the UI to be displayed to the user. For example, after the Mico module (the functional module related to the first application) detects that the first application has been woken up, 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 App framework through the rpmsg socket. The Quick App framework then notifies the UI to display the application interface of the first application to the user.
[0161] This application defines a general method for communication between the UI and Native components of a smart device with a screen. The Service Agent module acts as a proxy to realize communication between the UI and Native functional modules, thereby establishing an inter-process communication channel and forwarding messages between the Native process (Mico / Midess / Spec, etc.) and the Quick App framework.
[0162] Service Agent can serve as a unified communication channel between the UI and native processes (Mico / Midess / Spec, etc.). It can be applied to all functional modules involving UI interaction, including device initialization and network configuration, device settings (such as screen brightness adjustment, automatic screen off, button and other Spec functions), OT, primary application services, device scenario services and other functional modules.
[0163] Service Agent module IPC communication mechanism:
[0164] Cross-core rpmsg socket communication between the Service Agent and the Quick App framework enables a message channel between the Service Agent and the UI.
[0165] The Service Agent communicates with the Native module via Unix domain sockets, establishing a message channel between the Service Agent and various local modules (Native).
[0166] In this embodiment, the rpmsg cross-core communication can be adjusted according to project needs. If there is no cross-core communication scenario between UI and Native, the Service Agent can uniformly implement the unix domain socket server, and the UI side can connect to the server as a client to realize the message forwarding channel between UI and Native.
[0167] The specific operating procedures described above are as follows: Figure 4 and Figure 8 As shown.
[0168] S801: The UI module sends the first message to the Quick App framework;
[0169] S802: The Quick App framework sends the first message to the Service Agent via a socket;
[0170] S803: The Service Agent sends the first message to the corresponding Native module according to the preset format;
[0171] S804: The Native module returns the execution result to the Service Agent, which forwards it to the corresponding Quick App framework, and the Quick App framework forwards it to the UI for display.
[0172] S805: Uplink notify message (second message), which is actively reported by the Native module to the Service Agent according to the business scenario. The Service Agent forwards it to the Quick App framework according to the message format, and the Quick App framework forwards it to the UI for display.
[0173] refer to Figure 6 and Figure 9 , Figure 6 The specific process for enabling the second application in the second device to control the activation of the first function in the first device is as follows:
[0174] S901: The user sets / gets device attributes through the second application, which is then forwarded from server1 to server2, and server2 forwards the corresponding attributes to the Native module via the OT channel;
[0175] S902: The Native reports the results to server1 via the OT channel, and server1 forwards them to the second application for display via server2;
[0176] S903: The device's Native module actively reports attribute changes, which are then reported to server1 via the OT module. Server1 then forwards the reports to the second application for display via server2.
[0177] The product definition spec is implemented by the Spec module. In order to achieve data synchronization between the UI module in the first device and the second application in the second device, when the UI module in the first device and the second application perform a Set property operation, the Spec module needs to actively report the property_changed message to synchronize the second application in the second device and the UI module in the first device.
[0178] refer to Figure 10 This application also provides an in-device communication device, the device comprising:
[0179] Receiver module 1001 is used to receive messages to be forwarded;
[0180] The first sending module 1002 is configured to, in response to the message to be forwarded being a first message forwarded by the framework module of the first device, send the first message to the corresponding functional module; wherein, the framework module is connected to multiple user interface (UI) modules of the first device, and different UI modules are used to implement different UI functions; the proxy module is connected to multiple functional modules of the first device.
[0181] The second sending module 1003 is configured 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 used by the framework module to forward to the corresponding UI module.
[0182] Optionally, the first sending module 1002 is used for:
[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 then sent to the corresponding functional module, wherein the first format is a data format that the framework module can recognize, and the second format is a data format that the functional module can recognize.
[0184] Optionally, the second transmitting module 1003 is used for:
[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 for:
[0187] Obtain the first identifier from 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 includes:
[0190] The first transmission module is used for message transmission between the proxy module and the framework module using a first communication protocol;
[0191] The second transmission module is used for message transmission 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, while 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 for:
[0195] In response to the message to be forwarded being a second message from the first functional module, the second message is sent to the framework module through the 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 Figure 11 In this embodiment of the application, an electronic device 1100 is provided, wherein the electronic device 1100 is the first device or the second device described above, and the electronic device includes:
[0198] Memory 1104 is used to store processor-executable instructions;
[0199] Processor 1120 is connected to 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, tablet computer, laptop computer, and portable learning machine, etc.
[0202] refer to Figure 11 The electronic device 1100 may include one or more of the following components: a processing component 1102, a memory 1104, a power supply 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] Processing component 1102 typically controls the overall operation of electronic device 1100, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1102 may include one or more processors 1120 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 1102 may include one or more modules to facilitate interaction between processing component 1102 and other components. For example, processing component 1102 may include a multimedia module to facilitate interaction between multimedia component 1108 and processing component 1102.
[0204] Memory 1104 is configured to store various types of data to support the operation of electronic device 1100. Examples of such data include instructions for any application or method operating on electronic device 1100, contact data, phonebook data, messages, pictures, videos, etc. Memory 1104 can 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 storage, flash memory, magnetic disk, or optical disk.
[0205] Power supply component 1106 provides power to various components of electronic device 1100. 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 electronic device 1100.
[0206] 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 touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 1108 includes a front-facing camera and / or a rear-facing camera. When the electronic device 1100 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0207] Audio component 1110 is configured to output and / or input audio signals. For example, audio component 1110 includes a microphone (MIC) configured to receive external audio signals when electronic device 1100 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1104 or transmitted via communication component 1118. In some embodiments, 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, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0209] Sensor assembly 1114 includes one or more sensors for providing state assessments of various aspects of electronic device 1100. For example, sensor assembly 1114 may detect the on / off state of electronic device 1100, the relative positioning of components such as the display and keypad of electronic device 1100, changes in position of electronic device 1100 or a component of electronic device 1100, the presence or absence of user contact with electronic device 1100, the orientation or acceleration / deceleration of electronic device 1100, and temperature changes of electronic device 1100. Sensor assembly 1114 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1114 may also include an optical sensor, such as a CMOS or CCD bio-information sensor, for use in imaging applications. In some embodiments, sensor assembly 1114 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0210] Communication component 1118 is configured to facilitate wired or wireless communication between electronic device 1100 and other devices. Electronic device 1100 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 1118 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1118 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may 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 methods described above.
[0212] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1104 including instructions, which can be executed by a processor 1120 of an electronic device 1100 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0213] This application provides a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by a computer's processor, enables the computer to perform the in-device communication method described in one or more of the foregoing technical solutions.
[0214] When the processor executes the instruction, it is capable of performing at least the following steps:
[0215] Receive messages to be forwarded;
[0216] In response to the message to be forwarded being a first message forwarded by the framework module of the first device, the first message is sent to the corresponding functional module; wherein, the framework module is connected to multiple user interface (UI) modules of the first device, and different UI modules are used to implement different UI functions; the proxy module is connected to multiple 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 the 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 then sent to the corresponding functional module, wherein the first format is a data format that the framework module can recognize, and the second format is a data format that the functional module can recognize.
[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 the corresponding functional module includes:
[0223] Obtain the first identifier from 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 for message transmission;
[0227] The proxy module and the functional module use a second communication protocol for message transmission.
[0228] The first communication protocol supports communication between processes running on the same kernel, while 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 the first functional module, the second message is sent to the framework module through the 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] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the claims.
[0234] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method of in-device communication, the method comprising: The process is executed by the proxy module of the first device, which includes multiple first interfaces, wherein one of the first interfaces is used to forward a second message from a corresponding functional module. The method includes: Receive messages to be forwarded; In response to the message to be forwarded being a first message forwarded by the framework module of the first device, the first message is sent to the corresponding functional module; wherein, the framework module is connected to multiple user interface (UI) modules of the first device; the proxy module is connected to multiple functional modules of the first device; the functional modules include underlying hardware modules; 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; Wherein, the step of responding 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: In response to receiving a second message, the source of the second message is determined based on a second identifier in the second message; In response to determining that the second message comes from the first functional module based on the second identifier, the first message is sent to the framework module through the first interface corresponding to the first functional module.
2. The method according to claim 1, characterized in that, 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 then sent to the corresponding functional module, wherein the first format is a data format that the framework module can recognize, and the second format is a data format that the functional module can recognize.
3. The method according to claim 2, characterized in that, 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, Sending the first message to the corresponding functional module includes: Obtain the first identifier from 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 includes: The proxy module and the framework module use a first communication protocol for message transmission; The proxy module and the functional module use a second communication protocol for message transmission. The first communication protocol supports communication between processes running on the same kernel, while the second communication protocol supports communication between processes running on different kernels.
6. The method according to any one of claims 1-5, characterized in that, The first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
7. An in-device communication device, characterized in that, The device includes: The receiving module is used to receive messages to be forwarded; A first sending module is configured to, in response to the message to be forwarded being a first message forwarded by a framework module of a first device, send the first message to a corresponding functional module; wherein the framework module is connected to multiple user interface (UI) modules of the first device; a proxy module is connected to multiple functional modules of the first device; the proxy module includes multiple first interfaces, wherein one first interface is used to forward a second message from a corresponding functional module; the functional module includes underlying hardware modules. The second sending module is configured 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 used by the framework module to forward it to the corresponding UI module; The second sending module is specifically used for: In response to receiving a second message, the source of the second message is determined based on a second identifier in the second message; In response to determining that the second message comes from the first functional module based on the second identifier, the first message is sent to the framework module through the first interface corresponding to the first functional module.
8. The apparatus according to claim 7, 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 then sent to the corresponding functional module, wherein the first format is a data format that the framework module can recognize, and the second format is a data format that the functional module can recognize.
9. The apparatus according to claim 8, 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.
10. The apparatus according to claim 7, characterized in that, The first sending module is used for: Obtain the first identifier from the first message; Based on the first identifier, the first message is sent to the functional module identified by the first identifier.
11. The apparatus according to claim 7, characterized in that, The device further includes: The first transmission module is used for message transmission between the proxy module and the framework module using a first communication protocol; The second transmission module is used for message transmission 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, while the second communication protocol supports communication between processes running on different kernels.
12. The apparatus according to any one of claims 7-11, characterized in that, The first message includes: a message generated by the UI module detecting a startup operation that triggers any UI function.
13. An electronic device, characterized in that, include: Memory used to store processor-executable instructions; The processor is connected to the memory; The processor is configured to execute the in-device communication method as described in any one of claims 1 to 6.
14. A non-transitory computer-readable storage medium, wherein instructions in the storage medium, when executed by a processor of a computer, enable the computer to perform the in-device communication method as described in any one of claims 1 to 6.