Communication method, readable storage medium and electronic equipment
By using two Wi-Fi chips in electronic devices, a high-power first Wi-Fi chip and a low-power second Wi-Fi chip, the problem of electronic devices being disconnected after the display screen is turned off, achieving long connection retention and power consumption reduction.
Patent Information
- Application Number
- CN202311608045.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-27
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2043-11-27
AI Technical Summary
When the display screen of the electronic device is turned off, the Wi-Fi chip enters a dormant state, causing the communication connection between the electronic device and other devices to be disconnected, resulting in communication delay and data reception delay.
Two Wi-Fi chips are configured in electronic devices, a first Wi-Fi chip with higher power consumption and a second Wi-Fi chip with lower power consumption. When the device wakes up, the first Wi-Fi chip is used for communication; when the device enters a sleep state, it switches to the second Wi-Fi chip to maintain a long connection with the server.
Maintaining a long connection through the second Wi-Fi chip prevents the electronic device from disconnecting the server after the display screen is turned off, reducing data reception delay, and reducing the power consumption of the device.
Smart Images

Figure CN120091394A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and in particular, to a communication method, a readable storage medium, and an electronic device. Background Art
[0002] To enable an electronic device to communicate with other electronic devices via a wireless network (such as a wireless fidelity (Wi-Fi) network), some electronic devices are provided with a communication chip for implementing Wi-Fi network communication (hereinafter referred to as a Wi-Fi chip).
[0003] However, to reduce the power consumption of the electronic device, when the display screen of the electronic device is turned off, the electronic device usually sets the Wi-Fi chip to sleep, resulting in the disconnection of the communication connection between the electronic device and other electronic devices. Moreover, the disconnected communication connection will be restored after the Wi-Fi chip is awakened (for example, after the display screen of the electronic device is turned on). That is to say, during the sleep period of the Wi-Fi chip, the electronic device cannot communicate with other electronic devices via the Wi-Fi network, which will cause communication delays between the electronic device and other electronic devices.
[0004] For example, when the Wi-Fi chip sleeps for too long, it will cause the disconnection of the long connection of the transmission control protocol / internet protocol (TCP / IP) between the electronic device and the server. After the display screen of the electronic device is turned on, the Wi-Fi chip is awakened, and the electronic device re-establishes a connection with the server and receives data from the server. This will cause delays in the electronic device receiving messages from the server (for example, messages sent by the server during the period when the display screen of the electronic device is turned off can only be received by the electronic device after the display screen is turned on again and the connection with the server is re-established). Summary of the Invention
[0005] In view of this, this application provides a communication method, a readable storage medium, and an electronic device.
[0006] In a first aspect, the present application provides a communication method applied to a first electronic device. The first electronic device includes a first Wi-Fi chip and a second Wi-Fi chip. And the method includes: when the first electronic device is in a wake-up state, it communicates with a second electronic device through the first Wi-Fi chip, where the first Wi-Fi chip is connected to the second electronic device using a first media access control address and a first Internet protocol address; when the first electronic device enters a sleep state, it switches to communicate with the second electronic device through the second Wi-Fi chip, where the second Wi-Fi chip is connected to the second electronic device using the first media access control address and the first Internet protocol address; wherein, the power consumption of the second Wi-Fi chip is less than that of the first Wi-Fi chip.
[0007] Exemplarily, in some embodiments of the present application, the first electronic device includes a first Wi-Fi chip and a second Wi-Fi chip. When the first electronic device has its screen on, the first electronic device communicates with the second electronic device through the first Wi-Fi chip, thereby connecting to a server and receiving / sending data to / from the server. When the first electronic device's screen is off and it enters sleep mode, the first Wi-Fi chip also enters a sleep state. The first electronic device switches to the second Wi-Fi chip to communicate with the second electronic device to maintain a long connection between the first electronic device and the server, avoiding delays in the first electronic device receiving messages pushed by the server.
[0008] In some embodiments of the present application, when the first electronic device switches to the second Wi-Fi chip to communicate with the second electronic device, the media access control (MAC) address of the second Wi-Fi chip is the same as that of the first Wi-Fi chip, and the Internet protocol (IP) address of the Internet is the same. That is to say, both the first Wi-Fi chip and the second Wi-Fi chip use the first MAC address and the first IP address to communicate with the second electronic device. In this way, it can be ensured that the process of the first electronic device switching Wi-Fi chips will not be detected by the second electronic device, and the second electronic device will not disconnect the communication connection with the first electronic device and then reconnect with the second Wi-Fi chip. Also, the application programs in the first electronic device will not detect that the first electronic device has switched Wi-Fi chips, avoiding the interruption of the data transmission service between the application programs in the first electronic device and the server due to the Wi-Fi chip switch. Thus, it ensures the smoothness of the communication process of the first electronic device without jamming.
[0009] In a possible implementation of the above first aspect, when the first electronic device enters the sleep state and switches to communicate with the second electronic device via the second Wi-Fi chip, it includes: the first electronic device enters the sleep state, controls the first Wi-Fi chip to sleep, and controls the first Wi-Fi chip not to send a disconnection message to the second electronic device.
[0010] In a possible implementation of the above first aspect, the method further includes: the first electronic device switches from the sleep state to the wake state and switches to communicate with the second electronic device via the first Wi-Fi chip, where the first Wi-Fi chip is connected to the second electronic device using the first media access control address and the first Internet protocol address.
[0011] Exemplarily, in some embodiments of the present application, during the process of the first electronic device switching from the sleep state to the wake state, the first electronic device wakes up the first Wi-Fi chip and enables the first Wi-Fi chip to communicate with the second electronic device using the first MAC address and the first IP address. That is, during the process of the first electronic device switching from the sleep state to the wake state and switching to the first Wi-Fi chip, the application programs in the second electronic device and the first electronic device will not detect it either. This ensures the smoothness of the communication process of the first electronic device.
[0012] In a possible implementation of the above first aspect, when the first electronic device switches from the sleep state to the wake state and switches to communicate with the second electronic device via the first Wi-Fi chip, it includes: the first electronic device switches from the sleep state to the wake state, controls the second Wi-Fi chip to sleep, and controls the second Wi-Fi chip not to send a disconnection message to the second electronic device.
[0013] Exemplarily, in some embodiments of the present application, during the process of the first electronic device switching to the second Wi-Fi chip, the first Wi-Fi chip will not send a disconnection message to the second electronic device (for example, the first Wi-Fi chip does not send a deauth frame to the second electronic device and does not disconnect the Wi-Fi connection with the second electronic device). That is, during the process of the first electronic device switching the Wi-Fi chip, it will not disconnect the connection between the first Wi-Fi chip and the second electronic device, but enables the second Wi-Fi chip to connect to the second electronic device using the first MAC address and the first IP address. Therefore, the second electronic device will only detect that the first electronic device reconnects to the network using the same Wi-Fi chip (the MAC address of the switched Wi-Fi chip remains unchanged), and will not detect that the first electronic device switches the Wi-Fi chip to connect to the network.
[0014] In a possible implementation of the above first aspect, when the first electronic device enters the sleep state and switches to communicate with the second electronic device via the second Wi-Fi chip, it includes: using the second Wi-Fi chip to send a heartbeat packet to the server via the second electronic device, and / or receiving a message from the server.
[0015] Exemplarily, in some embodiments of the present application, during the process of the first electronic device connecting to the second electronic device via the second Wi-Fi chip, the first electronic device sends a heartbeat packet to the server via the second electronic device to ensure that the first electronic device maintains a long connection state with the server, enabling the first electronic device to receive messages pushed by the server in a timely manner.
[0016] In a possible implementation of the above first aspect, the method further includes: corresponding to the message received from the server satisfying the first wake-up condition, the second Wi-Fi chip wakes up the processor of the first electronic device; corresponding to the message received from the server satisfying the second wake-up condition, the second Wi-Fi chip wakes up the processor and the first Wi-Fi chip.
[0017] In a possible implementation of the above first aspect, the first wake-up condition includes that the message received by the first electronic device from the server requires the processor and the second Wi-Fi chip of the first electronic device to process; the second wake-up condition includes that the message received by the first electronic device from the server requires the processor and the first Wi-Fi chip of the first electronic device to process.
[0018] Exemplarily, in some embodiments of the present application, during the process of the first electronic device being in the sleep state, the second Wi-Fi chip can receive messages pushed by the server. Since some push messages require the processor of the first electronic device to process, when the second Wi-Fi chip receives a message that requires the processor of the first electronic device to process, it will wake up the processor of the first electronic device. At this time, the first electronic device processes the corresponding message through the processor and the second Wi-Fi chip. This message can be, for example, a notification message pushed by the server to the application of the first electronic device, or an instant communication message sent by other devices to the first electronic device.
[0019] In other embodiments, during the process of the first electronic device being in the sleep state, when the second Wi-Fi chip receives a message that requires the processor and the first Wi-Fi chip of the first electronic device to process, the second Wi-Fi chip will wake up the processor (such as an application processor) of the first electronic device. Then the processor of the first electronic device wakes up the first Wi-Fi chip. The first electronic device switches to the first Wi-Fi chip to process the corresponding message. For example, this message can be a voice call message or a video call message sent by other devices to the first electronic device, etc.
[0020] In a possible implementation of the foregoing first aspect, the second electronic device is an access point.
[0021] Exemplarily, in some embodiments of the present application, the second electronic device is any access point (AP), including but not limited to a router, any terminal device (or network device) capable of providing a mobile hotspot, a wireless network card, a wireless router, a mobile broadband modem, and a customer premises equipment (CPE), etc.
[0022] In a second aspect, the present application provides an electronic device, including: a memory for storing instructions; a first Wi-Fi chip, a second Wi-Fi chip, and at least one processor for executing the instructions to enable the electronic device to implement the method provided in the foregoing first aspect and any possible implementation of the foregoing first aspect.
[0023] In a third aspect, the present application provides a computer-readable storage medium, on which instructions are stored, and when the instructions are executed on a computer, the computer is enabled to implement the method provided in the foregoing first aspect and any possible implementation of the foregoing first aspect.
[0024] In a fourth aspect, the present application provides a computer program product, and when the computer program product runs on an electronic device, the electronic device is enabled to implement the method provided in the foregoing first aspect and any possible implementation of the foregoing first aspect. Description of the Drawings
[0025] Figure 1A According to some embodiments of the present application, a scenario diagram of network communication when an electronic device has a lit screen is shown;
[0026] Figure 1B According to some embodiments of the present application, a scenario diagram of network communication of an electronic device is shown;
[0027] Figure 2 According to some embodiments of the present application, a scenario diagram of an electronic device in a sleep state is shown;
[0028] Figure 3A According to some embodiments of the present application, a process diagram of an electronic device switching Wi-Fi chips is shown;
[0029] Figure 3B According to some embodiments of the present application, an implementation flowchart of an electronic device switching Wi-Fi chips is shown;
[0030] Figure 4 According to some embodiments of the present application, a schematic block diagram of the system software architecture of an electronic device is shown;
[0031] Figure 5 According to some embodiments of the present application, a flowchart of an electronic device switching Wi-Fi chips is shown;
[0032] Figure 6 According to some embodiments of the present application, a process of link switching in the network layer of an electronic device is shown;
[0033] Figure 7 According to some embodiments of the present application, a schematic structural diagram of a first electronic device 100 is shown. Detailed implementation manners
[0034] Illustrative embodiments of the present application include but are not limited to communication methods, readable storage media, and electronic devices.
[0035] In order to make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings of the specification and specific implementation manners.
[0036] As mentioned above, in some scenarios, when the electronic device is in the screen-off state, the system of the electronic device and the Wi-Fi chip are both in the sleep state, resulting in the disconnection of the long connection of the TCP / IP protocol between the electronic device and the corresponding cloud server. At this time, when the cloud server pushes messages to some application programs on the electronic device, since the Wi-Fi chip of the electronic device is in the sleep state, some application programs on the electronic device cannot receive the messages pushed by the corresponding cloud server in a timely manner.
[0037] For example, Figure 1A According to some embodiments of the present application, a scenario diagram of network communication when the electronic device is in the screen-on state is shown.
[0038] Exemplarily, the first electronic device 100 in the embodiments of the present application may be, for example, a mobile phone, a tablet computer, a notebook, a wearable device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiments of the present application do not limit the specific type of the first electronic device 100. And, the second electronic device 200 in the embodiments of the present application may be, for example, a router, a mobile hotspot, a wireless network card, a wireless router, and a mobile broadband modem and other devices. The embodiments of the present application do not limit the specific type of the second electronic device 200.
[0039] Such as Figure 1AAs shown, in this communication scenario, when the first electronic device 100 has its screen on, it connects to the Internet through the second electronic device 200, and then communicates with the server 300 using the TCP / IP protocol based on the Internet.
[0040] Exemplarily, the first electronic device 100 can first connect to the Internet through the second electronic device 200 and establish a connection between the first electronic device 100 and the server 300 through the TCP / IP protocol, so as to realize data transmission and interaction between the first electronic device 100 and the server 300. For example, the server 300 can push messages to the application A in the first electronic device 100 based on the TCP / IP protocol, and the application A can process the messages pushed by the server 300.
[0041] For example, the server 300 can receive a first message sent by the application A' in the third electronic device 400 and targeted at the application A of the first electronic device 100. When the first electronic device 100 has its screen on, the first electronic device 100 connects to the server 300 through the TCP / IP protocol. After receiving the first message, the server 300 can immediately send the first message to the application A of the first electronic device 100. After the first electronic device 100 receives the first message, the application A processes the first message.
[0042] However, when the first electronic device 100 has its screen off, the operating system and Wi-Fi chip of the first electronic device 100 will enter the sleep state, resulting in the first electronic device 100 being unable to receive messages from the server 300 in a timely manner.
[0043] For example, Figure 1B According to some embodiments of the present application, a scenario diagram of network communication of an electronic device is shown.
[0044] As Figure 1B shown, in this scenario, the first electronic device 100 is in the screen-off state, and the Wi-Fi chip of the first electronic device 100 will also enter the sleep state and will not transmit data and interact with the server 300. When the server 300 has not received a message from the first electronic device 100 for a long time (such as a heartbeat packet, that is, a keep-alive data packet), it will disconnect the TCP / IP connection with the first electronic device 100. At this time, if the server 300 receives a first message sent by the application A' of the third electronic device 400 and targeted at the application A of the first electronic device 100, since the TCP / IP connection between the server 300 and the first electronic device 100 is disconnected, the server 300 will be unable to send the first message to the first electronic device 100. Therefore, when the first electronic device 100 is in the screen-off state, it cannot receive the first message sent by the third electronic device 400.
[0045] After the first electronic device 100 is lit again, the system and Wi-Fi chip of the first electronic device 100 are awakened, and the first electronic device 100 re-establishes a TCP / IP connection with the server 300. After detecting that the first electronic device 100 re-establishes a TCP / IP connection with the server 300, the server 300 can send the first message received during the screen-off period of the first electronic device 300 to the first electronic device 100.
[0046] In this way, there will be a delay in the first electronic device 100 receiving the message from the server 300. Moreover, when the first electronic device 100 just enters the lit state, the Wi-Fi of the first electronic device 100 needs to re-establish a TCP / IP protocol connection with the server 300, which will cause network lag in the first electronic device 100 and affect the user experience.
[0047] To solve the above problems, in some embodiments, the electronic device can periodically wake up the Wi-Fi chip in the screen-off state to facilitate sending heartbeats to the server and receiving messages from the server in a timely manner. However, to ensure the communication quality of the electronic device through the Wi-Fi network, the power consumption of the Wi-Fi chip of the electronic device is usually relatively high, which will affect the battery life of the electronic device.
[0048] To reduce the power consumption of the electronic device for communication via Wi-Fi in the screen-off state of the display screen, this application proposes a communication method. By this method, a first Wi-Fi chip and a second Wi-Fi chip are configured in the first electronic device, where the power consumption of the second Wi-Fi chip is lower than that of the first Wi-Fi chip. When the first electronic device is in the wake-up state (for example, when the display screen of the first electronic device is lit), the first Wi-Fi chip is awakened and the second Wi-Fi chip is in a sleep state, and the first electronic device communicates with other devices via the first Wi-Fi chip through the Wi-Fi network. When the first electronic device switches from the wake-up state to the sleep state (for example, when the display screen of the first electronic device is in the screen-off state), the first electronic device sets the first Wi-Fi chip to sleep and wakes up the second Wi-Fi chip, and communicates with other devices via the second chip through the Wi-Fi network. For example, the first electronic device can maintain a long connection between the first electronic device and the server through the second Wi-Fi chip, receive data sent by the server, and perform corresponding processing logic based on the received data (for example, when the received data includes conditions for waking up the processor of the first electronic device, the second Wi-Fi chip wakes up the processor to process the corresponding message. When the conditions for waking up the processor of the first electronic device are met and the conditions for waking up the first Wi-Fi chip are met, the second Wi-Fi chip wakes up the processor of the first electronic device, and then the processor wakes up the first Wi-Fi chip and switches to the first Wi-Fi chip to process the message), etc.
[0049] Based on the above method, when the first electronic device is in the sleep state, the first electronic device maintains a long connection with the server based on the second Wi-Fi chip with lower power consumption (for example, the operating voltage of the first Wi-Fi chip is between 3.3V and 5V, and the operating voltage of the second Wi-Fi chip is between 1.8V and 2.5V).) to receive messages sent by the server to the first electronic device. Therefore, there will be no delay in the first electronic device receiving messages. Also, since the power consumption of the second Wi-Fi chip is low, it is beneficial to reduce the power consumption of communication via Wi-Fi when the display screen of the electronic device is turned off.
[0050] In some embodiments, it is assumed that the first electronic device connects to the Wi-Fi network provided by the second electronic device (such as a router) based on the first media access control (MAC) address and the Internet protocol (IP) address of the first Internet before switching from the lit screen state to the off screen state through the first Wi-Fi chip. When the first electronic device switches from the lit screen state to the off screen state and switches to communicate with other devices through the second Wi-Fi chip, the second Wi-Fi chip can also connect to the Wi-Fi network provided by the second electronic device based on the first IP address and the first MAC. Since the MAC address and the IP address corresponding to the first electronic device do not change, the second electronic device will not detect that the chip of the first electronic device connected to the second electronic device has switched from the first Wi-Fi chip to the second Wi-Fi chip. In this way, the Wi-Fi connection between the first electronic device and the second electronic device does not need to be interrupted, and the service of the first electronic device transmitting data to the server will not be interrupted. The fluency of the network connection of the first electronic device is improved. Among them, the second electronic device in the embodiments of the present application is any access point (AP), including but not limited to routers, any terminal device (or network device) capable of providing a mobile hotspot, wireless network cards, wireless routers, mobile broadband modems, and customer premise equipment (CPE).
[0051] In some embodiments, after the display screen of the first electronic device enters the lit screen state from the off screen state, the application processor (AP) (the application processor is used to run the operating system and process application programs) and the first Wi-Fi chip of the first electronic device will also be awakened. At this time, the first electronic device switches the second Wi-Fi chip to the first Wi-Fi chip to connect to the server, and the second Wi-Fi chip enters the sleep state.
[0052] In some other embodiments, the display screen of the first electronic device is in the off-screen state, and the application processor and the first Wi-Fi chip of the first electronic device are in the sleep state. When the second Wi-Fi chip of the first electronic device receives a push message from other devices via the Wi-Fi network, it can determine whether the push message needs to be processed by the application processor of the first electronic device. And when the judgment result is negative, the second Wi-Fi chip processes the corresponding push message. For example, in some embodiments, when the second Wi-Fi chip is in the processing wake-up state, it can determine whether the received push message is an invalid broadcast or a useless data packet (hereinafter referred to as junk message). If the second Wi-Fi chip receives a junk message, the second Wi-Fi chip can process the above-mentioned invalid broadcast or junk message (such as filtering junk messages and invalid broadcasts) without waking up the application processor. In this scenario, the application processor and the first Wi-Fi chip of the first electronic device are in the sleep state. Thus, the first electronic device only needs to connect to the server through the low-power second Wi-Fi chip in the off-screen state to maintain the long connection between the first electronic device and the server and reduce the power consumption of the first electronic device.
[0053] In some other embodiments, when the message pushed by other devices to the application of the first electronic device via the Wi-Fi network received by the second Wi-Fi chip is (for example, news push message, instant messaging message, prompt message for the server to obtain the power, location, network status, etc. of the first electronic device), the condition for waking up the application processor of the first electronic device is satisfied (i.e., the first wake-up condition). The second Wi-Fi chip wakes up the application processor of the first electronic device to process the corresponding pushed message. In this scenario, the first Wi-Fi chip remains in the sleep state. Thus, the first electronic device can also process the notification messages received by the application in the sleep state of the first Wi-Fi chip, avoiding delays in the messages received by the application of the first electronic device and also reducing the power consumption of the first electronic device.
[0054] In some other embodiments, when the second Wi-Fi chip receives a message indicating that another device is making a call to the first electronic device (such as an update message of an application or an operating system, etc.), which meets the condition for waking up the application processor and the first Wi-Fi chip of the first electronic device (i.e., the second wake-up condition), the second Wi-Fi chip will wake up the application processor of the first electronic device to process the message. When the application processor of the first electronic device determines that the push message requires waking up the first Wi-Fi chip, it will wake up the first Wi-Fi chip, and the first electronic device will switch to the first Wi-Fi chip to process the corresponding push message (for example, the second Wi-Fi chip can wake up the application processor of the first electronic device, and the application processor wakes up the first Wi-Fi chip, and based on the first Wi-Fi chip, download the data packet of the application program or the data packet for system upgrade from the server). In this way, the first electronic device can also receive some push messages that require user processing in a timely manner when it is in the sleep state.
[0055] In some embodiments, the second Wi-Fi chip of the first electronic device supports TCP / IP protocol sinking (sinking TCP / IP protocol operations to the network layer for execution can reduce the need to process data packets at the application layer). When the second Wi-Fi chip is connected to the server, it ensures that the first electronic device is in a connected state with the server by sending data packets to the server.
[0056] Through this solution, when the first Wi-Fi chip of the first electronic device enters the sleep state, the data transmission channel can be switched from the first Wi-Fi chip to the second Wi-Fi chip (the switching process between the first Wi-Fi chip and the second Wi-Fi chip of the first electronic device cannot be detected by the application programs in the first electronic device and the second electronic device). Therefore, the switching process between the first Wi-Fi chip and the second Wi-Fi chip of the first electronic device does not re-establish a connection with the server, and there will be no lag when the application program of the first electronic device transmits data and interacts with the server. And because the power consumption of the second Wi-Fi chip is relatively small, when the first Wi-Fi chip is in the sleep state, the first electronic device maintains a connection with the server through the second Wi-Fi chip, enabling the first electronic device to receive messages pushed from the server even in the low-power sleep state.
[0057] Next, a scenario when the first electronic device 100 in the embodiments of the present application is in the sleep state will be introduced.
[0058] For example, Figure 2 A scenario diagram of the sleep of an electronic device is shown according to an embodiment of the present application.
[0059] As Figure 2As shown in the figure, a first Wi-Fi chip 10, a second Wi-Fi chip 20, and an application processor 30 are configured in the first electronic device 100 in the embodiment of the present application. When the display screen of the first electronic device 100 is turned off and in the sleep state, the application processor 30 and the first Wi-Fi chip 10 of the first electronic device 100 enter the sleep state synchronously. At this time, the first electronic device 100 switches to the second Wi-Fi chip 20 to establish a TCP / IP protocol connection with the server 300. The power consumption of the second Wi-Fi chip 20 is less than that of the first Wi-Fi chip 10, thereby saving the energy consumption of the first electronic device 100. And the first electronic device 100 can maintain a long connection with the server 300 to receive the first message pushed by the server 300 to the first electronic device 100, avoiding delays in receiving messages by the application program of the first electronic device 100.
[0060] In some embodiments, in the current Wi-Fi environment (hereinafter referred to as the first Wi-Fi) of the first electronic device 100, the application processor 30 and the first Wi-Fi chip 10 enter the sleep state, and switch to the second Wi-Fi chip 20 to connect to the server 300. If the first electronic device 100 maintains the sleep state and leaves the first Wi-Fi environment and enters another Wi-Fi environment (hereinafter referred to as the second Wi-Fi). The application processor 30 and the first Wi-Fi chip 10 of the first electronic device 100 will be awakened, and the first electronic device 100 switches to the first Wi-Fi chip 10 to connect to the second Wi-Fi. After the first Wi-Fi chip completes the connection with the second Wi-Fi, the first electronic device 100 switches to the second Wi-Fi chip 20 to connect to the second Wi-Fi, and connects to the Internet to establish a TCP / IP protocol connection with the server 300. At this time, the application processor 30 and the first Wi-Fi chip 10 of the first electronic device 100 will enter the sleep state again.
[0061] In other embodiments, when the first electronic device 100 is in the sleep state and enters the second Wi-Fi environment, the second Wi-Fi chip 20 can also directly establish a connection with the second Wi-Fi. When the first electronic device 100 is awakened (for example, enters the screen-on state), the first electronic device 100 obtains the MAC address and IP address of the second Wi-Fi chip 20 for the first Wi-Fi chip 100 to connect to the second Wi-Fi, thereby ensuring that the first electronic device 100 switching the Wi-Fi chip cannot be detected by the electronic device providing the second Wi-Fi, so as to ensure that the process of switching the Wi-Fi chip will not disconnect the connection with the second Wi-Fi after the first electronic device 100 connects to the second Wi-Fi.
[0062] Next, in combination with Figure 2The following scenario describes the process of an electronic device switching between a first Wi-Fi chip and a second Wi-Fi chip.
[0063] For example, Figure 3A Some embodiments according to the present application illustrate a process diagram of an electronic device switching Wi-Fi chips.
[0064] As Figure 3A As shown, in the first electronic device 100, a first Wi-Fi chip 10, a second Wi-Fi chip 20, and an application processor 30 are configured.
[0065] When the display screen of the first electronic device 100 is in the lit state, the first Wi-Fi chip 10 and the application processor 30 are in the wake state, and the second Wi-Fi chip 20 is in the sleep state.
[0066] At this time, the first electronic device 100 generates a key through processes such as authentication, association, and four-way handshake with the second electronic device 200 via the first Wi-Fi chip to establish a Wi-Fi connection. Then, the first Wi-Fi chip 10 of the first electronic device 100 connects to the Internet to establish a TCP / IP protocol connection with the server 300, so that the application programs in the first electronic device 100 can transmit data with the server 300.
[0067] Exemplarily, the four-way handshake includes:
[0068] First handshake: The second electronic device 200 sends a message containing an ANonce (data randomly generated by the second electronic device 200, where A represents the authenticator) to the first electronic device 100, and the first electronic device 100 generates a pairwise transit key (PTK) through the ANonce. Among them, the PTK is used to encrypt the unicast data packets for communication between the second electronic device 200 and the first electronic device 100.
[0069] Second handshake: After the first electronic device 100 generates the PTK, it will respond with an Extensible Authentication Protocol over LAN (EAPOL) to the second electronic device 200. The EAPOL contains SNonce (data randomly generated by the first electronic device 100, where S represents the supplicant) and a Message Integrity Check (MIC). The second electronic device 200 uses the SNonce to generate its own PTK, and the MIC is used to verify the integrity of the message sent by the first electronic device 100. After receiving the SNonce, the PTK generated by the second electronic device 200 can be used to encrypt the keys for the subsequent two handshakes.
[0070] Third handshake: In this handshake, the second electronic device 200 mainly sends the Group Temporal Key (GTK) to the first electronic device 100 and notifies the first electronic device 100 to encrypt the data using the PTK and GTK. Since the second electronic device 200 generated the PTK during the second handshake, the third handshake can encrypt the GTK.
[0071] Fourth handshake: The first electronic device 100 sends the last EAPOL message to the second electronic device 200, which is equivalent to an acknowledgment packet, notifying the second electronic device 200 that the first electronic device 100 has encrypted the data using the PTK. After receiving this message, the second electronic device 200 will also encrypt the data using the PTK.
[0072] After both sides complete the authentication, the control port of the authenticator (i.e., the second electronic device 200) will be opened, so that data frames can pass through normally. Moreover, all unicast data frames will be protected by the PTK, and all multicast data and broadcast data will be protected by the GTK.
[0073] When the display screen of the first electronic device 100 enters the screen-off state, the first Wi-Fi chip 10 and the application processor 30 enter the sleep state, and the first electronic device 100 performs a Wi-Fi link switch to wake up the second Wi-Fi chip 20. Then, the first electronic device 100 establishes a Wi-Fi connection with the second electronic device 200 through the second Wi-Fi chip 20 through processes such as authentication, association, and four-way handshake, and establishes a TCP / IP protocol connection with the server 300 based on the second Wi-Fi chip 20. At this time, the first electronic device 100 sends a heartbeat packet to the server 300 through the second Wi-Fi chip 20 to maintain a long TCP / IP protocol connection between the first electronic device 100 and the server 300. The heartbeat packet can be, for example, a data packet sent every 5 minutes. In this way, when the application processor 30 and the first Wi-Fi chip 10 of the first electronic device 100 are in the sleep state, the first electronic device 100 can also maintain a long connection with the server 300 and receive messages pushed from the server 300 in a timely manner.
[0074] When the display screen of the first electronic device 100 enters the screen-on state, the application processor 30 and the first Wi-Fi chip 10 of the first electronic device 100 are awakened, and the first electronic device 100 performs a Wi-Fi link switch again to make the second Wi-Fi chip enter the sleep state. The first Wi-Fi chip 10 establishes a Wi-Fi connection with the second electronic device 200 again through processes such as authentication, association, and four-way handshake, and establishes a TCP / IP protocol connection with the server 300 through Wi-Fi access to the Internet.
[0075] Exemplarily, after the first electronic device 100 enters the screen-off state, the first Wi-Fi chip 10 and the application processor 30 of the first electronic device 100 enter the sleep state, and the first electronic device 100 maintains a long connection with the server 300 through the second Wi-Fi chip 20 with lower power consumption. In this way, the first electronic device 100 can not only reduce power consumption but also receive messages from the server 300 in a timely manner to maintain the smoothness of the network of the first electronic device 100.
[0076] Next, the switching process of the Wi-Fi chip of the first electronic device 100 will be introduced. For example, Figure 3B According to some embodiments of the present application, a flowchart of the first electronic device 100 switching the Wi-Fi chip is shown.
[0077] As Figure 3B shown, the process includes:
[0078] S301, the first Wi-Fi chip 10 of the first electronic device 100 establishes a Wi-Fi connection with the second electronic device 200 based on the first MAC address and the first IP address.
[0079] Exemplarily, in some embodiments of the present application, when the first electronic device 100 is in the screen-on state, the first Wi-Fi chip 10 is in the wake-up state. The first Wi-Fi chip 10 of the first electronic device 100 can establish a Wi-Fi connection with the second electronic device 200 through processes such as authentication, association, and generating a key through four-way handshake.
[0080] After the first Wi-Fi chip 10 is connected to the second electronic device 200, the second electronic device 200 assigns a dynamic IP address (i.e., the first IP address) to the first Wi-Fi chip 10 through the dynamic host configuration protocol (DHCP). Exemplarily, the first IP address can be, for example, 192.168.3.100. After the DHCP client on the first electronic device 100 receives the first IP address assigned by the second electronic device 200, it can access the Internet according to the first IP address and then establish a TCP / IP protocol connection with the server 300 to transmit data.
[0081] In some other embodiments, the first electronic device 100 can also establish a Wi-Fi connection with the second electronic device 200 in a static manner. For example, the user can manually set the first MAC address and the first IP address of the first electronic device 100 on the first electronic device 100 or on the second electronic device 200, and the first electronic device 100 establishes a Wi-Fi connection with the second electronic device 200 through the first MAC address and the first IP address manually set by the user.
[0082] S302, the application processor 30 of the first electronic device 100 detects the screen-off signal of the first electronic device 100.
[0083] Exemplarily, after the display screen of the first electronic device 100 automatically enters the screen-off state after a long standby or the user manually makes the first electronic device enter the screen-off state, the application processor 30 of the first electronic device 100 can detect the screen-off signal of the first electronic device 100. After that, the first electronic device 100 will enter the sleep state.
[0084] In some other embodiments, the first Wi-Fi chip 10 and the second Wi-Fi chip 20 of the first electronic device 100 can also detect that the first electronic device 100 enters the screen-off state. That is to say, after the first Wi-Fi chip 10 detects that the first electronic device 100 enters the screen-off state, the first Wi-Fi chip 10 directly enters the sleep state. After the second Wi-Fi chip 20 detects that the first electronic device 100 enters the screen-off state, it will also directly enter the wake-up state to establish a Wi-Fi connection with the second electronic device 200.
[0085] In S303, the application processor 30 of the first electronic device 100 sends a sleep instruction to the first Wi-Fi chip 10 and a wake-up instruction to the second Wi-Fi chip 20.
[0086] Exemplarily, after detecting the screen-off signal of the first electronic device 100, the application processor 30 of the first electronic device 100 sends a sleep instruction to the first Wi-Fi chip 10 and a wake-up instruction to the second Wi-Fi chip 20.
[0087] In some embodiments of the present application, after the application processor 30 of the first electronic device 100 detects that the first electronic device 100 enters the screen-off state, it can simultaneously send a sleep instruction to the first Wi-Fi chip 10 and a wake-up instruction to the second Wi-Fi chip 20.
[0088] In other embodiments, after the application processor 30 of the first electronic device 100 detects that the first electronic device 100 enters the screen-off state, it can also send a sleep instruction to the first Wi-Fi chip 10 and a wake-up instruction to the second Wi-Fi chip 20 in sequence. The present application does not limit the order in which the application processor 30 sends each instruction.
[0089] In S304, the first Wi-Fi chip 10 of the first electronic device 100 responds to the sleep instruction and enters the sleep state.
[0090] Exemplarily, after receiving the sleep instruction, the first Wi-Fi chip 10 enters the sleep state. It should be noted that the first Wi-Fi chip 10 does not send a disconnection data frame to the second electronic device 200 during the process of entering the sleep state. Therefore, after the first Wi-Fi chip 20 enters the sleep state, the first electronic device 100 still maintains a Wi-Fi connection with the second electronic device 200.
[0091] In S305, the application processor 30 of the first electronic device 100 obtains the first MAC address and the first IP address of the first Wi-Fi chip 10.
[0092] Exemplarily, the application processor 30 of the first electronic device 100 can obtain the first MAC address and the first IP address of the connection between the first Wi-Fi chip 10 and the second electronic device 200, which are used to set the connection between the second Wi-Fi chip 20 and the second electronic device 200.
[0093] In some other embodiments, the application processor 30 of the first electronic device 100 may also obtain the first MAC address and the first IP address of the first Wi-Fi chip 10 at different times twice respectively. For example, after the first Wi-Fi chip 10 establishes a Wi-Fi connection with the second electronic device 200, the first MAC address of the first Wi-Fi chip 10 is obtained. After the second electronic device 200 assigns the first IP address to the first electronic device 100, the first IP address is obtained.
[0094] S306. The application processor 30 of the first electronic device 100 sets the MAC address and the IP address of the second Wi-Fi chip 20 to be the first MAC address and the first IP address respectively.
[0095] Exemplarily, after the application processor 30 of the first electronic device 100 wakes up the second Wi-Fi chip 20, it sets the MAC address of the second Wi-Fi chip 20 to be the first MAC address. Thereby, it is avoided that the second electronic device 100 recognizes that the first electronic device 100 switches the Wi-Fi chip to connect to the second electronic device 100, and it is avoided that the connection state between the second electronic device 100 and the first electronic device 100 is disconnected (after the second electronic device 200 detects that the first electronic device 100 switches the Wi-Fi chip, the connection state between the second electronic device 200 and the first electronic device 100 before will be disconnected and a Wi-Fi connection will be re-established).
[0096] Moreover, the application processor 30 of the first electronic device 100 can set the IP address of the second Wi-Fi chip 20 to be the first IP address in the way of static IP, so that the second Wi-Fi chip 20 connects to the Internet through the same IP address as the first Wi-Fi chip 10. To ensure that the application programs in the first electronic device 100 do not detect that the first electronic device 100 switches the Wi-Fi chip to connect to the Internet, and to avoid the interruption of the connection state between the application programs in the first electronic device 100 and the Internet (when the application programs detect that the IP addresses for connecting to the network are different, the current data transmission service will be interrupted and data will be re-transmitted at the new IP address).
[0097] Exemplarily, in some embodiments of the present application, during the process of setting the MAC address of the second Wi-Fi chip, the physical MAC address of the second Wi-Fi chip can be modified to be the first MAC address. In some other embodiments, the logical MAC address of the second Wi-Fi chip connected to the second electronic device can also be configured as the first MAC address.
[0098] S307. The second Wi-Fi chip 20 of the first electronic device 100 and the second electronic device 200 establish a Wi-Fi connection based on the first MAC address and the first IP address.
[0099] Exemplarily, the second Wi-Fi chip 20 is connected to the second electronic device 200 based on the same first MAC address as the first Wi-Fi chip 10. Thus, the second electronic device 200 will not perceive the switching of the Wi-Fi chip by the first electronic device 100. Moreover, the second Wi-Fi chip 20 of the first electronic device 100 is connected to the second electronic device 200 based on the first IP address, so as to prevent the application in the first electronic device 100 from detecting the interruption of data transmission due to the first electronic device 100 switching the Wi-Fi chip to connect to the Internet. This ensures the smoothness of the connection of the first electronic device 100 to the Internet.
[0100] The switching process of the Wi-Fi chip of the first electronic device 100 described above cannot be detected by the second electronic device 100, nor can it be detected by the application on the first electronic device 100. Therefore, the connection process between the application in the first electronic device 100 and the server 300 will not be interrupted. The first electronic device 100 can receive the messages pushed by the server 300 in a timely manner, and the network connection status of the first electronic device 100 will not be interrupted or stuck.
[0101] Next, in combination with the software architecture of the first electronic device 100, the technical solution of the present application will be introduced.
[0102] For ease of understanding, first, a system software architecture of the first electronic device 100 will be introduced.
[0103] Figure 4 According to an embodiment of the present application, a schematic block diagram of a system software architecture of an electronic device is shown.
[0104] Exemplarily, taking the first electronic device 100 as a mobile phone, the software system of the first electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present invention, taking the system with a layered architecture as an example, the software structure of the first electronic device 100 will be exemplarily described.
[0105] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. Exemplarily, in some embodiments, the operating system of the first electronic device 100 can be divided into four layers, namely the application layer, the framework layer, the native framework layer (native layer), the kernel layer, the hardware abstraction layer, and the hardware layer.
[0106] As Figure 4 shown, the application layer may include a series of application programs.
[0107] The application can include a wireless application protocol supplicant (WAP Supplicant), Application A, a user datagram protocol socket (UDP socket), etc.
[0108] Among them, the WPA Supplicant is an application for managing Wi-Fi. For example, the WPA Supplicant supports wireless protocols and encryption authentication such as wired equivalent privacy (WEP), Wi-Fi protected access (WPA, with three standards: WPA, WPA2, and WPA3), and wireless LAN authentication and privacy infrastructure (WAPI). The WPA Supplicant is middleware between the Wi-Fi driver and the user (Wi-Fi application), which allows the application to interact with the Wi-Fi network.
[0109] Application A can be, for example, applications such as a camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc. Some applications such as maps, navigation, videos, etc. can access the Internet through Wi-Fi and establish a TCP / IP protocol connection with the corresponding server 300 for data transmission.
[0110] The UDP socket is a connectionless network protocol used to send and receive data between processes on the same electronic device or different electronic devices.
[0111] The application layer of the first electronic device 100 is mainly responsible for interacting with the user, providing various applications and services to meet the user's needs. For example, controlling the startup, running, and shutdown of various applications through the application management function, including the installation, uninstallation, update, etc. of the application. Or providing location and navigation services through the location and navigation function, etc.
[0112] The framework layer (framework layer) provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The framework layer includes some predefined functions.
[0113] In some embodiments of the present application, the framework layer may include, for example, a link switch service and a network management service.
[0114] The link switch service is a network communication mechanism that can switch the data transmission path to an available network connection to ensure the reliability and continuity of data transmission.
[0115] For example, the link switch service runs between the network layer and the data link layer in the operating system of an electronic device. By monitoring information such as the network signal quality and data transmission rate of the current connection, it determines whether a link switch is needed. If a switch is required, it establishes a connection with the new network and switches the data transmission path to the new network connection. For example, in the embodiments of the present application, when the first electronic device 100 switches its Wi-Fi chip, the link switch service can switch the data transmission path between the operating system of the first electronic device 100 and the Wi-Fi chip. Exemplarily, when the first electronic device 100 switches from the first Wi-Fi chip 10 to the second Wi-Fi chip 20, the link switch service can detect the network interface update of the first electronic device 100 (i.e., the network interface of the second Wi-Fi chip 20 has been established. Hereinafter, the network interface of the first Wi-Fi chip 10 is referred to as wlan1, and the network interface of the second Wi-Fi chip 20 is referred to as wlan2). The link switch service notifies the network management service to add a routing table entry corresponding to the second Wi-Fi chip 20. Packets transmitted between the application program of the first electronic device 100 and the server 300 can be determined to be transmitted by wlan2 through the newly added routing table entry, so as to correctly route the packets. That is to say, the packets between the application program of the first electronic device 100 and the server 300 are controlled to be transmitted from the network interface of wlan2 by the routing rules of the newly added routing table entry. When the first electronic device 100 switches from the second Wi-Fi chip 20 to the first Wi-Fi chip 10, the link switch service also notifies the network management service to delete the routing table entry corresponding to the second Wi-Fi chip to restore the data transmission path. That is to say, after the first electronic device 100 switches from the second Wi-Fi chip 20 to the first Wi-Fi chip 10, the packets transmitted between the application program of the first electronic device 100 and the server 300 are restored to be transmitted from the network interface of wlan1.
[0116] The network management service may include, for example, network connection management, network policy management, network transmission data statistics, and network interface management, etc.
[0117] Among them, network connection management is used to provide data connection management services. For example, mobile data, Wi-Fi, Ethernet, etc.
[0118] Network policy management is used to provide network policy management services. For example, perform priority management of network connections based on conditions such as time, location, and user identity.
[0119] Network transmission data statistics is used to provide network transmission data statistics services. For example, real-time monitoring of data traffic, speed, etc.
[0120] Network interface management is used to provide management services for physical network interfaces. For example, in some embodiments of the present application, after the first electronic device 100 switches from the first Wi-Fi chip 10 to the second Wi-Fi chip 20, the network management service can establish a new routing table entry according to the information sent by the link switching service, and switch the communication between the application program in the first electronic device 100 and the server 300 from the network interface of wlan1 to the network interface of wlan2. Exemplarily, after the link switching service detects that the network interface waln2 of the second Wi-Fi chip 20 is added to the first electronic device 100, it sends the network interface information of wlan2 (such as the IP address, subnet mask, etc. corresponding to the network interface of wlan2) to the network management service, and the network management service establishes a routing table entry corresponding to wlan2 according to the network interface information of wlan2. Through this newly added routing table entry, the data packets transmitted between the first electronic device 100 and the server 300 can be controlled to be transmitted through the network interface of wlan2. Similarly, after the network management service deletes the newly added routing table entry, the transmission of data packets between the application program of the first electronic device 100 and the server 300 is switched to the network interface of wlan1.
[0121] In some other embodiments, the framework layer may further include a window management service WMS, a view system, a graphics system, a surface flinger system, a display engine service, a resource manager, a notification manager, etc.
[0122] The native framework layer (native layer) includes native services and link libraries, etc. For example, an audio flinger, a media player service, a camera service, and an audio policy service
[0123] Among them, the local service also includes UDP sockets. The UDP sockets in the local service are a set of application programming interfaces (APIs) provided by the operating system for network programming to applications, also known as datagram sockets. These APIs allow applications to create UDP sockets and bind them to specific local addresses and ports for sending and receiving datagrams. In network communication, an application needs to use the UDP sockets in the local service to create UDP sockets and bind them to specific local addresses and ports. Then, the application can send and receive datagrams through the socket to achieve communication with a remote host process. Therefore, the UDP sockets at the application layer and the UDP sockets in the local service are closely related, and they jointly implement network communication based on the UDP protocol.
[0124] The kernel layer is the layer between hardware and software for connecting the hardware and software of the first electronic device 100. Exemplarily, in some embodiments of the present application, the kernel layer may include, for example, the first Wi-Fi chip driver, the second Wi-Fi chip driver, etc. and the TCP / IP protocol, etc. The kernel layer realizes the control of the first Wi-Fi chip and the second Wi-Fi chip through the first Wi-Fi chip driver and the second Wi-Fi chip driver. In some other embodiments, the kernel layer may further include a central processing unit (CPU) driver, a graphics processing unit (GPU) driver, a display driver, a sensor driver, a camera driver, etc.
[0125] The hardware abstraction layer (HAL layer) is located between the operating system kernel and the hardware layer, used to abstract the hardware, hide the details of the hardware interface, and provide a virtual hardware platform for the operating system.
[0126] Exemplarily, in some embodiments of the present application, the HAL layer may include, for example, a network daemon (NetD) and a network filter (netfilter).
[0127] Among them, the network daemon is a background daemon program responsible for network management and control. For example, the network daemon can perform operations such as setting up a firewall, network address translation, bandwidth control, soft access point control for wireless network cards, tethering of network devices, and routing table control. In an embodiment of the present application, the network management service can send an instruction to add a routing table entry to the network daemon, and the network daemon adds a new routing table entry (i.e., adds a routing rule) in the routing table according to the instruction sent by the network management service to control the routing path of data packets transmitted between the application program in the first electronic device 100 and the server 300. For example, the transmission path of data packets transmitted between the application program in the first electronic device 100 and the server 300 is switched to the network interface of wlan2 through the newly added routing table entry.
[0128] The network filter can filter and intercept network data packets through some rules and can customize rules to control the flow direction of network data packets. For example, the network filter provides a series of hooks that can intercept and process data packets when they enter and leave the network interface. These hooks can be used to add, modify, and delete the header and tail information of data packets, as well as check and filter the content of data packets. Through the rules and policies of the network filter, functions such as filtering, monitoring, and security control of network data can be achieved.
[0129] The hardware layer includes the hardware components of the first electronic device 100, such as components like a processor, a memory, a battery, a camera, etc. In some embodiments of the present application, the hardware layer may include components such as a first Wi-Fi chip and a second Wi-Fi chip, for example.
[0130] As Figure 4 shown, in some embodiments of the present application, when the application processor 30 of the first electronic device 100 (i.e., the operating system and running application programs of the first electronic device 100) and the first Wi-Fi chip 10 are in the wake-up state (i.e., the display screen of the first electronic device 100 is in the lit state), the first Wi-Fi chip 10 of the first electronic device 100 connects to the second electronic device 200 through processes such as authentication, association, and four-way handshake, and then connects to the Internet to establish a connection with the server 300. At this time, the second Wi-Fi chip 20 is in the sleep state (as Figure 4 the shaded part in
[0131] indicates the sleep state). Figure 4The shaded part therein indicates the sleep state), the first electronic device 100 wakes up the second Wi-Fi chip 20, and enables the second Wi-Fi chip 20 to connect to the second electronic device 200 through processes such as authentication, association, and four-way handshake, so as to maintain a long connection between the first electronic device 100 and the server 300 even when the operating system of the first electronic device 100 is in the sleep state.
[0132] Exemplarily, during the process of the first electronic device 100 switching between the first Wi-Fi chip 10 and the second Wi-Fi chip 20, it includes a link layer switch and a network layer switch. Among them, when the link layer switches, the second electronic device 200 will not detect that the first electronic device 100 is switching the Wi-Fi chip.
[0133] It should be understood that the second electronic device 200 can determine the Wi-Fi chip connected to the second electronic device 200 through the MAC address of the Wi-Fi chip. In some embodiments of the present application, when the first electronic device 100 switches the first Wi-Fi chip 10 to the second Wi-Fi chip 20, it will obtain the first MAC address of the first Wi-Fi chip 10 (for example, the first MAC address of the obtained first Wi-Fi chip 10 is 00:11:22:33:44:55), and then set the MAC address of the second Wi-Fi chip 20 to the first MAC address. That is to say, the MAC address of the second Wi-Fi chip 20 is also 00:11:22:33:44:55. Therefore, the second electronic device 200 will detect that the first electronic device 100 is still using the same Wi-Fi chip to connect to the Internet. That is to say, the second electronic device 200 will not detect that the first electronic device 100 switches the Wi-Fi chip to connect to the second electronic device 200.
[0134] When the network layer switches, the network to which the application program in the first electronic device 100 is connected to the server 300 will not change. That is to say, when the first electronic device 100 switches to the second Wi-Fi chip 20 to connect to the Internet, the IP address of the second Wi-Fi chip 20 connecting to the Internet can be set to be the same as the IP address of the first Wi-Fi chip connecting to the Internet by means of a static IP (manually setting the IP address). Therefore, the application program in the first electronic device 100 will not detect that the first electronic device 100 has switched the Wi-Fi chip to connect to the Internet when the IP addresses for connecting to the Internet are the same.
[0135] Next, the process of the link layer switch of the first electronic device 100 will be introduced.
[0136] Figure 5 According to some embodiments of the present application, a flowchart of an electronic device switching a Wi-Fi chip is shown.
[0137] Exemplarily, in some embodiments of the present application, the first electronic device 100 may be, for example, an electronic device such as a mobile phone, a tablet computer, a notebook, a wearable device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The specific type of the first electronic device 100 is not limited in the embodiments of the present application. Moreover, the second electronic device 200 in the embodiments of the present application may be, for example, a device such as a router, a mobile hotspot, a wireless network card, a wireless router, and a mobile broadband modem. The specific type of the second electronic device 200 is not limited in the embodiments of the present application
[0138] As Figure 5 shown, the process includes:
[0139] In the screen-on state, the operating system of the first electronic device 100 is in the wake-up state.
[0140] S501, the first Wi-Fi chip 10 of the first electronic device 100 establishes a Wi-Fi connection with the second electronic device 200.
[0141] Exemplarily, in some embodiments of the present application, when the first electronic device 100 is in the screen-on state, the first Wi-Fi chip 10 is in the wake-up state. The first Wi-Fi chip 10 of the first electronic device 100 can establish a Wi-Fi connection with the second electronic device 200 through processes such as authentication, association, and generating a key through four-way handshake.
[0142] Exemplarily, the four-way handshake includes:
[0143] First handshake: The second electronic device 200 sends a message containing ANonce to the first electronic device 100, and the first electronic device 100 generates PTK through ANonce.
[0144] Second handshake: After the first electronic device 100 generates PTK, it responds with an EAPOL to the second electronic device 200. The EAPOL contains SNonce and MIC. The second electronic device 200 generates its own PTK with SNonce, and MIC is used to verify the integrity of the message sent by the first electronic device 100.
[0145] Third handshake: The second electronic device 200 sends GTK to the first electronic device 100 and notifies the first electronic device 100 to encrypt data through PTK and GTK.
[0146] Fourth handshake: The first electronic device 100 sends the last EAPOL message to the second electronic device 200, notifying the second electronic device 200 that the first electronic device 100 has been encrypted using the PTK. After receiving this message, the second electronic device 200 will also encrypt the data using the PTK.
[0147] After both sides complete the authentication, the control port of the second electronic device 200 will be opened, so that data frames can pass through normally, and all unicast data frames will be protected by the PTK, and all multicast data and broadcast data will be protected by the GTK.
[0148] S502, the second electronic device 200 assigns a first IP address to the first Wi-Fi chip 10 of the first electronic device 100.
[0149] Exemplarily, in some embodiments of the present application, after the first Wi-Fi chip 10 is connected to the second electronic device 200, the second electronic device 200 assigns a dynamic IP address (i.e., the first IP address) to the first Wi-Fi chip 10 through the dynamic host configuration protocol (DHCP). Exemplarily, the first IP address can be, for example, 192.168.3.100. After the DHCP client on the first electronic device 100 receives the first IP address assigned by the second electronic device 200, it can access the Internet according to the first IP address, and then establish a TCP / IP protocol connection with the server 300 to transmit data.
[0150] S503, the first Wi-Fi chip 10 of the first electronic device 100 receives a sleep instruction and enters the sleep state.
[0151] Exemplarily, in some embodiments of the present application, when the first electronic device 100 enters the screen-off state, after the operating system of the first electronic device 100 detects that the first electronic device 100 enters the screen-off state, it sends a sleep instruction to the first Wi-Fi chip 10. After that, the operating system of the first electronic device 100 will also enter the sleep state. Exemplarily, when the screen of the first electronic device 100 enters the screen-off state and the first electronic device 100 has not been operated for a period of time, it will automatically enter the sleep state. In other embodiments, the first electronic device 100 can also enter the sleep state through manual user settings.
[0152] After receiving the sleep instruction, the first Wi-Fi chip 10 will not send a deauth frame (a data packet for disconnecting the network connection with the second electronic device 200) to the second electronic device 200. Instead, it directly enters the sleep state, so the first electronic device 100 will not disconnect the Wi-Fi connection with the second electronic device 200.
[0153] S504. The second Wi-Fi chip 20 of the first electronic device 100 establishes a Wi-Fi connection with the second electronic device 200.
[0154] Exemplarily, in some embodiments of the present application, after the operating system of the first electronic device 100 detects that the display screen of the first electronic device 100 enters the screen-off state, it wakes up the second Wi-Fi chip and connects to the second electronic device 200 based on the second Wi-Fi chip through processes such as authentication, association, and four-way handshake to generate a key. The specific process of establishing a Wi-Fi connection through the four-way handshake can refer to the description in step S501 and will not be elaborated here.
[0155] Exemplarily, when the second Wi-Fi chip 20 of the first electronic device 100 is connected to the second electronic device 200, the operating system of the first electronic device 100 will obtain the first MAC address (such as 00:11:22:33:44:55) of the connection between the first Wi-Fi chip 10 and the second electronic device 200, and set the MAC address of the second Wi-Fi chip 20 to the first MAC address (that is, the MCA address of the second Wi-Fi chip 20 is also 00:11:22:33:44:55). Therefore, the process of the second electronic device 200 authenticating, associating, and generating a key through the four-way handshake with the second Wi-Fi chip 20 is equivalent to the process of the first electronic device 100 reconnecting to the second electronic device 200 once. It should be understood that since the first Wi-Fi chip 10 is not disconnected from the second electronic device 200, the reconnection process is equivalent to the process of the first electronic device 100 obtaining a key again to connect to the second electronic device 200, and this process will not cut off the network connection with the second electronic device 200. The second electronic device 200 will not detect that the first electronic device 100 has switched the Wi-Fi chip. Exemplarily, the above process of switching the Wi-Fi chip can be 200 ms, for example. That is to say, within these 200 ms, the process of the first electronic device 100 switching the Wi-Fi chip to connect to the second electronic device 200 through Wi-Fi will not disconnect the previous connection state between the first electronic device 100 and the second electronic device 200.
[0156] If the first electronic device 200 does not set the MAC address of the second Wi-Fi chip 20 to the first MAC address of the first Wi-Fi chip when switching the connection between the second Wi-Fi chip 20 and the second electronic device 200, the second electronic device 200 will detect that the first electronic device 100 switches the Wi-Fi chip to connect to the second electronic device 200. The second electronic device 200 will disconnect the previous connection with the first Wi-Fi chip 10 and reconnect to the second Wi-Fi chip 20, and this reconnection process will cause the services of the first electronic device 100 that were previously connected to the second electronic device 200 based on the first Wi-Fi chip 10 to be interrupted. That is to say, the first electronic device 100 will experience lag during data transmission.
[0157] S505. The first electronic device 100 sets the IP address of the second Wi-Fi chip 20 to the first IP address.
[0158] Exemplarily, in some embodiments of the present application, after the second Wi-Fi chip 20 is connected to the second electronic device 200, the first electronic device 100 can set the IP address of the second Wi-Fi chip 20 to the first IP address in the manner of a static IP. That is to say, the IP address of the second Wi-Fi chip 20 is also 192.168.3.100. Therefore, the IP address to which the application program in the first electronic device 100 connects to the second electronic device 200 does not change, and the application program will not detect that the first electronic device 100 has switched the Wi-Fi chip, thereby maintaining the network connection status of the first electronic device 100.
[0159] It should be understood that during the process of the application program connecting to the Internet and transmitting data with the server 300, if the IP address of the first electronic device 100 changes, the application program will disconnect the current network and re-access the Internet through the new IP address to transmit data with the server 300. That is to say, the current data transmission service of the application program will be interrupted, and the first electronic device 100 will experience lag during data transmission.
[0160] S506. The second Wi-Fi chip 20 of the first electronic device 100 connects to the Internet through the second electronic device 200 and sends a heartbeat packet to keep alive to the server 300.
[0161] Exemplarily, in some embodiments of the present application, after the second Wi-Fi chip 20 is connected to the Internet through the second electronic device 200, it establishes a connection with the server 300 and sends a heartbeat packet to keep alive to the server 300 to maintain a long connection between the first electronic device 100 and the server 300. For example, the second Wi-Fi chip 20 can send a data packet to the server 300 every 5 minutes to keep the connection with the server 300.
[0162] That is to say, during the process of the second Wi-Fi chip 20 maintaining a connection with the server 300, the second Wi-Fi chip 20 can receive messages pushed from the server 300, and during the sleep process of the operating system of the first electronic device 100, there will be no delay in receiving messages.
[0163] In some embodiments of the present application, when the second Wi-Fi chip 20 wakes up, it can automatically process invalid broadcasts or junk messages sent by other devices, and the operating system of the first electronic device 100 and the first Wi-Fi chip 10 are in a sleep state.
[0164] In other embodiments, when the second Wi-Fi chip 20 receives a message pushed from the server 300 (such as a notification message of certain applications in the first electronic device 100), the second Wi-Fi chip 20 can wake up the operating system of the first electronic device 100 to process the corresponding pushed message. At this time, the first Wi-Fi chip 10 remains in a sleep state.
[0165] In other embodiments, when the second Wi-Fi chip 20 receives a message pushed from the server 300 (such as a message for a call between another device and the first electronic device 100 pushed by the server 300), the second Wi-Fi chip 20 will wake up the operating system of the first electronic device 100 to process the pushed message. When the operating system of the first electronic device 100 determines that the pushed message needs to wake up the first Wi-Fi chip 10, it will wake up the first Wi-Fi chip 10, and the first electronic device 100 will switch to the first Wi-Fi chip 10 to process the corresponding pushed message.
[0166] S507, the second Wi-Fi chip 20 of the first electronic device 100 receives a sleep instruction and enters a sleep state.
[0167] Exemplarily, in some embodiments of the present application, the display screen of the first electronic device 100 enters a lit state. The operating system of the first electronic device 100 sends a sleep instruction to the second Wi-Fi chip 20, and the second Wi-Fi chip 20 enters a sleep state. At this time, the second Wi-Fi chip will not send a deauth frame to the second electronic device 200, will not disconnect from the second electronic device 200, but directly enters a sleep state.
[0168] S508, the first Wi-Fi chip 10 of the first electronic device 100 receives a wake-up instruction and establishes a Wi-Fi connection with the second electronic device 200.
[0169] Exemplarily, after the display screen of the first electronic device 100 is turned on, the operating system of the first electronic device 100 is awakened. The operating system of the first electronic device 100 sends a wake-up instruction to the first Wi-Fi chip 10, and the first Wi-Fi chip 10 is awakened after receiving the wake-up instruction. Then, the first Wi-Fi chip 10 re-establishes a connection with the second electronic device 200 through processes such as authentication, association, and generating a key through four-way handshake. During the process of re-establishing the connection, the first Wi-Fi chip 10 still uses the previous MAC address. Therefore, the second electronic device 200 will not detect that the first electronic device 100 has switched the Wi-Fi chip. The process of the first Wi-Fi chip 10 establishing a connection with the second electronic device 200 will not interrupt the previous connection state between the first electronic device 100 and the second electronic device 200.
[0170] S509, the first Wi-Fi chip 10 of the first electronic device 100 sets the IP address to the first IP address.
[0171] Exemplarily, in some embodiments of the present application, after the first electronic device 100 switches to the first Wi-Fi chip 10 to connect with the second electronic device 200 after the screen is turned on, the IP address of the first Wi-Fi chip 10 will also be set to the first IP address to keep the IP address for the first electronic device 100 to access the Internet unchanged.
[0172] S510, the first Wi-Fi chip 10 of the first electronic device 100 connects to the Internet through the second electronic device 200 and establishes a TCP / IP protocol connection with the server 300.
[0173] Exemplarily, in some embodiments of the present application, after the first Wi-Fi chip 10 of the first electronic device 100 reconnects to the Internet through the second electronic device 200, it can establish a connection with the server 300 and transmit data with the server 300.
[0174] Exemplarily, when the first Wi-Fi chip 10 of the first electronic device 100 switches to the second Wi-Fi chip 20 to connect to the second electronic device, since the MAC address of the second Wi-Fi chip 20 is set to the first MAC address of the first Wi-Fi chip 10. Therefore, the second electronic device 200 will not detect that the first electronic device 100 has switched the Wi-Fi chip and will not interrupt the Wi-Fi connection with the first electronic device 100. And when the first electronic device 100 connects to the second electronic device 200 through the second Wi-Fi chip 20, the IP address of the second Wi-Fi chip 20 is set to be the same as the first IP address of the first Wi-Fi chip in the way of static IP, so as to ensure that the application program of the first electronic device 100 will not detect that the first electronic device 100 has switched the Wi-Fi chip to connect to the Internet. Therefore, the application program of the first electronic device 100 will not interrupt the current data transmission service to ensure the smoothness of data transmission of the first electronic device 100.
[0175] Next, the process in which the application program in the first electronic device 100 does not detect the switching of the Wi-Fi chip in the first electronic device 100 will be introduced.
[0176] For example, Figure 6 According to some embodiments of the present application, a process of link switching in the network layer of an electronic device is shown.
[0177] Exemplarily, in order to prevent the application program in the first electronic device 100 from detecting a change in the Wi-Fi link, the IP addresses of the first Wi-Fi chip 10 and the second Wi-Fi chip are the same.
[0178] For example, after the first Wi-Fi chip connects to the second electronic device 200, the second electronic device 200 assigns the first IP address to the Wi-Fi chip of the first electronic device 100 through DHCP, and the DHCP client of the first electronic device 100 obtains the first IP address to connect to the second electronic device 200. When the operating system of the first electronic device 100 and the first Wi-Fi chip 10 go to sleep, the Wi-Fi link of the first electronic device 100 switches to the second Wi-Fi chip 20, and the second Wi-Fi chip 20 uses the static IP method to set the IP address of the second Wi-Fi chip 20 to the first IP address. Then the network interface of the first electronic device 100 switches to the network interface of waln2.
[0179] As Figure 6As shown, after the operating system of the first electronic device 100 detects that the display screen of the first electronic device 100 enters the screen-off state, it sends a sleep instruction to the first Wi-Fi chip 10 and a wake-up instruction to the second Wi-Fi chip 20 to switch the Wi-Fi chip to connect to the second electronic device 200. After the first electronic device 100 switches to connect to the second electronic device 200 through the second Wi-Fi chip 20, the link switching service of the first electronic device 100 detects an update of the network interface of the first electronic device 100 (i.e., switching from wlan1 to wlan2). The link switching service sends the network interface information of wlan2 (for example, the IP address and subnet mask of wlan2, and in the embodiments of the present application, the IP address of wlan1 is the same as that of wlan2) to the network management service. After receiving the network interface information of wlan2 sent by the link switching service, the network management service sends an instruction to add a routing table entry to the network daemon (NetD). Based on the instruction to add a routing table entry sent by the network management service, the network daemon adds a new routing rule in the routing table so that the data packets between the application program of the first electronic device 100 and the server 300 are controlled by the new routing table entry, thereby switching the network interface of wlan1 to the network interface of wlan2 for transmission. Moreover, the network daemon can also call the hook provided by the netfilter to intercept and process the data packets when they enter and leave the network interface of wlan2, so as to implement functions such as filtering, monitoring, and security control of network data.
[0180] Exemplarily, in the embodiments of the present application, after the first electronic device 100 enters the screen-off state from the screen-on state, the first electronic device 100 switches to connect to the second electronic device 200 through the second Wi-Fi chip 20, so as to connect to the server 300. At this time, the network interface of the first electronic device 100 switches to wlan2. When transmitting data, the application program of the first electronic device 100 transmits data by calling the UDP socket interface. For example, the application program of the first electronic device 100 sends and receives data by calling the UDP socket interface in the native framework through the UDP socket. The UDP socket interface in the native framework switches the transmission path of the sent and received data packets to the network interface of wlan2 through the routing of the newly added routing table entry in NetD. In this way, the link layer switching of the first electronic device 100 is realized.
[0181] In some other embodiments, the application program of the first electronic device 100 can also send and receive data by calling the TCP socket interface in the native framework through the UDP socket. TCP socket is a protocol that provides reliable, ordered, and less error-prone data transmission. The TCP socket interface in the native framework also routes through the newly added routing entry in NetD to switch the transmission path of the sent and received data packets to the network interface of wlan2.
[0182] Exemplarily, in some embodiments of the present application, after the display screen of the first electronic device 100 is re-lit, the operating system of the first electronic device 100 and the first Wi-Fi chip 10 are awakened. The link switching service in the operating system of the first electronic device 100 determines that the network interface of the first electronic device 100 is switched to wlan1, and then sends the network interface information of wlan1 to the network management service. The network management service deletes the newly added routing entry in the network daemon process. The network daemon process switches the network interface wlan2 of the first electronic device 100 to wlan1 through the original routing rule in the routing table (i.e., the routing path connecting the network interface of wlan1). Therefore, the application program of the first electronic device 100 can re-transmit network data packets with the first Wi-Fi chip 10 through wlan1.
[0183] Taking a mobile phone as an example below, the first electronic device 100 involved in some embodiments of the present invention will be introduced in detail.
[0184] Figure 7 According to the embodiments of the present application, a schematic structural diagram of a first electronic device 100 is shown.
[0185] The first electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0186] It can be understood that the structure schematically shown in the embodiments of the present invention does not constitute a specific limitation on the first electronic device 100. In other embodiments of the present application, the first electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0187] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0188] The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0189] A memory can also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can hold the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses and reduces the waiting time of the processor 110, thus improving the efficiency of the system.
[0190] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module interface, and / or a universal serial bus (USB) interface, etc.
[0191] The charging management module 140 is configured to receive a charging input from a charger. The charger can be a wireless charger or a wired charger.
[0192] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives the inputs from the battery 142 and / or the charging management module 140 and supplies power to the processor 110, the internal memory 121, the display screen, the camera, and the wireless communication module 160, etc.
[0193] The wireless communication function of the first electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0194] The antenna 1 and the antenna 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the first electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas.
[0195] The mobile communication module 150 may provide solutions for wireless communication including 2G / 3G / 4G / 5G, etc., applied to the first electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves through the antenna 1, filter, amplify, and perform other processing on the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves through the antenna 1 and radiate it out.
[0196] The wireless communication module 160 may provide solutions for wireless communication including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc., applied to the first electronic device 100. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves through the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive the signals to be transmitted from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 and radiate them out. For example, in some embodiments of the present application, the wireless communication module 160 may include a first Wi-Fi chip 10 and a second Wi-Fi chip 20, and the power consumption of the second Wi-Fi chip 20 is less than that of the first Wi-Fi chip 10. When the operating system of the first electronic device 100 and the first Wi-Fi chip 10 enter the sleep state, the first electronic device 100 switches to the second Wi-Fi chip 20 to maintain the connection state with the server 300.
[0197] The external memory interface 120 may be used to connect an external memory card, such as a micro SD card, to expand the storage capacity of the first electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.
[0198] The internal memory 121 can be used to store computer-executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.). The data storage area can store data created during the use of the first electronic device 100 (such as audio data, a phone book, etc.). In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the first electronic device 100 by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory provided in the processor.
[0199] The SIM card interface 195 is used to connect to a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to achieve contact and separation from the first electronic device 100. In some embodiments, the first electronic device 100 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the first electronic device 100 and cannot be separated from the first electronic device 100.
[0200] In the 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. Additionally, including a structural or method feature in a specific figure does not imply that such a feature is required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0201] It should be noted that the various units / modules mentioned in the device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation manner of these logical units / modules themselves is not the most important. The combination of the functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, to highlight the innovative part of the present application, the above 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 device embodiments.
[0202] It should be noted that in the examples and the description of this patent, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one" does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.
[0203] Although this application has been illustrated and described by reference to certain preferred embodiments thereof, those of ordinary skill in the art should understand that various changes may be made therein in form and detail without departing from the spirit and scope of this application.
Claims
1. A communication method, applied to a first electronic device, characterized in that, the first electronic device includes a first Wi-Fi chip and a second Wi-Fi chip; and the method includes: when the first electronic device is in a wake-up state, communicating with a second electronic device through the first Wi-Fi chip, wherein the first Wi-Fi chip is connected to the second electronic device using a first media access control address and a first Internet protocol address; when the first electronic device enters a sleep state, switching to communicating with the second electronic device through the second Wi-Fi chip, wherein the second Wi-Fi chip is connected to the second electronic device using the first media access control address and the first Internet protocol address; wherein the power consumption of the second Wi-Fi chip is less than that of the first Wi-Fi chip.
2. The method according to claim 1, characterized in that, when the first electronic device enters a sleep state and switches to communicating with the second electronic device through the second Wi-Fi chip, it includes: when the first electronic device enters a sleep state, controlling the first Wi-Fi chip to enter a sleep state and controlling the first Wi-Fi chip not to send a disconnection message to the second electronic device.
3. The method according to claim 1, characterized in that, it further includes: when the first electronic device switches from the sleep state to the wake-up state and switches to communicating with the second electronic device through the first Wi-Fi chip, wherein the first Wi-Fi chip is connected to the second electronic device using the first media access control address and the first Internet protocol address.
4. The method according to claim 3, characterized in that, when the first electronic device switches from the sleep state to the wake-up state and switches to communicating with the second electronic device through the first Wi-Fi chip, it includes: when the first electronic device switches from the sleep state to the wake-up state, controlling the second Wi-Fi chip to enter a sleep state and controlling the second Wi-Fi chip not to send a disconnection message to the second electronic device.
5. The method according to claim 1, characterized in that, when the first electronic device enters a sleep state and switches to communicating with the second electronic device through the second Wi-Fi chip, it includes: using the second Wi-Fi chip to send a heartbeat packet to a server through the second electronic device, and / or receiving a message from the server.
6. The method according to claim 5, characterized in that, the method further includes: corresponding to the message received from the server satisfying a first wake-up condition, the second Wi-Fi chip wakes up the processor of the first electronic device; corresponding to the message received from the server satisfying a second wake-up condition, the second Wi-Fi chip wakes up the processor and the first Wi-Fi chip.
7. The method according to claim 6, characterized in that, The first wake-up condition includes that a message received by the first electronic device from the server needs to be processed by the processor of the first electronic device and the second Wi-Fi chip; the second wake-up condition includes that a message received by the first electronic device from the server needs to be processed by the processor of the first electronic device and the first Wi-Fi chip.
8. The method according to claim 1, wherein, the second electronic device is an access point.
9. An electronic device, wherein, comprising: a memory for storing instructions; a first Wi-Fi chip, a second Wi-Fi chip and at least one processor for executing the instructions to enable the electronic device to implement the communication method according to any one of claims 1 to 8.
10. A computer-readable storage medium, wherein, instructions are stored on the readable storage medium, and when the instructions are executed on a computer, the computer is caused to execute the communication method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and apparatus for controlling power consumption of portable terminal
CN105408835A
Low power consumption equipment, keep-alive server and message pushing method and system
CN108270770A
Double-chain keep-alive scheme for low-power-consumption product
CN111355685A
Low-power-consumption wireless visual doorbell sleep time difference awakening optimization scheme
CN111356214A
Data transmission method and device, storage medium and electronic equipment
CN112996089A