Heartbeat implementation method, readable medium and electronic equipment
By using a coprocessor in a terminal device to process heartbeat packet interaction in the low-power state of the main processor and dynamically adjust the heartbeat cycle, the problem of high power consumption under the fixed heartbeat method is solved, and lower power consumption and better High battery life.
Patent Information
- Application Number
- CN202411100014.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2024-11-12
AI Technical Summary
The existing fixed heartbeat method results in unnecessary high power consumption in terminal devices and cannot meet the user's requirements for battery life. Especially for applications that are not often used, the need to maintain long connections is not urgent, but fixed or dynamic. The adjusted heartbeat cycle will still wake up the main processor, resulting in higher overall power consumption.
By introducing a second processor (coprocessor) in the terminal device, when the main processor is in a low power state, a heartbeat packet is generated and interacted with the server through the second processor, and the main processor is awakened only when there is service data. , thereby avoiding each heartbeat interaction to wake up the entire application system, and dynamically adjust the heartbeat cycle to adapt to the network environment and usage.
Effectively reduce the overall power consumption of terminal devices, avoid the power consumption caused by unnecessary wake-up and interaction, and improve battery life. Especially in sleep state, the low-power heartbeat channel is maintained through the coprocessor, only when necessary Wake up the main processor.
Smart Images

Figure CN118945780A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202210476161.2, and the original application date is April 29, 2022. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of communication technology, and in particular to a heartbeat implementation method, a readable medium and an electronic device. Background Art
[0003] At present, there are more and more application (APP) clients installed on terminal devices (such as mobile phones and tablets). After some application clients establish a persistent connection with the application server of the application, if the application client and the application server do not communicate for a long time, the persistent connection may be disconnected. In order to avoid the above persistent connection disconnection, Figure 1A As shown, the client of the application sends a heartbeat packet to the application server to maintain a long connection between the application server and the client of the application.
[0004] For example, in some fixed heartbeat methods, the terminal device usually periodically wakes up all clients of applications that establish long connections (such as the client) running in the background of the terminal device according to a fixed heartbeat period (for example, the fixed heartbeat period is 1 second). Figure 1B The application clients 1 to N shown in the figure, where N is a positive integer), trigger the clients of these applications to send heartbeat packets to the corresponding application servers according to a fixed heartbeat period, so that the client of the application maintains a long connection with the application server. However, for applications that users do not use frequently, the possibility of users using the application again is small, and the need to maintain a long connection is not so urgent. The above method of periodically waking up the client of an application according to a fixed heartbeat period will cause applications that are not frequently used to be woken up unnecessarily frequently.
[0005] However, as users have higher and higher requirements for the battery life of terminal devices, terminal devices have become more and more stringent in controlling power consumption. The existing fixed heartbeat method can no longer meet the power consumption requirements of terminal devices, and improvements are needed in heartbeat maintenance. Summary of the invention
[0006] In view of this, an embodiment of the present application provides a heartbeat implementation method, a readable medium, and an electronic device. The heartbeat implementation method in the technical solution of the present application is applied to a terminal device including a first processor and a second processor, the operating power consumption of the first processor is greater than that of the second processor, and the method includes: determining the operating state of the first processor; the operating state includes a first state and a second state, and the operating power consumption in the first state is lower than that in the second state; determining that the first processor is in the first state, generating a first heartbeat packet through the second processor and sending it to the server of the first application or the heartbeat server; determining through the second processor that the server of the first application has a target service that needs to be sent to the first application, and the second processor wakes up the first processor to switch the first processor from the first state to the second state. The technical solution of the present application can completely avoid the problem that each heartbeat interaction between the application and the application server will wake up the entire application system, and can reduce the overall power consumption of the terminal device.
[0007] In a first aspect, an embodiment of the present application provides a heartbeat implementation method, which is applied to a terminal device, wherein the terminal device includes a first processor and a second processor, and the operating power consumption of the first processor is greater than the operating power consumption of the second processor, and the method includes:
[0008] Determine an operating state of the first processor; the operating state includes a first state and a second state, wherein the operating power consumption of the first processor in the first state is lower than that in the second state;
[0009] Determine that the first processor is in a first state, generate a first heartbeat packet through the second processor, and send the first heartbeat packet to a server of a first application of the terminal device or a heartbeat server through the second processor;
[0010] The second processor determines that the server of the first application has a target service that needs to be sent to the first application, and wakes up the first processor through the second processor to switch the first processor from the first state to the second state, and requests the server of the first application to obtain the target service through the first processor.
[0011] In a possible implementation of the first aspect, determining, by the second processor, that a server of the first application has a target service that needs to be sent to the first application includes:
[0012] The second processor receives a first preset instruction sent by the server of the first application, and determines through the second processor that the server of the first application has a target business that needs to be sent to the first application, wherein the first preset instruction includes identification information of the first application, and the first preset instruction is used to indicate that the server of the first application has a target business that needs to be sent to the first application.
[0013] For example, the first processor is a main processor, the second processor is a coprocessor, the first state is a dormant state, and the first application is an instant messaging application. The first preset instruction can be an instruction generated by the server of the instant messaging application when the server of the instant messaging application determines that there is a new message to be sent to the messaging application. The instruction is used to notify the coprocessor to wake up the main processor and notify the main processor to obtain the aforementioned new message from the instant application server. The first preset instruction includes the identification information of the first application.
[0014] In a possible implementation of the first aspect, determining, by the second processor, that a server of the first application has a target service that needs to be sent to the first application includes:
[0015] The second processor receives a second preset instruction sent by the heartbeat server, and determines through the second processor that the server of the first application has a target business that needs to be sent to the first application, wherein the second preset instruction includes identification information of the first application and identification information of the server of the first application, and the second preset instruction is used to indicate that the server of the first application has a target business that needs to be sent to the first application.
[0016] For example, the first processor is the main processor, the second processor is the coprocessor, the first state is the sleep state, and the first application is an instant messaging application. The second preset instruction may be: an instruction generated by a heartbeat server independent of the instant messaging application when it determines that the server of the instant messaging application has a new message to be sent to the messaging application. The instruction is used to notify the coprocessor to wake up the main processor and notify the main processor to obtain the aforementioned new message from the instant application server.
[0017] In a possible implementation of the first aspect, the method further includes:
[0018] Determine that the first processor is in the second state, generate a second heartbeat packet through the first processor, and send the first heartbeat packet to a server or a heartbeat server of a first application of the terminal device through the first processor;
[0019] The first processor determines that the server of the first application has a target service that needs to be sent to the first application, and the first processor requests the server of the first application to obtain the target service.
[0020] In a possible implementation of the first aspect, determining, by the first processor, that a server of the first application has a target service that needs to be sent to the first application includes:
[0021] The first processor receives a third instruction sent by the server of the first application, and determines through the first processor that the server of the first application has a target service that needs to be sent to the first application, wherein the third instruction is used to indicate that the server of the first application has a target service that needs to be sent to the first application.
[0022] In a possible implementation of the first aspect, determining, by the first processor, that a server of the first application has a target service that needs to be sent to the first application includes:
[0023] The first processor receives the fourth instruction sent by the heartbeat server, and determines through the first processor that the server of the first application has a target service that needs to be sent to the first application, wherein the fourth instruction is used to indicate that the server of the first application has a target service that needs to be sent to the first application.
[0024] In a possible implementation of the first aspect above, the terminal device includes a communication unit, where the communication unit is used to communicate with the first processor and the second processor through a communication bus.
[0025] In a possible implementation of the first aspect, the communication unit includes at least one of a WIFI four-in-one chip and a modem chip.
[0026] In a possible implementation of the first aspect above, the communication bus is an I2C bus.
[0027] In a possible implementation of the first aspect above, the first application is an instant messaging application.
[0028] In a second aspect, the present application provides a computer-readable storage medium on which instructions are stored. When the instructions are executed on an electronic device, the electronic device executes the heartbeat implementation method in the above-mentioned first aspect and any possible implementation of the first aspect.
[0029] In a third aspect, the present application provides an electronic device, the electronic device comprising:
[0030] a memory for storing instructions to be executed by one or more processors of the electronic device, and
[0031] The processor is one of the processors of the electronic device, and is used to execute the heartbeat implementation method in the first aspect and any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1A According to some embodiments of the present application, a schematic diagram of heartbeat maintenance of an application client and an application server is shown;
[0033] Figure 1BAccording to some embodiments of the present application, a schematic diagram of an application client and an application server using a fixed heartbeat period to maintain heartbeats is shown;
[0034] Figure 2A According to some embodiments of the present application, a schematic diagram of a solution for dynamically adjusting an application heartbeat cycle is shown;
[0035] Figure 2B According to some embodiments of the present application, another schematic diagram of a solution for dynamically adjusting an application heartbeat cycle is shown;
[0036] Figure 2C According to some embodiments of the present application, another schematic diagram of a solution for dynamically adjusting an application heartbeat cycle is shown;
[0037] Figure 3A According to some embodiments of the present application, a hardware structure block diagram of a terminal device is shown;
[0038] Figure 3B According to some embodiments of the present application, it is shown Figure 3A The hardware connection diagram of some components in the terminal equipment shown;
[0039] Figure 4 According to some embodiments of the present application, a schematic diagram of an application scenario in which a terminal device and an application server interact is shown;
[0040] Figure 5 According to some embodiments of the present application, it is shown Figure 3A A schematic diagram of signal flow between some components in the terminal device shown;
[0041] Figure 6 According to some embodiments of the present application, a Figure 4 Schematic diagram of the interaction process between the terminal device, the heartbeat server and the IM server;
[0042] Figure 7 According to some embodiments of the present application, a Figure 4 Schematic diagram of the interaction process between the terminal device and the IM server. DETAILED DESCRIPTION
[0043] The illustrative embodiments of the present application include but are not limited to a heartbeat implementation method, a readable medium, and an electronic device. In order to facilitate understanding of the technical solution of the present application, the following first briefly introduces the technical terms involved in the embodiments of the present application:
[0044] (1) Long connection
[0045] A long connection may be a transmission control protocol (TCP) connection, a hypertext transfer protocol (HTTP) connection, a user datagram protocol (UDP) connection, or a hypertext transfer protocol over Secure Socket Layer (HTTPS) connection.
[0046] Taking TCP connection as an example, it can be understood that in the connection establishment phase of TCP connection, the client of the application needs to perform three handshakes with the application server (including the first handshake, the second handshake and the third handshake). It is used to connect to the designated port of the application server, establish a TCP connection, and synchronize the sequence numbers ((Sequence Number, SN), confirmation numbers (Acknowledgement Number, AN) and TCP window information of both parties of the TCP connection. In the connection removal phase of TCP connection, the client of the application performs four handshakes with the application server (including the first handshake, the second handshake, the third handshake and the fourth handshake). It is used to release the TCP connection between the client of the application and the application server. Among them, the four handshakes can be initiated by the client of the application or by the application server.
[0047] (2) Short connection
[0048] In some cases, TCP connections are established on demand. If the data or signaling transmission between the sender and the receiver is completed, the TCP connection between the sender and the receiver is disconnected. The TCP connection is reestablished when there is a need for data or signaling transmission next time. This connection is called a short connection.
[0049] However, since the TCP connection establishment and teardown phases are relatively complicated, if the TCP connection is often disconnected, the next time a data packet is transmitted, a three-way handshake will need to be performed again to establish the TCP connection, which will waste a certain amount of time and system overhead. Therefore, in order to save time and system overhead, a long connection can be maintained between the application client and the application server. That is, even if the data or signaling transmission between the sender and the receiver ends, the TCP connection will not be disconnected. In this way, the next time a data packet needs to be transmitted, the data packet can be directly transmitted through the long connection.
[0050] Therefore, in order to ensure that the long connection between the application client and the application server is not disconnected, the terminal device can periodically wake up the application so that the application client periodically sends heartbeat packets to the application server to ensure that the application server always considers the above long connection to be active, thereby avoiding the above long connection from being disconnected.
[0051] As described in the background art, the existing fixed heartbeat method can no longer meet the power consumption requirements of terminal devices, and there is a need for improvement in the heartbeat maintenance.
[0052] In order to improve the high power consumption of the existing fixed heartbeat method, in some heartbeat implementation methods, the actual usage of the terminal device and / or the actual application situation are used to dynamically adjust the cycle of waking up the application of the terminal device, that is, dynamically adjust the heartbeat cycle.
[0053] For example, as shown in reference 2A, the terminal device can determine the dynamic heartbeat cycle of each application based on one or more of the following information: the screen-off time when the terminal device is in the screen-off state, network status information and scenario mode information, the application type of the application, the time information or the number of times the application runs in the foreground of the terminal device within a preset time, etc.
[0054] The above network status information is used to indicate whether the terminal device is connected to the network or not. If the terminal device is connected to the network, the network status information of the terminal device is also used to indicate the type of network to which the terminal device is connected, and the signal quality of the terminal device connected to the network. Among them, the network type connected to the terminal device may include but is not limited to at least one of 2G network, 3G network, 4G network, 5G network and wireless fidelity (Wireless Fidelity, WiFi). It is understandable that if the terminal device is not connected to the network, the client of the application cannot maintain a long connection with the application server. In this case, there is no need for the terminal device to periodically wake up the client of the first application. The above scenario mode information is used to indicate that the terminal device is in any one of the modes of motion mode, sleep mode, pocket mode or desktop mode. The above application type can be pre-configured, and the application type can be at least any one of instant messaging, social, audio and video, office, news, tools, travel, life and reading.
[0055] exist Figure 2A In the scheme for dynamically adjusting the heartbeat cycle shown, the cycle of waking up the application of the terminal device is dynamically adjusted by using the actual usage of the terminal device and / or the actual situation of the application. Therefore, for applications that users do not frequently use, the need to maintain a long connection is not so urgent, and for such applications, the determined heartbeat cycle is longer. For example, for applications that users frequently use, such as instant messaging (IM), the heartbeat cycle is longer. Figure 2AThe heartbeat cycle determined by the method shown is short, for example, 1 second; and for travel applications, users do not use them frequently, so Figure 2A The heartbeat cycle determined by the method shown is longer, for example, 5 minutes. Figure 1B As shown, no matter what application is used, a 1-second heartbeat cycle is used to maintain a long connection, which can reduce the frequency of waking up the application and reduce the power consumption of the terminal device.
[0056] However, Figure 2A In the scheme for dynamically adjusting the heartbeat cycle shown, although the frequency of waking up the application program can be reduced to a certain extent. However, since the application programs are all running in the main processor of the terminal device (also called A core or main processor, hereinafter referred to as the main processor), and the terminal device is in a non-sleeping state and a sleeping state, each application program implements the heartbeat interaction with the application server through the main processor. Each heartbeat interaction between the application program and the application server will wake up the entire application system (that is, wake up the main processor), which makes the power consumption of the terminal device still high. In other schemes for dynamically adjusting the heartbeat cycle, when it is monitored that the conditions for dynamically adjusting the heartbeat cycle are met (for example, the terminal is in a sleeping state), an adaptive algorithm is used to realize the dynamic adjustment of the heartbeat cycle (the terminal state in this dynamic adjustment is called an adaptive calculation state). The adjustment principle is: preset an optional interval of the heartbeat packet time interval, the maximum value is recorded as MaxHeart, and the minimum value is recorded as MinHeart. Within this range, the heartbeat packet time interval is gradually adjusted through the heartbeat test until a suitable heartbeat packet time interval is found.
[0057] For example, successHeart is used to represent the heartbeat packet time interval of a successful test, and the initial value is MinHeart. curHeart is used to represent the current heartbeat packet time interval (that is, the heartbeat packet time interval corresponding to when the terminal enters the adaptive dynamic adjustment stage), heartStep is used to represent the heartbeat increase step, and successStep is used to represent the heartbeat detection step. Then, the heartbeat test is performed with the current heartbeat packet time interval CurHeart, and different processing is performed according to different heartbeat tests. Figure 2B The figure shows a schematic diagram of the process of dynamically adjusting the heartbeat packet when sending the heartbeat packet at the current heartbeat packet time interval in a specific example. Figure 2B The flowchart shown includes the following:
[0058] S201: Use curHeart to perform a heartbeat test. That is, the current heartbeat packet time interval is used to perform the heartbeat test. The heartbeat test means that the terminal device uses the current heartbeat packet time interval to send a heartbeat packet to the application server. If the data returned by the server is received multiple times in succession, it is determined that the heartbeat test is successful, otherwise it is determined that the heartbeat test fails.
[0059] S202: Determine whether the test is successful. If successful, proceed to S203; otherwise, proceed to S204.
[0060] S203: successHeart=curHeart,curHeart+=heartStep. That is, when the current heartbeat packet time interval is used for the test successfully, the current heartbeat packet time interval is used as the heartbeat packet time interval of the successful test. And the current heartbeat packet time interval plus the preset heartbeat increase step length is used as the new current heartbeat packet time interval, and then return to S202 for retesting until the new current heartbeat packet time interval reaches the aforementioned maximum value recorded as MaxHeart, and the new current heartbeat packet is used as the maximum heartbeat packet time interval within the above optional interval (hereinafter referred to as the stable heartbeat packet time interval), and the stable heartbeat packet time interval is used to maintain a stable heartbeat, and the terminal enters a stable state.
[0061] S204: Determine whether the total number of curHeart heartbeat failures is greater than or equal to 5. If so, it indicates that the current heartbeat packet time interval test has failed, and the adaptive adjustment process ends. If not, enter S201 and continue testing.
[0062] pass Figure 2B The test process shown can determine the maximum heartbeat packet time interval within the above optional interval, that is, the above stable heartbeat packet time interval, and use the stable heartbeat packet time interval to maintain a stable heartbeat, and the terminal enters a stable state. However, in some cases, when using the above stable heartbeat packet time interval to send heartbeat packets, due to changes in the network environment, etc., it is possible that the terminal enters the adaptive computing state from the stable state. Accordingly, Figure 2C A schematic diagram of a process of dynamically adjusting the heartbeat packet when sending the heartbeat packet at a stable heartbeat packet time interval in a specific example is shown. Figure 2C The flowchart shown includes the following:
[0063] S205: Use successHeart to perform the test. That is, use the stable heartbeat packet time interval SuccessHeart to perform the heartbeat test.
[0064] S206: Determine whether the test is successful. If successful, proceed to S207, otherwise proceed to S208.
[0065] S207: Clear the total number of heartbeat failures in successHeart to 0. Then return to S205 and continue to perform the heartbeat test using the stable heartbeat packet time interval SuccessHeart.
[0066] S208: Determine whether the total number of curHeart heartbeat failures is greater than or equal to 5. If so, it indicates that the total number of failures is greater than or equal to 5, and the process proceeds to S209; otherwise, it indicates that the total number of failures is less than 5, and the process returns to S205 to continue testing.
[0067] S209: successHeart=minHeart,curHeart=successHeart. That is to say, the current stable heartbeat packet time interval SuccessHeart is no longer suitable, and the heartbeat adaptive calculation needs to be re-performed, that is, the heartbeat adaptive calculation condition is met, and the current heartbeat packet time interval CurHeart is set to the preset minimum heartbeat packet time interval MinHeart, and then re-enter the above Figure 2B The process shown is to perform a heartbeat test using the current heartbeat packet time interval CurHeart.
[0068] exist Figure 2B to Figure 2C In the scheme of dynamically adjusting the heartbeat cycle shown, the heartbeat packet time interval is gradually adjusted through the heartbeat test, and finally a heartbeat packet time interval as large as possible that is adapted to the current network environment and can maintain the network connection is found. Since the heartbeat packet time interval is as large as possible, it can also save power, traffic and network resources to a certain extent.
[0069] However, Figure 2B to Figure 2C In the scheme of dynamically adjusting the heartbeat period shown, although the heartbeat packet time interval is as large as possible, the frequency of waking up the application can be reduced to a certain extent. Also, since the applications are all running in the main processor of the terminal device, and the terminal device is in a non-sleeping state and a sleeping state, each application implements a heartbeat interaction with the application server through the main processor. Each heartbeat interaction between the application and the application server will wake up the entire application system (that is, wake up the main processor), which makes the power consumption of the terminal device still high.
[0070] To this end, the present application provides a heartbeat implementation method that can be applied to any terminal device including a main processor (also referred to as a central processing unit) and a coprocessor (also referred to as a microprocessor).
[0071] In the heartbeat implementation method provided in the present application, when the terminal device is in a non-sleep state, for example, the terminal device is in a bright screen state or the user is operating the terminal device, the main processor is in a high power consumption state, and the main processor can establish a long connection with another server (hereinafter referred to as the "heartbeat server") independent of the application server, and the main processor generates a heartbeat packet and sends it to the heartbeat server to maintain the long connection between the main processor and the heartbeat server. When the application server has business data to be transmitted to the application of the terminal device, the application server notifies the main processor via the heartbeat server so that the application running on the main processor obtains the business data from the application server. Alternatively, when the terminal device is in a non-sleep state, the main processor can also directly establish a long connection with the application server, and the main processor generates a heartbeat packet and sends it to the application server to maintain the long connection between the main processor and the application server. When the application server has business data to be transmitted to the application of the terminal device, the application server notifies the main processor so that the application running on the main processor obtains the business data from the application server.
[0072] After the terminal device enters the sleep state, for example, the terminal device can enter the sleep state after detecting the user's lock screen operation; or the terminal device can enter the sleep state automatically after no user operation is detected within a preset time. In the sleep state, the main processor enters a low-power state, the long connection between the main processor and the heartbeat server or application server is disconnected, and the coprocessor sends a heartbeat packet to the heartbeat server or application server. When the coprocessor determines that the application server has business data to be transmitted to the application, the coprocessor wakes up the main processor again, so that the application running on the main processor obtains the business data from the application server.
[0073] The main processor may be a central processing unit (CPU), and the coprocessor may be a microcontroller unit (MCU), a digital signal processing (DSP) chip, or a general intelligent sensor hub, etc. Alternatively, if the main processor is a DSP chip in a terminal device, the coprocessor may be another DSP chip in the terminal device that consumes less power than the main processor; or, the main processor may be the first processor core of a multi-core processor in the terminal device, and the coprocessor may be the second processor core in the multi-core processor.
[0074] Since the technical solution of the present application implements the heartbeat interaction between the coprocessor and the application server when the terminal device is in a sleep state, the main processor will not be awakened by the heartbeat as long as the application server has no data to be transmitted to the application. This allows the technical solution of the present application to completely avoid the problem of waking up the entire application system (that is, waking up the main processor) every time the application interacts with the application server by heartbeat, thereby reducing the overall power consumption of the terminal device.
[0075] The specific implementation details of the technical solution of this application will be further described in detail below in conjunction with the accompanying drawings.
[0076] First, a hardware structure block diagram of a terminal device capable of executing the technical solution of the present application is introduced. Figure 3A The hardware structure block diagram of a terminal device 100 provided in an embodiment of the present application is a diagram, and the terminal device 100 can implement the heartbeat implementation method provided in the present application. As shown in FIG3 , the terminal device 100 includes a main processor 111, a coprocessor 112, a communication module 120, a sensor module 130, a memory 140, a power module 150, an audio module 160, an interface module 170, a camera 180, a display screen 190, etc.
[0077] The main processor 111 is the core processor (also called A core) of the terminal device 100, including multiple processing units, which can run Android TM , Hongmeng TM etc. operating systems, used to process tasks related to applications such as instant messaging, navigation, phone calls, maps, chats, music playback, etc. In some embodiments of the present application, the main processor 111 is also used to establish a long connection with the application server or the heartbeat server when the terminal device 100 is not in a sleep state, that is, in a normal operating state, to achieve heartbeat interaction with the application server or the heartbeat server. In other embodiments of the present application, the main processor 111 is also used to disconnect the long connection with the application server or the heartbeat server when the terminal device 100 is in a sleep state, and control the coprocessor 112 to achieve heartbeat interaction with the application server or the heartbeat server. Among them, the heartbeat server is a server independent of the application server that can be used to maintain a heartbeat with the application.
[0078] The coprocessor 112 can run a lightweight embedded system, which is responsible for the collection and processing of sensor data, and processes tasks related to applications such as time display, calculator, timer, alarm clock, heart rate measurement, step counting, and height measurement. In some embodiments of the present application, the coprocessor 112 is also used to establish a long connection with a heartbeat server or an application server after the terminal device 100 enters a dormant state, and send a heartbeat packet to the heartbeat server or the application server. In some embodiments of the present application, the coprocessor 112 is also used to wake up the main processor 111 when it senses that the application server has a new message instruction, and transmits the identification of the application and the application server to the main processor 111, so that the main processor 111 controls the application to obtain messages from the application server.
[0079] The communication module 120 may include a wireless fidelity (Wireless-Fidelity, WIFI) four-in-one chip 121 and a modulation and demodulation (Modem) chip 122. It can be used to enable the terminal device 100 and the operator's communication equipment (such as a base station) to realize mobile data communication, or wireless communication with other electronic devices. Among them, the WIFI four-in-one chip 121 integrates the four functions of WIFI, Bluetooth, Global Positioning System (Global Positioning System, GPS), and Frequency Modulation (Frequency Modulation, FM) on one chip to realize the wireless communication function of the terminal device 100. The modem chip 122 is used to realize mobile data communication with the operator's communication equipment.
[0080] In some embodiments of the present application, the WIFI four-in-one chip 121 and the Modem chip 122 are both connected to the coprocessor 112. For example, refer to Figure 3B As shown in the connection diagram, the WIFI 4-in-1 chip 121 and the Modem chip 122 are connected to the coprocessor 112 via the I2C bus, and the micro-kernel channel of the mobile data of the coprocessor 112 and the micro-kernel channel of the wireless hotspot, etc. are constructed, so that the coprocessor 112 can also establish a communication connection with other electronic devices (such as the above-mentioned application server or heartbeat server) through the WIFI 4-in-1 chip 121 and the Modem chip 122. Thus, the coprocessor 112 can receive control instructions from the heartbeat server or the application server, thereby waking up the main processor 111.
[0081] The sensor module 130 may include a proximity light sensor, a pressure sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.
[0082] The memory 140 is used to store software programs and data. The main processor 111 executes various functional applications and data processing of the terminal device 100 by running the software programs and data stored in the memory 140. For example, in some embodiments of the present application, the memory 140 can store instructions, and when the main processor 111 runs the instructions, the heartbeat implementation method provided by the present application is implemented. For another example, in some embodiments of the present application, the memory 140 can store data such as the identification of the application, the identification of the application server, and the heartbeat cycle.
[0083] The power module 150 may include a power source (not shown in the figure), a power management component (not shown in the figure), etc. The power source may be a battery. The power management component is used to manage the charging of the power source and the power supply of the power source to other modules. The charging management module is used to receive charging input from the charger; the power management module is used to connect the power source, the charging management module, the main processor 111, and the coprocessor 112.
[0084] The audio module 160 can convert digital audio information into analog audio signal output, or convert analog audio input into digital audio signal. The audio module 150 can also be used to encode and decode audio signals. For example, in some embodiments, the above application is an instant messaging application, and the audio module 160 is used to play the voice message received by the application.
[0085] The interface module 170 may include an external memory interface (not shown in the figure), a SIM card interface (not shown in the figure), etc. The external memory interface can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The SIM card interface is used to connect a SIM card. The SIM card can be connected to or disconnected from the terminal device 100 by inserting it into the SIM card interface or pulling it out from the SIM card interface.
[0086] The camera 180 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element converts the optical signal into an electrical signal, which is then transmitted to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format.
[0087] The display screen 190 is used to display images, videos, etc. The display screen 190 includes a display panel.
[0088] Understandably, Figure 3A The terminal device 100 shown is only an exemplary structure for implementing the functions of the terminal device 100 in the technical solution of the present application, and does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include Figure 3AMore or fewer components may be shown, or some components may be combined or separated, or the components may be arranged differently. Figure 3A The components shown may be implemented in hardware, software or a combination of software and hardware.
[0089] In order to better understand the technical solution of this application, Figure 3A and Figure 3B Taking the terminal device 100 shown in the figure as an example, an application scenario applicable to the technical solution of the present application is introduced. Figure 4 The application scenario shown includes a terminal device 100 , an application server 200 , and a heartbeat server 300 .
[0090] The terminal device 100 may be a Figure 3A and Figure 3B Any electronic device of the hardware structure shown. Including but not limited to mobile phones, netbooks, tablet computers, smart watches, etc. Alternatively, the terminal device can also be other desktop devices, laptop devices, handheld devices, wearable devices, smart home devices and vehicle-mounted devices with radio communication functions, such as ultra-mobile personal computers (UMPC), smart cameras, netbooks, personal digital assistants (PDA), portable multimedia players (PMP), AR (augmented reality) / VR (virtual reality) devices, aircraft, robots, etc. The embodiments of the present application do not limit the specific type and structure of the terminal device.
[0091] The terminal device 100 may install multiple types of applications, for example, the application type may be at least any one of instant messaging, social, audio and video, office, news, tools, travel, life and reading. For example, social applications may include "WeChat", "Weibo" and "Tencent QQ". Audio and video applications may include "Youku" and "QQ Music". Office applications may include "Microsoft Office" and "foxmail mailbox". News applications may include "Today's Headlines" and "CCTV News". Tool applications may include "Alarm Clock", "Calendar" and "Weather". Travel applications may include "Baidu Map" and "12306". Life applications may include "Hungry", "Alipay", "Shared Bicycles" and "Taobao". Reading applications may include "Douban Reading", "Southern Weekend", "Sanlian Life Weekly" and "World Literary Masterpieces".
[0092] In some embodiments, the terminal device 100 may establish a long connection with the heartbeat server 300. The heartbeat server 300 may be a server independent of the application server 200, and may be used to maintain a heartbeat with the application when the terminal device 100 is not in a sleep state, that is, to receive a heartbeat packet from the application, confirm the connection, and notify the application to obtain the new message when sensing that a new message from the application server 200 is to be sent. The heartbeat server 300 may also maintain a heartbeat with the coprocessor 112 when the terminal device 100 is in a sleep state, and notify the coprocessor 112 to wake up the main processor 111 when sensing that a new message from the application server 200 is to be sent, thereby notifying the application to obtain the new message.
[0093] The application server 200 may be a server corresponding to any application program, and may be used to provide services for the application program installed in the terminal device 100. Exemplarily, the application server 200 may be an IM server corresponding to an IM application.
[0094] In some embodiments, the terminal device 100 may also directly establish a long connection with the application server 200. When the terminal device 100 is not in a sleep state, the application server 200 may also be used to maintain a heartbeat with the application, that is, receive a heartbeat packet from the application, confirm the connection, and notify the application to obtain the new message when there is a new message to be sent. When the terminal device 100 is in a sleep state, the application server 200 is used to maintain a heartbeat with the coprocessor 112, and when there is a new message to be sent, notify the coprocessor 112 to wake up the main processor 111, thereby notifying the application to obtain the new message.
[0095] For example, in Figure 5 In the signal flow diagram shown in FIG. 1 , when the terminal device 100 is in a non-sleep state, the IM application 113 generates an A core jump through the main processor 111. The period of the A core jump can be fixed or can be used. Figure 2B or Figure 2C The solution shown dynamically adjusts the non-fixed heartbeat period, and sends the A core beat to the heartbeat server 300 or the IM server 200 through the WIFI 4-in-1 chip 121 or the Modem chip 122 of the terminal device 100. When the terminal device 100 is in a dormant state, the coprocessor 112 generates a micro-internal core beat, and then sends the micro-internal core beat to the heartbeat server 300 or the IM server 200 through the WIFI 4-in-1 chip 121 or the Modem chip 122 of the terminal device 100. When the heartbeat server 300 senses that the IM server 200 has a new message to be sent to the IM application 113, the coprocessor 112 is notified to wake up the main processor 111, thereby notifying the IM application 113 to obtain new messages from the IM server 200.
[0096] When the terminal device 100 is in sleep mode, the coprocessor 112 implements the heartbeat interaction with the heartbeat server 300. As long as the heartbeat server 300 does not send any message instructions to the application, the main processor 111 will not be awakened by the heartbeat. This allows the technical solution of the present application to completely avoid the problem that each heartbeat interaction between the application and the application server 200 will wake up the entire application system (that is, wake up the main processor 111), thereby reducing the overall power consumption of the terminal device 100.
[0097] The following will Figure 4 In the application scenario shown, a long connection is established between the terminal device 100 and the heartbeat server 300, and taking the message transmission between the IM application 113 installed on the terminal and the IM server 200 as an example, the interaction process between the terminal device 100, the heartbeat server 300, and the IM server 200 when the terminal device 100 is in a non-sleeping state and a sleeping state is introduced.
[0098] Figure 6 A schematic diagram of the interaction process between a terminal device 100, a heartbeat server 300, and an IM server 200 provided in an embodiment of the present application, wherein the non-sleeping state includes the contents of S601 to S608, and the sleeping state includes the contents of S609 to S618, specifically, as Figure 6 The interaction diagram shown includes the following:
[0099] S601: The IM application 113 of the terminal device 100 establishes a long connection with the heartbeat server 300.
[0100] That is, when the terminal device 100 is in a normal working state, for example, the terminal device 100 is in a bright screen state, or the user is operating the terminal device 100, a long connection is established between the IM application 113 of the terminal device 100 and the heartbeat server 300, and the long connection can be a TCP connection, a UDP connection, etc. In addition, a communication connection is established between the heartbeat server 300 and the IM server 200.
[0101] Since the main processor 111 is in a high power consumption state when the terminal device 100 is in a normal working state, the main processor 111 runs the IM application 113. Therefore, when the terminal device 100 is in a normal working state, the IM application 113 is connected to the heartbeat server 300 through the main processor 111. For example, the main processor 111 can transmit data with the heartbeat server 300 through the WIFI four-in-one chip 121 via wireless communication methods such as WIFI and Bluetooth. For another example, the main processor 111 can transmit data with the heartbeat server 300 through the operator's mobile communication network via the Modem chip 122. In addition, the heartbeat server 300 and the IM server 200 can also communicate with each other through wireless communication methods such as WIFI and Bluetooth.
[0102] S602: The main processor 111 of the terminal device 100 sends a heartbeat packet to the heartbeat server 300, thereby notifying the heartbeat server 300 that the terminal device 100 is online.
[0103] That is to say, when the terminal device 100 is in a non-sleep state, the terminal device 100 generates a custom command word through the main processor 111, and sends it to the heartbeat server 300 at a fixed time interval or a dynamically adjustable time interval to notify the heartbeat server 300 that the terminal device 100 is online.
[0104] S603: The heartbeat server 300 returns connection confirmation information to the main processor 111 of the terminal device 100.
[0105] That is, after the heartbeat server 300 receives the heartbeat packet sent by the main processor 111 of the terminal device 100 and determines that the terminal device 100 is online, the heartbeat server 300 returns connection confirmation information to the main processor 111 of the terminal device 100 .
[0106] S604: The IM server 200 sends a message instruction to the heartbeat server 300.
[0107] That is, when the IM server 200 determines that a new message needs to be sent to the IM application 113 of the terminal device 100, the IM server 200 generates a message instruction and sends it to the heartbeat server 300 to notify the heartbeat server 300 that a new message needs to be sent to the IM application 113 of the terminal device 100.
[0108] S605: The heartbeat server 300 senses that there is a new message to be sent.
[0109] That is, after the heartbeat server 300 receives the message instruction sent by the IM server 200 , it determines that the heartbeat server 300 has a new message to be sent to the IM application 113 of the terminal device 100 .
[0110] S606 : The heartbeat server 300 notifies the IM application 113 of the terminal device 100 to obtain new messages from the IM server 200 .
[0111] That is to say, when the heartbeat server 300 receives a message instruction from the IM server 200 and determines that the heartbeat server 300 has a new message to send to the IM application 113 of the terminal device 100, the heartbeat server 300 will generate a corresponding control instruction to notify the IM application 113 of the terminal device 100 to obtain the new message from the IM server 200.
[0112] S607: The IM application 113 of the terminal device 100 requests the IM server 200 to obtain new messages.
[0113] For example, the IM application 113 of the terminal device 100 sends a message acquisition request to the IM server 200 to request the IM server 200 to acquire the new message.
[0114] S608 : The IM server 200 returns a new message to the IM application 113 of the terminal device 100 .
[0115] For example, the IM server 200 receives a message acquisition request sent by the IM application 113 of the terminal device 100, and in response to the request, returns a new message to be sent to the IM application 113. Thus, after receiving the new message, the IM application 113 can display it to the user of the terminal device 100 in a timely manner.
[0116] S609: The long connection between the main processor 111 of the terminal device 100 and the heartbeat server 300 is disconnected.
[0117] That is to say, when the terminal device 100 enters the sleep state, the main processor 111 enters a low-power state. Among them, the terminal device 100 can enter the sleep state after detecting the user's lock screen operation; or, the terminal device 100 can enter the sleep state by itself after no user operation is detected within a preset time. When the terminal device 100 enters the sleep state, the main processor 111 can send an instruction to the coprocessor 112 to notify the coprocessor 112 to request the heartbeat server 300 to establish a long connection. When the terminal device 100 enters the sleep state, the display interface of the terminal device 100 can be in a black screen, off screen or off screen state.
[0118] It should be understood that when the terminal device 100 enters a sleep state, the terminal device 100 will enter a low power consumption state, power-consuming background tasks will be suspended, scheduled tasks will be forced to align with the system wake-up cycle, and long connections maintained by various applications of the terminal device 100 will be interrupted.
[0119] S610 : The coprocessor 112 sends a heartbeat packet to the heartbeat server 300 .
[0120] That is, when the terminal device 100 is in sleep mode, the terminal device 100 generates a custom command word through the coprocessor 112, and sends it to the heartbeat server 300 at a fixed time interval or a dynamically adjustable time interval to notify the heartbeat server 300 that the terminal device 100 is online.
[0121] S611 : The heartbeat server 300 returns connection confirmation information to the coprocessor 112 of the terminal device 100 .
[0122] That is, after the heartbeat server 300 receives the heartbeat packet sent by the coprocessor 112 of the terminal device 100 and determines that the terminal device 100 is online, the heartbeat server 300 returns connection confirmation information to the coprocessor 112 of the terminal device 100 .
[0123] S612: The IM server 200 sends a message instruction to the heartbeat server 300.
[0124] That is, when the IM server 200 determines that a new message needs to be sent to the IM application 113 of the terminal device 100, the IM server 200 generates a message instruction and sends it to the heartbeat server 300 to notify the heartbeat server 300 that a new message needs to be sent to the IM application 113 of the terminal device 100.
[0125] S613: The heartbeat server 300 senses that there is a new message to be sent.
[0126] That is, after the heartbeat server 300 receives the message instruction sent by the IM server 200 , it determines that the heartbeat server 300 has a new message to be sent to the IM application 113 of the terminal device 100 .
[0127] S614 : The heartbeat server 300 notifies the coprocessor 112 of the terminal device 100 to wake up the main processor 111 .
[0128] S615 : The coprocessor 112 of the terminal device 100 wakes up the main processor 111 .
[0129] For example, after receiving the notification of waking up the main processor 111 sent by the heartbeat server 300, the coprocessor 112 of the terminal device 100 sends a wake-up instruction to the main processor 111 to make the main processor 111 enter a high power consumption state.
[0130] S616: The main processor 111 of the terminal device 100 notifies the IM application 113 of the terminal device 100 to obtain new messages from the IM server 200. For example, the main processor 111 sends an instruction to the IM application 113 to obtain new messages from the IM server 200.
[0131] S617: The IM application 113 of the terminal device 100 requests the IM server 200 to obtain new messages.
[0132] For example, after receiving the instruction sent by the main processor 111 to obtain new messages from the IM server 200, the IM application 113 sends a message acquisition request to the IM server 200 in response to the instruction, requesting to obtain new messages.
[0133] S618: The IM server 200 returns the new message to the IM application 113, so that the user of the terminal device 100 can view the information.
[0134] For example, after the IM server 200 receives the message acquisition request sent by the IM application 113 , it returns a new message to the IM application 113 in response to the request.
[0135] From the above about Figure 6 It is not difficult to see from the description of the interaction diagram shown that, since the terminal device 100 maintains a long connection with the heartbeat server 300 by the coprocessor 112 when entering the sleep state, the coprocessor 112 is used to build a low-power heartbeat channel, which can maintain the signal flow in a low-power scenario, and the main processor 111 will be awakened only when the heartbeat server 300 detects an instant message to carry out data communication of the instant message. In other words, by executing the heartbeat implementation scheme provided by the present application, the terminal device 100 avoids the high power consumption problem caused by waking up the entire application system (i.e. waking up the main processor 111) for each heartbeat interaction in the prior art after the terminal device 100 enters deep sleep, and can reduce the power consumption of the terminal device 100.
[0136] It can be understood that the execution order of the above steps S601 to S618 is only an example. In other embodiments, other execution orders may be adopted, and some steps may be split or combined, which is not limited here.
[0137] The following will Figure 4 In the application scenario shown, the terminal device 100 directly establishes a long connection with the IM server 200, and taking the message transmission between the IM application 113 installed on the terminal and the IM server 200 as an example, the interaction process between the terminal device 100 and the IM server 200 when the terminal device 100 is in a non-sleeping state and a sleeping state is introduced.
[0138] Figure 7 A schematic diagram of an interaction process between a terminal device 100 and an IM server 200 provided in an embodiment of the present application, wherein the non-dormant state includes the contents of S701 to S707, and the dormant state includes the contents of S708 to S716. Specifically, Figure 7 The interaction diagram shown includes the following:
[0139] S701: The IM application 113 of the terminal device 100 and the IM server 200 establish a long connection.
[0140] That is to say, when the terminal device 100 is in a normal working state, for example, the terminal device 100 is in a bright screen state, or the user is operating the terminal device 100, a long connection is established between the IM application 113 of the terminal device 100 and the IM server 200, and the long connection can be a TCP connection, a UDP connection, etc.
[0141] Since the main processor 111 is in a high power consumption state when the terminal device 100 is in a normal working state, the main processor 111 runs the IM application 113. Therefore, when the terminal device 100 is in a normal working state, the IM application 113 establishes a connection between the main processor 111 and the IM server 200. For example, the main processor 111 can transmit data with the IM server 200 through wireless communication methods such as WIFI, Bluetooth, etc. through the WIFI four-in-one chip 121. For another example, the main processor 111 can transmit data with the IM server 200 through the Modem chip 122.
[0142] S702: The main processor 111 of the terminal device 100 sends a heartbeat packet to the IM server 200, thereby notifying the IM server 200 that the terminal device 100 is online.
[0143] That is, when the terminal device 100 is in a non-sleep state, the terminal device 100 generates a custom command word through the main processor 111, and sends it to the IM server 200 at a fixed time interval or a dynamically adjustable time interval to notify the IM server 200 that the terminal device 100 is online.
[0144] S703: The IM server 200 returns connection confirmation information to the main processor 111 of the terminal device 100.
[0145] That is, after the IM server 200 receives the heartbeat packet sent by the main processor 111 of the terminal device 100 and determines that the terminal device 100 is online, the IM server 200 returns connection confirmation information to the main processor 111 of the terminal device 100 .
[0146] S704: The IM server 200 determines that there is a new message to be sent. In other words, the IM server 200 determines that a new message needs to be sent to the IM application 113 of the terminal device 100.
[0147] S705: The IM server 200 notifies the IM application 113 of the terminal device 100 to obtain new messages from the IM server 200.
[0148] For example, when the IM server 200 determines that a new message needs to be sent to the IM application 113 of the terminal device 100 , the IM server 200 generates a message instruction and sends it to the IM application 113 of the terminal device 100 to notify the IM application 113 to obtain the new message of the IM server 200 .
[0149] S706: The IM application 113 of the terminal device 100 requests the IM server 200 to obtain new messages.
[0150] For example, the IM application 113 of the terminal device 100 sends a message acquisition request to the IM server 200 to request the IM server 200 to acquire the new message.
[0151] S707 : The IM server 200 returns a new message to the IM application 113 of the terminal device 100 .
[0152] For example, the IM server 200 receives a message acquisition request sent by the IM application 113 of the terminal device 100, and in response to the request, returns a new message to be sent to the IM application 113. Thus, after receiving the new message, the IM application 113 can display it to the user of the terminal device 100 in a timely manner.
[0153] S708: The long connection between the main processor 111 of the terminal device 100 and the IM server 200 is disconnected. That is, when the terminal device 100 enters the sleep state, the main processor 111 enters a low-power state. Among them, the terminal device 100 can enter the sleep state by itself when it detects the user's lock screen operation, or the terminal device 100 can enter the sleep state without detecting the user operation within a preset time. When the terminal device 100 enters the sleep state, the main processor 111 can send an instruction to the coprocessor 112 to notify the coprocessor 112 to request the heartbeat server 300 to establish a long connection. When the terminal device 100 enters the sleep state, the display interface of the terminal device 100 can be in a black screen, off screen or off screen state.
[0154] It should be understood that when the terminal device 100 enters a sleep state, the terminal device 100 will enter a low power consumption state, power-consuming background tasks will be suspended, scheduled tasks will be forced to align with the system wake-up cycle, and long connections maintained by various applications of the terminal device 100 will be interrupted.
[0155] S709 : The coprocessor 112 of the terminal device 100 sends a heartbeat packet to the IM server 200 .
[0156] That is, when the terminal device 100 is in a dormant state, the terminal device 100 generates a custom command word through the coprocessor 112 and sends it to the IM server 200 at a fixed time interval or a dynamically adjustable time interval to notify the IM server 200 that the terminal device 100 is online.
[0157] S710 : The IM server 200 returns connection confirmation information to the coprocessor 112 of the terminal device 100 .
[0158] That is, after the IM server 200 receives the heartbeat packet sent by the coprocessor 112 of the terminal device 100 , it determines that the terminal device 100 is online, and then the IM server 200 returns connection confirmation information to the coprocessor 112 of the terminal device 100 .
[0159] S711: The IM server 200 determines that there is a new message to be sent. In other words, the IM server 200 determines that a new message needs to be sent to the IM application 113 of the terminal device 100.
[0160] S712 : The IM server 200 notifies the coprocessor 112 of the terminal device 100 to wake up the main processor 111 of the terminal device 100 .
[0161] S713 : The coprocessor 112 of the terminal device 100 wakes up the main processor 111 of the terminal device 100 .
[0162] For example, after receiving the notification of waking up the main processor 111 sent by the IM server 200, the coprocessor 112 of the terminal device 100 sends a wake-up instruction to the main processor 111 to make the main processor 111 enter a normal working state.
[0163] S714: The main processor 111 of the terminal device 100 notifies the IM application 113 of the terminal device 100 to obtain new messages from the IM server 200. For example, the main processor 111 sends an instruction to the IM application 113 to obtain new messages from the IM server 200.
[0164] S715: The IM application 113 of the terminal device 100 requests the IM server 200 to obtain new messages.
[0165] For example, after receiving the instruction sent by the main processor 111 to obtain new messages from the IM server 200, the IM application 113 requests the IM server 200 to obtain new messages in response to the instruction.
[0166] S716: The IM server 200 returns the new message to the IM application 113 of the terminal device 100, so that the user of the terminal device 100 can view the information.
[0167] For example, after the IM server 200 receives the message acquisition request sent by the IM application 113 , it returns a new message to the IM application 113 in response to the request.
[0168] From the above about Figure 7 It is not difficult to see from the description of the interaction diagram shown that, since the terminal device 100 maintains a long connection with the IM server 200 by the coprocessor 112 when entering the dormant state, the coprocessor 112 is used to build a low-power heartbeat channel, which can maintain the signal flow in a low-power scenario, and the main processor 111 will be awakened only when the IM server 200 determines that there is a new instant message, and the data communication of the instant message is carried out. In other words, by executing the heartbeat implementation solution provided by the present application, the terminal device 100 avoids the high power consumption problem caused by waking up the entire application system (that is, waking up the main processor 111) for each heartbeat interaction in the prior art after the terminal device 100 enters deep dormancy, and can reduce the power consumption of the terminal device 100.
[0169] It can be understood that the execution order of the above steps S701 to S716 is only an example. In other embodiments, other execution orders may be adopted, and some steps may be split or combined, which is not limited here.
[0170] The various embodiments of the mechanism disclosed in the present application can be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device and at least one output device.
[0171] Program code can be applied to input instructions to perform the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a coprocessor.
[0172] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.
[0173] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROM), random access memories (RAM), erasable programmable read-only memories (EPROM), electrically erasable programmable read-only memories (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable memories for transmitting information (e.g., carrier waves, infrared signal digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Accordingly, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, a computer).
[0174] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0175] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0176] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0177] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.
Claims
1. A heartbeat implementation method, applied to a terminal device, wherein the terminal device comprises a first processor and a second processor, characterized in that: The method comprises: Determine an operating state of the first processor; the operating state includes a first state and a second state, wherein the operating power consumption of the first processor in the first state is lower than that in the second state; Determine that the first processor is in the first state, generate a first heartbeat packet through the second processor, and send the first heartbeat packet to a server of a first application of a terminal device or a heartbeat server through the second processor; The second processor determines that the server of the first application has a target service that needs to be sent to the first application, and the second processor wakes up the first processor to switch the first processor from the first state to the second state, and the first processor requests the server of the first application to obtain the target service.
2. The method according to claim 1, characterized in that The determining, by the second processor, that the server of the first application has a target service that needs to be sent to the first application includes: The second processor receives a first preset instruction sent by the server of the first application, and determines through the second processor that the server of the first application has a target business that needs to be sent to the first application, wherein the first preset instruction includes identification information of the first application, and the first preset instruction is used to indicate that the server of the first application has a target business that needs to be sent to the first application.
3. The method according to claim 1, characterized in that The determining, by the second processor, that the server of the first application has a target service that needs to be sent to the first application includes: The second processor receives a second preset instruction sent by the heartbeat server, and determines through the second processor that the server of the first application has a target business that needs to be sent to the first application, wherein the second preset instruction includes identification information of the first application and identification information of the server of the first application, and the second preset instruction is used to indicate that the server of the first application has a target business that needs to be sent to the first application.
4. The method according to claim 1, characterized in that: Also includes: Determine that the first processor is in the second state, generate a second heartbeat packet through the first processor, and send the first heartbeat packet to a server of a first application of a terminal device or a heartbeat server through the first processor; The first processor determines that the server of the first application has a target service that needs to be sent to the first application, and the first processor requests the server of the first application to obtain the target service.
5. The method according to claim 4, characterized in that The determining, by the first processor, that the server of the first application has a target service that needs to be sent to the first application includes: The first processor receives a third instruction sent by the server of the first application, and determines through the first processor that the server of the first application has a target service that needs to be sent to the first application, wherein the third instruction is used to indicate that the server of the first application has a target service that needs to be sent to the first application.
6. The method according to claim 4, characterized in that The determining, by the first processor, that the server of the first application has a target service that needs to be sent to the first application includes: The first processor receives a fourth instruction sent by the heartbeat server, and determines through the first processor that the server of the first application has a target service that needs to be sent to the first application, wherein the fourth instruction is used to indicate that the server of the first application has a target service that needs to be sent to the first application.
7. The method according to claim 1, characterized in that The terminal device includes a communication unit, and the communication unit is used to communicate with the first processor and the second processor through a communication bus.
8. The method according to claim 7, characterized in that The communication unit includes at least one of a WIFI four-in-one chip and a modem chip.
9. The method according to claim 7, characterized in that: The communication bus is an I2C bus.
10. The method according to any one of claims 1 to 9, characterized in that The first application is an instant messaging application.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on an electronic device, enable the electronic device to execute the heartbeat implementation method according to any one of claims 1 to 10.
12. An electronic device, characterized in that: The electronic device comprises: a memory for storing instructions to be executed by one or more processors of the electronic device, and The processor is one of the processors of the electronic device, and is used to execute the heartbeat implementation method described in any one of claims 1 to 10.
Citation Information
Cited By
Method and system for keeping low-power-consumption Bluetooth connection of AR (Augmented Reality) glasses
CN122438075A
