Method and electronic device for establishing Wi-Fi point-to-point P2P connection

By turning off the WLAN capability when receiving Wi-Fi point-to-point P2P connection request and selecting the transmission method according to the amount and type of service data, the problem of high power consumption of electronic devices is solved, and power saving and power consumption optimization are achieved without networking.

CN118474908BActive Publication Date: 2025-08-29HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311442736.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-31
Publication Date
2025-08-29
Estimated Expiration
2043-10-31

AI Technical Summary

Technical Problem

When establishing a Wi-Fi point-to-point P2P connection, the power consumption of electronic devices is high, especially when there is no need to connect to the network, the prior art cannot effectively save power and power consumption.

Method used

After receiving a request to establish a Wi-Fi point-to-point P2P connection, the electronic device turns off the WLAN capability but does not access any wireless LAN, turns on the WLAN capability only when transmitting data with the second electronic device, and selectively transmits over Wi-Fi or Bluetooth according to the amount and type of service data, turning off the WLAN capability to save power consumption.

Benefits of technology

While meeting users' uninterconnected needs, it effectively saves the power and power consumption of electronic devices and improves the use time of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118474908B_ABST
    Figure CN118474908B_ABST
Patent Text Reader

Abstract

The embodiments of the present application relate to the field of communication technology, and more particularly to a method and electronic device for establishing a Wi-Fi point-to-point (P2P) connection, which can reduce the power consumption of the electronic device when establishing a Wi-Fi point-to-point (P2P) connection. The method is applied to a first electronic device. The method includes: the WLAN capability of the first electronic device is turned off; the first electronic device receives a first request from a second electronic device, the first request being used to request establishment of a Wi-Fi point-to-point (P2P) connection with the first electronic device; in response to the first request, the first electronic device turns on the WLAN capability, and the first electronic device does not connect to any wireless local area network after turning on the WLAN capability; the first electronic device establishes a Wi-Fi point-to-point (P2P) connection with the second electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technologies, and more particularly to a method and electronic device for establishing a Wi-Fi peer-to-peer (P2P) connection. Background Art

[0002] With the popularization of smart devices and the rapid development of the Internet, multiple electronic devices can transmit collaborative business data based on Wi-Fi P2P connections to achieve device collaboration.

[0003] Device collaboration can include various collaborative services such as screen extension, screen projection, super call, screen mirroring, super notification, multi-screen collaboration, keyboard and mouse sharing, file sharing, remote control, etc.

[0004] In conventional technology, when a first electronic device establishes a Wi-Fi point-to-point (P2P) connection with a second electronic device, there is a problem of high power consumption of the electronic devices. Summary of the Invention

[0005] Embodiments of the present application provide a method and electronic device for establishing a Wi-Fi point-to-point (P2P) connection, which are used to solve the problem of high power consumption of electronic devices when establishing a Wi-Fi point-to-point (P2P) connection.

[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0007] In a first aspect, a method for establishing a Wi-Fi peer-to-peer (P2P) connection is provided, which is applied to a first electronic device. The method includes: the first electronic device has its WLAN capability disabled, the first electronic device receives a first request from a second electronic device, the first request being for establishing a Wi-Fi peer-to-peer (P2P) connection with the first electronic device; in response to the first request, the first electronic device enables its WLAN capability but does not connect to any wireless local area network; and thereafter, the first electronic device establishes a Wi-Fi peer-to-peer (P2P) connection with the second electronic device.

[0008] In the present application, the WLAN capability of the first electronic device is turned off. After the first electronic device receives the first request from the second electronic device, the first electronic device can turn on the WLAN capability but not access any local area network. In this way, after the first electronic device turns on the WLAN capability, the first electronic device and the second electronic device can establish a Wi-Fi point-to-point P2P connection. Moreover, even if the first electronic device turns on the WLAN capability, the first electronic device does not access any wireless local area network. In other words, the first electronic device turns on the WLAN capability only to transmit data with the second electronic device, and will not access the wireless local area network to perform other communication services. In this way, while meeting the user's need to be offline, the power and power consumption of the first electronic device can be saved.

[0009] In a possible implementation of the first aspect, in response to the first request, after enabling WLAN capability, the first electronic device obtains access information of one or more wireless local area networks stored by the first electronic device, where the access information is used to support the first electronic device in accessing the corresponding wireless local area network. The access information may be, for example, a network name and an access password. The first electronic device is prohibited from accessing any of the one or more wireless local area networks. After enabling WLAN capability, the first electronic device may prohibit reconnecting to the previously used wireless local area network to prevent the first electronic device from automatically reconnecting to the wireless local area network.

[0010] In a possible implementation of the first aspect, the first electronic device may receive the first request in a screen-on state or a screen-off state. The fact that the first electronic device's screen is off indicates that the user is most likely not using the first electronic device. After receiving the first request, the first electronic device, based on the fact that the first electronic device is in a screen-off state, turns on WLAN but does not connect to any wireless local area network. Since the first electronic device can receive various messages sent from the Internet after connecting to any wireless local area network, it will trigger the first electronic device to light up the screen, ring, or vibrate, which may disturb the user. Therefore, based on the screen-off state, the first electronic device does not connect to any wireless local area network after turning on the WLAN capability, so as to avoid receiving Internet messages and disturbing the user.

[0011] In one possible implementation of the first aspect, after a first electronic device enables WLAN capabilities in a screen-off state but does not connect to any wireless local area network, if the first electronic device receives a first operation from the user, the first electronic device may attempt to connect to one or more wireless local area networks stored by the first electronic device. The first operation is used to trigger the screen of the first electronic device to light up, and the first electronic device receiving the first operation from the user indicates that the user wants to use the first electronic device, and the first electronic device may attempt to connect to one or more wireless local area networks stored by the first electronic device.

[0012] In one possible implementation of the first aspect, after a first electronic device establishes a Wi-Fi peer-to-peer (P2P) connection with a second electronic device, the first electronic device and the second electronic device transmit service data via the Wi-Fi peer-to-peer (P2P) connection. If the first electronic device does not transmit service data with the second electronic device for a preset period of time, the first electronic device disables its WLAN capability.

[0013] In one possible implementation of the first aspect, when the amount of business data is greater than a preset data volume threshold, or when the business type of the business data is a preset type, the first electronic device and the second electronic device transmit the business data via a Wi-Fi point-to-point (P2P) connection. When the amount of business data is less than or equal to the preset data volume threshold, or when the business type of the business data is not a preset type, the first electronic device and the second electronic device transmit the business data via a Bluetooth connection. The first electronic device and the second electronic device can selectively establish a Wi-Fi point-to-point (P2P) connection to save power consumption of the electronic devices.

[0014] In a possible implementation of the first aspect, when the first electronic device switches from a screen-on state to a screen-off state, the first electronic device turns off the WLAN capability. Alternatively, when the first electronic device switches from a screen-off state to a screen-on state, the first electronic device turns on the WLAN capability.

[0015] In one possible implementation of the first aspect, the second electronic device receives the first request from the second electronic device via a Bluetooth connection between the second electronic device and the first electronic device. When the WLAN capability of the first electronic device is disabled, the first electronic device and the second electronic device still have a Bluetooth connection established, and the second electronic device can use Bluetooth to wake up the first electronic device.

[0016] In one possible implementation of the first aspect, the first electronic device may be any one of a tablet computer, a personal computer, and a wearable device. When the WLAN capability of the above-mentioned device is turned off, the present application may trigger the above-mentioned device to turn on the WLAN capability, establish a Wi-Fi point-to-point (P2P) connection, and perform device collaboration.

[0017] In a second aspect, an electronic device is provided. The electronic device includes a memory, a wireless communication module, a display, and one or more processors. The wireless communication module receives and transmits data under the control of the processor to enable communication between the electronic device and other electronic devices. The memory and the display are coupled to the processor. The memory is used to store computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device performs the method described in the first aspect.

[0018] In a third aspect, the present application provides a chip system that can be applied to an electronic device including a memory. The chip system includes one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected via a circuit. The interface circuit is configured to receive a signal from the memory and send the signal to the processor, the signal including a computer instruction stored in the memory. When the processor executes the computer instruction, the electronic device performs the method of the first aspect and any possible design thereof.

[0019] In a fourth aspect, the present application provides a computer-readable storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method according to the first aspect and any possible design thereof.

[0020] In a fifth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method according to the first aspect and any possible design thereof.

[0021] It can be understood that the beneficial effects that can be achieved by the electronic device of the second aspect to the computer program product of the fifth aspect can refer to the beneficial effects of the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A schematic diagram of a method for establishing wireless communication between electronic devices provided in an embodiment of the present application;

[0023] Figure 2 A schematic diagram of an interface for a PC to access files in a mobile phone provided in an embodiment of the present application;

[0024] Figure 3 A schematic diagram of an interface for sharing pictures from a mobile phone to a PC provided in an embodiment of the present application;

[0025] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0026] Figure 5 A schematic diagram of the software and hardware architecture of an electronic device provided in an embodiment of the present application;

[0027] Figure 6a A flowchart of a method for establishing a Wi-Fi point-to-point (P2P) connection provided in an embodiment of the present application;

[0028] Figure 6b A flowchart of another method for establishing a Wi-Fi point-to-point (P2P) connection provided in an embodiment of the present application;

[0029] Figure 7 A schematic diagram of the interface of a mobile device collaboration APP provided in an embodiment of the present application;

[0030] Figure 8 A schematic diagram of the interface of a tablet device collaboration APP provided in an embodiment of the present application;

[0031] Figure 9 A schematic diagram of the interaction between a mobile phone and internal modules of a tablet computer provided in an embodiment of the present application;

[0032] Figure 10 A schematic diagram of an interface for displaying access information of one or more wireless local area networks stored by an electronic device, provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] Full-scenario services leverage distributed technology across multiple devices to enable cross-system and cross-device collaboration, enabling resource sharing and collaborative operations. These services include screen expansion, screen projection, super calling, screen mirroring, super notifications, multi-screen collaboration, keyboard and mouse sharing, file sharing, and remote control.

[0034] Full-scenario services can be applied between electronic devices of the same or different types, and are implemented based on communication connections between electronic devices. That is, multiple electronic devices need to establish a connection before performing full-scenario services. The connection can be a wired connection or a wireless connection. For example, multiple electronic devices establish a wired connection through a universal serial bus (USB). For another example, after multiple electronic devices turn on Bluetooth, the distance between the electronic devices is within a preset distance, and the multiple electronic devices can establish a Bluetooth network, and multiple electronic devices establish a Bluetooth connection. Alternatively, after multiple electronic devices turn on a wireless local area network (WLAN), the distance between the multiple electronic devices is within a preset distance, and WLAN direct connection can be established between the multiple electronic devices. WLAN direct connection is also called Wi-Fi peer-to-peer (Wi-Fi P2P). Alternatively, after multiple electronic devices are connected to the same local area network, data can be synchronized through the local area network to achieve collaboration between devices. Alternatively, multiple electronic devices can establish a near field communication (NFC) connection, an infrared (IR) connection, etc.

[0035] Optionally, the multiple electronic devices may be within the same trust ring. Multiple electronic devices may establish a trust relationship through trusted authentication, forming a trust ring. There are various ways to form a trust ring with multiple electronic devices. For example, multiple electronic devices logged into the same account, and multiple electronic devices under the same account trust each other, form a trust ring. Another example is multiple electronic devices not logged into the same account, but performing trusted authentication through a protocol, establishing a trust relationship, and forming a trust ring.

[0036] Wi-Fi peer-to-peer P2P connection is also called WLAN direct connection. It enables devices to connect to each other without the need for a wireless access point (AP). Wi-Fi peer-to-peer P2P connection has the advantage of fast transmission speed and is more suitable for transmitting large amounts of data. Figure 1 As shown, Figure 1 Figure 1a shows a schematic diagram of Wi-Fi networking of multiple electronic devices in the same local area network. Figure 1 As shown in Figure 1a, the mobile phone and tablet computer have WLAN turned on. The mobile phone and tablet computer are connected to the AP respectively, and the mobile phone and tablet computer communicate through the AP. The AP can be connected to the Internet via a wired connection, and the mobile phone and tablet computer can also connect to the Internet through the AP, for example, to receive data from the Internet or upload data to the Internet. Optionally, the mobile phone and tablet computer can also be connected to two different APs respectively to achieve communication and Internet access services. Figure 1 As shown in Figure 1b, the mobile phone and tablet both have WLAN enabled. A Wi-Fi peer-to-peer (P2P) connection is established between the mobile phone and tablet, allowing them to communicate directly via P2P. At the same time, the mobile phone and / or tablet can also connect to an AP and access the Internet through the AP.

[0037] After establishing a Wi-Fi point-to-point P2P connection between electronic devices, electronic devices can transmit collaborative business data to each other and perform various collaborative businesses.

[0038] For example, after the PC establishes a Wi-Fi point-to-point P2P connection with at least one electronic device, on the PC side, the PC can mount at least one electronic device that has established a connection, and accessing multiple electronic devices on the PC is as convenient as accessing local files on the PC. Figure 2As shown, the PC can display system management interface 201. System management interface 201 displays the icons and names of folders, disks, and connected electronic devices on the PC, such as the xx mobile phone and xx PAD in interface 201. In response to the user clicking the xx mobile phone icon, the PC displays interface 202, which displays the folders on the mobile phone. As can be seen, after the PC and the mobile phone establish a Wi-Fi peer-to-peer (P2P) connection, the PC can access files on the mobile phone, and accessing files on the mobile phone is as easy as accessing a disk. In response to the user clicking the picture folder on the mobile phone in interface 202, the PC can display interface 203. Interface 203 includes thumbnails of the pictures in the mobile phone's picture folder. In response to user operations, the PC can open, save, or copy picture 1 on interface 203. Alternatively, the PC can drag picture 1 to the PC in response to a drag-and-drop operation. In this way, after the mobile phone and PC establish a Wi-Fi peer-to-peer (P2P) connection, the PC can access and operate files on the mobile phone.

[0039] On the mobile phone side, the mobile phone can send pictures, files, documents, recordings, videos and other files to the PC. For example, Figure 3 As shown, the mobile phone displays interface 301 of the gallery application. Interface 301 displays picture 1 in large picture preview mode. In response to the user clicking the share button, the mobile phone displays interface 302. Interface 302 includes a list of electronic devices that have established a Wi-Fi point-to-point P2P connection with the mobile phone. In response to the user clicking PC, the mobile phone sends picture 1 to the PC. Alternatively, interface 302 includes a list of other electronic devices discovered by the mobile phone through technologies such as Bluetooth, NFC, Wi-Fi, IR, etc., that is, a list of near-field electronic devices searched by the mobile phone. In response to the user clicking PC, the mobile phone is triggered to establish a Wi-Fi point-to-point P2P connection with the PC. After the mobile phone establishes a Wi-Fi point-to-point P2P connection with the PC, the mobile phone sends picture 1 to the PC.

[0040] In summary, when an electronic device establishes a Wi-Fi point-to-point P2P connection with another electronic device, both the electronic device and the other electronic device need to turn on WLAN. After the electronic device turns on WLAN, it will connect to the AP to implement Internet access services, such as Figure 1 However, in some scenarios, electronic device users may only want to collaborate with other electronic devices and do not need to connect their electronic devices to the Internet. For example, when a user is working, they use their mobile phone to share files with their PC and do not want the PC to connect to an AP to access the Internet.

[0041] To this end, an embodiment of the present application provides a method for establishing a Wi-Fi point-to-point P2P connection, which is applied to a first electronic device. The WLAN capability of the first electronic device is turned off, and the first electronic device receives a first request from the second electronic device, where the first request is used to establish a Wi-Fi point-to-point P2P connection with the first electronic device. In response to the first request, the first electronic device turns on the WLAN capability but does not access any wireless local area network. After the first electronic device turns on the WLAN capability, the first electronic device and the second electronic device can establish a Wi-Fi point-to-point P2P connection. In this way, even if the first electronic device turns on the WLAN capability, the first electronic device does not access any wireless local area network. That is, the first electronic device turns on the WLAN capability only to transmit data with the second electronic device, and will not access the wireless local area network to perform other communication services. In this way, while meeting the user's need to be offline, the power and power consumption of the first electronic device can be saved.

[0042] The method provided in the embodiment of the present application can be applied to electronic devices with data processing capabilities. The above-mentioned electronic devices may include servers, mobile phones, tablet computers, laptops, personal computers (PCs), ultra-mobile personal computers (UMPCs), handheld computers, netbooks, smart home devices (such as smart TVs, smart screens, large screens, smart speakers, smart air conditioners, etc.), personal digital assistants (PDAs), wearable devices (such as smart watches, smart bracelets, etc.), vehicle-mounted devices, virtual reality devices, etc., and the embodiments of the present application do not impose any restrictions on this. In the embodiments of the present application, the above-mentioned electronic devices are electronic devices that can run operating systems and install applications. Optionally, the operating system running on the electronic device may be system, system, System, etc.

[0043] Optionally, the first electronic device in the embodiment of the present application may specifically include: any one of a tablet computer, a personal computer and a wearable device.

[0044] For example, please refer to Figure 4 , which shows a schematic structural diagram of an electronic device 400. The electronic device 400 may include a processor 410, an external memory interface 420, an internal memory 421, an audio module 430, a speaker 430A, a microphone 430B, a display 440, a wireless communication module 450, a power module 460, an input device 470, a sensor module 480, etc. The sensor module 480 may include a pressure sensor, a touch sensor, etc.

[0045] It should be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 400. In other embodiments of the present application, the electronic device 400 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0046] The processor 410 may include one or more processing units. For example, the processor 410 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), and / or a neural-network processing unit (NPU). The different processing units may be independent components or integrated into one or more processors. In some embodiments, the electronic device 400 may also include one or more processors 410.

[0047] The controller is the nerve center and command center of the electronic device 400. It can generate operation control signals according to instruction operation codes and timing signals to complete the control of instruction fetching and execution.

[0048] The application processor can run the operating system of electronic device 400 and manage the hardware and software resources of electronic device 400. For example, it manages and configures memory, determines the priority of system resource supply and demand, controls input and output devices, operates the network, manages the file system, and manages drivers. The operating system can also provide an operation interface for users to interact with the system. Various software can be installed in the operating system, such as drivers and application programs (apps).

[0049] Processor 410 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 410 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 410. If processor 410 needs to use the same instruction or data again, it can directly retrieve it from the memory. This avoids duplicate accesses, reduces processor 410 latency, and thus improves system efficiency.

[0050] In some embodiments, the processor 410 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an 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 SIM card interface, and / or a USB interface.

[0051] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present application is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 400. In other embodiments of the present application, the electronic device 400 may also adopt a different interface connection method from the above embodiment, or a combination of multiple interface connection methods.

[0052] The external memory interface 420 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 400. The external memory card communicates with the processor 410 via the external memory interface 420 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0053] The internal memory 421 can be used to store one or more computer programs, which include instructions. The processor 410 can execute the above instructions stored in the internal memory 421, so that the electronic device 400 executes the application operation method provided in some embodiments of the present application, as well as various applications and data management. The internal memory 421 may include a code storage area and a data storage area. Among them, the data storage area can store data created during the use of the electronic device 400. In addition, the internal memory 421 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc. In some embodiments, the processor 410 can execute the application operation method provided in the embodiments of the present application, as well as other applications and data management by running the instructions stored in the internal memory 421, and / or the instructions stored in the memory provided in the processor 410.

[0054] The electronic device 400 can implement audio functions through the audio module 430, speaker 430A, microphone 430B, and application processor. For example, music playback, recording, etc. The audio module 430 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 430 can also be used to encode and decode audio signals. In some embodiments, the audio module 430 can be provided in the processor 410, or some functional modules of the audio module 430 can be provided in the processor 410.

[0055] The speaker 430A, also called a "horn", is used to convert audio electrical signals into sound signals.

[0056] The microphone 430B, also called a "microphone" or "speaker", is used to convert sound signals into electrical signals. A user can speak by putting their mouth close to the microphone 430B to input the sound signal into the microphone 430B.

[0057] The communication function of the electronic device 400 can be realized through the antenna 1, the antenna 2 and the wireless communication module 450.

[0058] The wireless communication module 450 can provide wireless communication solutions including cellular, Wi-Fi, Bluetooth (BT), wireless data transmission modules (for example, 433MHz, 868MHz, 915MHz) applied to the electronic device 400. The wireless communication module 450 can be one or more devices integrating at least one communication processing module. The wireless communication module 450 receives electromagnetic waves via antenna 1 or antenna 2, filters and frequency modulates the electromagnetic wave signals, and sends the processed signals to the processor 410. The wireless communication module 450 can also receive the signal to be sent from the processor 410, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through antenna 1 or antenna 2. In the embodiment of the present application, the wireless communication module 450 can establish one or more connections including Wi-Fi, Bluetooth, NFC, and Wi-Fi point-to-point P2P connections with the wireless communication modules of other electronic devices. The wireless communication module 450 can also send signals to electronic devices with which connections have been established.

[0059] Electronic device 400 implements display functionality through a GPU, display screen 440, and an application processor. The GPU is a microprocessor for image processing that connects display screen 440 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 410 may include one or more GPUs that execute program instructions to generate or modify display information.

[0060] The display screen 440 is used to display images, videos, etc. The display screen 440 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicrOLED, Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 400 may include 1 or N display screens 440, where N is a positive integer greater than 1. In an embodiment of the present application, the display screen 440 can be used to display a UI and receive user operations on the UI. For example, in an embodiment of the present application, the display screen 440 can display the interface of a device collaborative application. After the sensor in the display screen detects the user's operation on the application interface, it can trigger the wireless communication module 450 to establish a Wi-Fi point-to-point P2P connection with the first electronic device.

[0061] In some embodiments, the display screen 440 is provided with a pressure sensor, a touch sensor, and the like. The pressure sensor is used to sense pressure signals and can convert pressure signals into electrical signals. When a touch operation is applied to the display screen 440, the electronic device 400 detects the intensity of the touch operation based on the pressure sensor. The electronic device 400 can also calculate the position of the touch based on the detection signal of the pressure sensor. The touch sensor, also known as a "touch panel", can form a touch screen, also known as a "touch screen", with the display screen 440. The touch sensor is used to detect touch operations applied thereto or nearby. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can also be provided through the display screen 440.

[0062] The power module 460 can be used to supply power to various components included in the electronic device 400. In some embodiments, the power module 460 can be a battery, such as a rechargeable battery.

[0063] Input device 470 may include a keyboard, a mouse, and the like. The keyboard is used to input English letters, numbers, punctuation marks, and the like into electronic device 400, thereby issuing commands to electronic device 400 and inputting data. The mouse is an indicator for the vertical and horizontal coordinates of the display system of electronic device 400 and is used to input instructions to electronic device 400. Input device 470 may be connected to electronic device 400 via a wired connection, for example, via a GPIO interface, a USB interface, or the like. Input device 470 may also be connected to electronic device 400 wirelessly, for example, via Bluetooth, infrared, or the like.

[0064] Taking the electronic device 400 as an example, a mobile phone, the software system of the electronic device 400 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system with a layered architecture is used as an example to illustrate the software structure of the electronic device 400.

[0065] Figure 5 4 is a software structure block diagram of the electronic device 400 according to an embodiment of the present invention.

[0066] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers: application layer, application framework layer, Android runtime, system library, hardware abstraction layer, and kernel layer.

[0067] The application layer can include a series of application packages.

[0068] Application packages can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, desktop launcher and other applications. Figure 5 As shown, in the embodiment of the present application, the application layer may include various collaborative applications such as file sharing, interconnection, and multi-screen collaboration, a gallery, and a power management application. The power management application may be, for example, a power saving wizard. The power management application may display the current power and power consumption of the electronic device and prompt the user to shut down power-consuming processes.

[0069] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0070] like Figure 5As shown, the application framework layer may include various modules for communication, such as a Wi-Fi service module, a Bluetooth service module, a power consumption management module, and an input system.

[0071] The power management application can obtain the current power and power consumption information of the electronic device from the power management module. The power management module can also obtain the screen status of the display, including whether the screen is on or off. For example, when the screen status changes, the display reports the current status to the power management module. If the display is off for a period exceeding a preset value, the power management module instructs the Wi-Fi service to disable the Wi-Fi capability.

[0072] The Wi-Fi service module provides a set of interfaces for applications or other software modules to control Wi-Fi. For example, applications or other software modules use these interfaces to call the Wi-Fi service module to perform operations such as discovering devices, connecting to devices, establishing Wi-Fi peer-to-peer (P2P) connections, and establishing Wi-Fi connections.

[0073] The Bluetooth service module provides a set of interfaces for applications or other software modules to control Bluetooth, for example, to turn Bluetooth on and off, search for and pair with other devices, and establish Bluetooth connections.

[0074] The input system is used to monitor the input module (such as the touch screen driver) of the electronic device 400, and convert the parameters input by the input module into usable events, and pass them to the relevant modules in the upper layer. For example, the input system is used to monitor the touch screen of the electronic device 400 through the touch screen driver, and convert the touch parameters generated by the touch operation input on the touch screen into usable events, and pass them to the upper layer APP.

[0075] For example, in an embodiment of the present application, in response to a user's first operation in an interconnection app triggering an electronic device to establish a Wi-Fi peer-to-peer (P2P) connection with another electronic device, the input system sends a command to the interconnection app. In response to the command, the interconnection app calls an interface to trigger the Wi-Fi service module to negotiate with the PC via the wireless communication module to establish a Wi-Fi peer-to-peer (P2P) connection.

[0076] In an embodiment of the present application, after receiving a Wi-Fi peer-to-peer (P2P) connection request from another electronic device (e.g., a first electronic device), the wireless communication module triggers the power management application to call the interface of the Wi-Fi service module to enable WLAN capabilities. The Wi-Fi service module can also obtain access information for one or more Wi-Fi local area network (LAN) networks stored by the electronic device and prohibit the electronic device from connecting to any of the aforementioned wireless networks.

[0077] Android Runtime includes core libraries and a virtual machine. Android Runtime is responsible for scheduling and management of the Android system.

[0078] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0079] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0080] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0081] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0082] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0083] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0084] A 2D graphics engine is a drawing engine for 2D drawings.

[0085] The kernel layer is the layer between hardware and software. The kernel layer may include touch screen drivers, display drivers, audio drivers, sensor drivers, etc.

[0086] The following describes a method for establishing a Wi-Fi point-to-point (P2P) connection between a first electronic device and a mobile phone provided by an embodiment of the present application with reference to the accompanying drawings. Figure 6a A flowchart of a method for establishing a Wi-Fi point-to-point (P2P) connection is provided in an embodiment of the present application.

[0087] S601: A second electronic device discovers a first electronic device and establishes a first connection with the first electronic device.

[0088] The second electronic device discovers the first electronic device through technologies such as Bluetooth, NFC, Wi-Fi, and IR and establishes a first connection with the first electronic device. It should be understood that the device discovery process is mutual, and the first electronic device can also discover the second electronic device through technologies such as Bluetooth, NFC, Wi-Fi, and IR and establish a first connection with the second electronic device.

[0089] The first connection may be one or more of a Bluetooth connection, a USB connection, an NFC connection, an infrared IRC connection, and a Wi-Fi connection. The Wi-Fi connection may be understood as a communication connection established between the second electronic device and one or more first electronic devices via an AP, such as Figure 1 As shown in 1a.

[0090] S602: The second electronic device sends a first request to the first electronic device.

[0091] The first request is used to request to establish a Wi-Fi point-to-point (P2P) connection with the first electronic device. The first request may include a service type and / or a data volume of service data to be transmitted.

[0092] The service type may be any of the various collaborative services described above. Optionally, the first request may further include a device identifier of the first electronic device, which is used to identify the first electronic device. The device identifier may be, for example, the MAC address of the first electronic device. If the second electronic device establishes a first connection with multiple first electronic devices, the second electronic device may send a first request to the first electronic device identified by the device identifier based on the device identifier.

[0093] The second electronic device can send a first request to the first electronic device in response to the user's operation 1. Operation 1 can be the user clicking or touching a control on the display interface, and the sensor on the display screen of the second electronic device can receive the user's operation 1 on the display screen. Alternatively, operation 1 can be the user inputting a voice control instruction. For example, operation 1 can be the user speaking a voice control instruction near the microphone of the second electronic device, and the voice control instruction can be "Please establish multi-screen collaboration with the PC." Alternatively, operation 1 can be the user placing the second electronic device within a preset distance or at a preset position of the first electronic device. The following takes the second electronic device being a mobile phone as an example, and gives several examples in combination with the business types of device collaboration.

[0094] For example, in a multi-screen collaboration service, the PC has NFC and WLAN enabled, and the phone has NFC and WLAN enabled. Operation 1 could involve the user placing the phone within a preset distance of the PC, or touching the PC's touchpad with the back of the phone. Alternatively, the PC has Bluetooth and WLAN enabled, and the phone has Bluetooth and WLAN enabled. Operation 1 could involve the user tapping the multi-screen collaboration switch in the phone's drop-down list and selecting the PC from the list of available devices.

[0095] For example, in a mirroring service, the PC has Bluetooth and WLAN enabled, and the phone has Bluetooth and WLAN enabled. In response to the user clicking the mirroring switch, the phone triggers the mirroring function to be enabled. The phone searches for devices that can be mirrored and displays the searched devices in the list of available devices. Operation 1 can be the user selecting the PC from the list of available devices.

[0096] The mobile phone may also include an application, which may be a device collaboration APP, or an APP that supports device collaboration. The device collaboration APP includes a visual human-computer interaction interface, for example, it may be an XX Internet APP. APPs that support device collaboration may be, for example, gallery, video playback APP, etc. Such APPs include controls that trigger the mobile phone to establish device collaboration with the first electronic device. In some embodiments, the mobile phone includes one or more device collaboration functions, such as the multi-screen collaboration function and the mirror projection function mentioned above, which can also be regarded as a device collaboration APP.

[0097] like Figure 7 As shown, after turning on Bluetooth and WLAN, the mobile phone control center displays the application card of the device collaboration APP. In response to the user clicking on the application card, the mobile phone displays interface 701. Interface 701 includes the mobile phone icon 702 and the icons of the near-field devices searched by the mobile phone, such as the tablet icon 703 and the PC icon 704. The icons of the near-field devices can be distributed around the mobile phone icon. Figure 7 As shown, the tablet computer icon 703 and the PC icon 704 are located below the mobile phone icon 702 and are distributed on an arc line. Wherein, the tablet computer and the PC have both turned on Bluetooth and WLAN.

[0098] In response to the user's operation 1 on the PC icon 704 in interface 701, the mobile phone sends a first request to the PC. Operation 1 can be that the user drags the PC icon 704 in the direction close to the mobile phone icon 702 and makes the PC icon 704 contact with the mobile phone icon 702. The mobile phone saves a one-to-one mapping relationship between multiple preset collaborative business types and multiple types of electronic devices. In response to the user's operation 1, the mobile phone determines to establish a multi-screen collaborative connection with the PC based on the PC type. The first request can carry indication information that the business type is multi-screen collaboration. Afterwards, the mobile phone can display interface 705. In interface 705, the PC icon 704 is connected to the mobile phone icon 704, indicating that the mobile phone and the PC have established a Wi-Fi point-to-point P2P connection.

[0099] Optionally, in response to the user's drag operation, the mobile phone may first display interface 706, which includes a collaborative service selection list. This selection list displays one or more types of collaborative services that can be performed between the mobile phone and the PC. Operation 1 may be the user clicking on a target service, where the target service is one of the types of collaborative services. In response to operation 1, the mobile phone sends the first request to the PC, which carries information indicating that the service type is the target service.

[0100] For example, in Figure 2 In the example, operation 1 may be a user clicking on the mobile phone icon on the interface 201. Figure 3 In the example, operation 1 may be that the user clicks on a tablet computer in the list of available devices in the interface 302 .

[0101] It should be understood that the manner of triggering an electronic device, such as the second electronic device, to establish a device cooperative connection with the first electronic device includes but is not limited to the various manners described above.

[0102] That is, the second electronic device and the first electronic device can discover each other through Bluetooth, NFC, Wi-Fi, IR, Wi-Fi P2P and other scanning, and after discovery, the second electronic device and the first electronic device are connected to each other via Wi-Fi point-to-point P2P. In some embodiments, electronic devices typically use low-power Bluetooth and Wi-Fi point-to-point P2P at the same time to discover other devices. Low-power Bluetooth is a wireless personal area network technology that has lower power consumption and cost compared to Bluetooth. Low-power Bluetooth can assist electronic devices in discovering other nearby electronic devices and assist in data transmission between electronic devices. In this way, power consumption can be reduced while improving data transmission efficiency and stability.

[0103] The second electronic device may also automatically send the first request to the first electronic device. For example, the second electronic device establishes a device-to-device collaborative connection with the first electronic device for call sharing or notification sharing. After the second electronic device disconnects from the first electronic device's Wi-Fi peer-to-peer (P2P) connection, the second electronic device may automatically trigger the sending of the first request to the first electronic device in response to the second electronic device receiving an incoming call or notification message.

[0104] The second electronic device may also send the first request to the first electronic device in response to an instruction from a third electronic device. The third electronic device is different from the first electronic device. For example, Figure 8 As shown, the tablet displays interface 801 for a multi-device collaboration application. In response to a user dragging icon 803 toward icon 802 until icons 803 and 802 touch, the tablet receives a connection request to establish device collaboration with the mobile phone. This connection request carries information indicating that the tablet and mobile phone should establish a keyboard and mouse sharing service. In response to a user dragging icon 804 toward icon 802 until icons 804 and 802 touch, the tablet receives a connection request to establish device collaboration with the PC. This connection request carries information indicating that the tablet and mobile phone should establish a keyboard and mouse sharing service. The tablet can display interface 805. Simultaneously, the tablet can instruct the mobile phone to establish device collaboration with the PC. The mobile phone can receive the instruction information sent by the tablet to establish device collaboration with the PC, and / or the PC can receive the instruction information sent by the tablet to establish a device collaboration connection with the mobile phone. In response to this instruction information, the mobile phone can send a first request to the PC, or the PC can send a first request to the mobile phone. In this way, the tablet, mobile phone, and PC establish a Wi-Fi peer-to-peer (P2P) connection, enabling keyboard and mouse sharing between devices.

[0105] Optionally, the second electronic device may send a first request to the first electronic device through an established first connection such as a Bluetooth connection, where the first request is used to request to establish a Wi-Fi point-to-point (P2P) connection with the first electronic device.

[0106] Alternatively, the second electronic device may also send the first request to the first electronic device by broadcasting. For example, the second electronic device may send the first request to the first electronic device by one or more of BLE broadcasting, BR broadcasting, and WI-FI broadcasting.

[0107] The first request may also include information for establishing a Wi-Fi point-to-point P2P connection, such as a list of channels supported by the second electronic device, a service set identifier (SSID) of the P2P group, a password (PWD), whether broadband is supported (for example, whether 160 MHz is supported), device information of the second electronic device, etc.

[0108] Optionally, when sending the first request to the first electronic device, the second electronic device may further identify whether it is necessary to send the first request to the first electronic device. Specifically, S602 may include S602a-S602c.

[0109] S602a: The second electronic device identifies whether to establish a Wi-Fi point-to-point (P2P) connection with the first electronic device.

[0110] If the second electronic device recognizes that a Wi-Fi point-to-point (P2P) connection is to be established with the first electronic device, the second electronic device sends a first request to the first electronic device, i.e., the second electronic device executes S602b. If the second electronic device recognizes that a Wi-Fi point-to-point (P2P) connection is not to be established with the first electronic device, the second electronic device may not send the first request, and the second electronic device may transmit data with the first electronic device via the first connection, i.e., the second electronic device executes S602c.

[0111] As an example, the second electronic device can identify whether to establish a Wi-Fi point-to-point (P2P) connection with the first electronic device based on the amount of business data to be transmitted. For example, for a file sharing service, if the amount of business data to be transmitted is greater than or equal to a preset value, the second electronic device identifies that a Wi-Fi point-to-point (P2P) connection is to be established with the first electronic device, and the second electronic device transmits data via the Wi-Fi P2P link. If the amount of business data to be transmitted is less than the preset value, the second electronic device identifies that a Wi-Fi point-to-point (P2P) connection is not to be established with the first electronic device, and the second electronic device can transmit data via a first connection, such as a Bluetooth connection.

[0112] As another example, the second electronic device may determine whether to establish a Wi-Fi point-to-point P2P connection with the first electronic device based on the business type of the device collaboration to be performed. Exemplarily, for a type of collaborative business with a smaller amount of business data, the second electronic device may transmit data to the first electronic device through a first connection such as a Bluetooth connection. This type of collaborative business may be, for example, notification sharing. For another example, the second electronic device has a built-in collaborative business type for establishing a Wi-Fi point-to-point P2P connection with the first electronic device. If the business type of the device collaboration to be performed is not one of them, the second electronic device does not establish a Wi-Fi point-to-point P2P connection with the first electronic device. If the business type of the device collaboration to be performed is one of them, the second electronic device establishes a Wi-Fi point-to-point P2P connection with the first electronic device.

[0113] That is, the second electronic device can selectively send a first request to the first electronic device, requesting to establish a Wi-Fi point-to-point (P2P) connection with the first electronic device. In this way, power consumption of the second electronic device and the first electronic device can be saved.

[0114] S602b: If the second electronic device recognizes that a Wi-Fi point-to-point (P2P) connection needs to be established with the first electronic device, the second electronic device sends a first request to the first electronic device.

[0115] The second electronic device may send the first request to the first electronic device via a first connection such as a Bluetooth connection, and / or the second electronic device may send the first request to the first electronic device via broadcasting.

[0116] S602c: If the second electronic device recognizes that a Wi-Fi point-to-point (P2P) connection is not established with the first electronic device, the second electronic device sends the first service data to the first electronic device through the first connection.

[0117] If the second electronic device determines that a Wi-Fi peer-to-peer (P2P) connection is not established with the first electronic device, the second electronic device may transmit a Bluetooth signal to the first electronic device via a first connection, such as a Bluetooth connection, where the Bluetooth signal includes first service data. The first service data may be, for example, a notification message for an application in a sharing service, or a smaller file in a file sharing service.

[0118] After receiving the first service data, the first electronic device can save the first service data and display the first service data. For example, the first electronic device can save the sent picture or video and can also display the picture or video.

[0119] After receiving the first request sent by the second electronic device via the first connection and / or broadcast, the first electronic device may enable WLAN and, after enabling WLAN, establish a Wi-Fi point-to-point (P2P) connection with the second electronic device. The method for establishing a Wi-Fi point-to-point (P2P) connection between the first electronic device and the second electronic device may refer to existing technologies and will not be described in detail herein.

[0120] S603: In response to receiving the first request, the WLAN capability of the first electronic device has been turned off, the first electronic device turns on the WLAN capability, and does not access any wireless local area network after turning on the WLAN capability.

[0121] The WLAN capability status of the first electronic device includes enabled and disabled. It should be understood that the WLAN capability disabled of the first electronic device indicates that the first electronic device does not have the capability of wireless network communication. The WLAN capability enabled of the first electronic device indicates that the first electronic device has the capability of wireless network communication.

[0122] For example, the Wi-Fi service in the first electronic device can check the on / off status of the WLAN capability and return the current on / off status of the WLAN capability to the first electronic device. The first electronic device can also trigger the Wi-Fi service to turn on or off the WLAN capability. The first electronic device can call a function to turn on / off the WLAN capability.

[0123] Optionally, in response to receiving the first request, the WLAN capability status of the first electronic device is enabled, and the first electronic device establishes a Wi-Fi point-to-point (P2P) connection with the second electronic device.

[0124] Typically, after the first electronic device turns on the WLAN capability, the first electronic device will reconnect to the Wi-Fi network that the first electronic device has connected to and that has stored the access information. Exemplarily, after the first electronic device connects to the Wi-Fi network for the first time, the first electronic device will save the access information of the Wi-Fi network in the first electronic device. The access information may include, for example, the service set identifier (SSID) and password of the Wi-Fi network. Among them, the SSID can be issued by a wireless network access point, and the SSID is also the network name of a wireless local area network. In this way, the first electronic device can save the access information of multiple Wi-Fi networks that the first electronic device has used in the past. After the first electronic device turns on the WLAN capability, the first electronic device can obtain the SSID issued by the wireless network access point in the current environment. If the SSID is saved in multiple historical access information, the first electronic device automatically connects to the Wi-Fi network corresponding to the SSID. Figure 1 As shown in 1b, the AP in the tablet's environment can send the network name of the current wireless LAN, XXaa. After the tablet has WLAN enabled and has saved the current wireless LAN access information, it will automatically connect back to the AP and access the Internet.

[0125] After the first electronic device reconnects to the Wi-Fi network that the first electronic device has been connected to and has saved access information, the first electronic device can access the Internet through the wireless access point. At this time, the first electronic device will receive a large number of notification messages that have accumulated during the period when the Wi-Fi was turned off. For example, when the first electronic device is connected to the Internet, the server in the cloud will send notification messages of instant messaging software and various APPs in the first electronic device to the first electronic device. If the first electronic device is not connected to the network, the cloud server can first save multiple notification messages in a message queue, and after detecting that the first electronic device is connected to the network, the cloud server will send multiple of the above notification messages to the first electronic device. In response to receiving multiple notification messages, the first electronic device will pop up a notification message, light up the screen, ring or vibrate. For example, multiple notification messages can be displayed in a drop-down menu of the first electronic device. Each time a notification message is received, the first electronic device can display the notification message in a drop-down menu and light up the screen, ring or vibrate.

[0126] Since the user is not using the first electronic device, that is, the user is not operating the first electronic device, or the user only wants to use the second electronic device to perform collaborative business with the first electronic device, and does not need to connect to the Internet. After the first electronic device automatically reconnects to the Wi-Fi network, it may disturb the user's work or rest, resulting in a poor user experience. At the same time, the first electronic device receives notification messages, displays notification messages, lights up the screen, rings, or vibrates, which increases the power consumption of the first electronic device and affects the standby time of the first electronic device.

[0127] In the embodiment of the present application, the first electronic device has WLAN capability enabled, but is not connected to any wireless local area network, thereby avoiding receiving notification messages, avoiding impact on the user, and reducing power consumption of the first electronic device.

[0128] S604: The second electronic device establishes a Wi-Fi point-to-point (P2P) connection with the first electronic device.

[0129] After the first electronic device establishes a Wi-Fi peer-to-peer (P2P) connection with the second electronic device, the second electronic device and the first electronic device can transmit second service data via the Wi-Fi P2P link. The second service data can be service data of a preset type. Alternatively, the second service data can be service data of a large data volume.

[0130] In this way, when the first electronic device turns off its WLAN capability, the second electronic device can trigger the first electronic device to turn on its WLAN capability but not connect to the wireless local area network. After turning on the WLAN capability, the first electronic device can establish a Wi-Fi point-to-point (P2P) connection with the second electronic device for device collaboration. Since the first electronic device is not connected to the wireless local area network, the user's need to be offline can be met. At the same time, since the first electronic device is offline, it will not receive various notification messages, nor will it trigger the first electronic device to ring or vibrate, saving power consumption and electricity of the first electronic device.

[0131] For example, Figure 6b As shown, S603 includes S701-S702.

[0132] S701: The WLAN capability of the first electronic device is turned off. The first electronic device turns on the WLAN capability, and after turning on the WLAN capability, obtains access information of one or more wireless local area networks stored in the first electronic device.

[0133] The access information is used to support the first electronic device to access the corresponding wireless local area network.

[0134] As previously described, the first electronic device may store access information for multiple Wi-Fi networks that the first electronic device has historically used. The first electronic device may obtain access information for multiple Wi-Fi networks that the first electronic device has historically used. For example, the first electronic device may first call a Wi-Fi service module to obtain access information for multiple stored Wi-Fi networks.

[0135] S702: The first electronic device is prohibited from accessing any one of the one or more Wi-Fi networks.

[0136] In this way, the first electronic device can prohibit the first electronic device from connecting back to the Wi-Fi network after the WLAN capability is turned on, thereby prohibiting the second electronic device from accessing the wireless local area network.

[0137] Furthermore, the first electronic device can also identify one or more Wi-Fi networks that the first electronic device is currently in. If the one or more Wi-Fi networks that the first electronic device is currently in are one or more Wi-Fi networks that have saved access information, the first electronic device can prohibit the first electronic device from connecting to the one or more Wi-Fi networks that the first electronic device is currently in. If the one or more Wi-Fi networks that the first electronic device is currently in are not among the one or more Wi-Fi networks that have saved access information, the first electronic device may also not prohibit the first electronic device from connecting to the Wi-Fi network that has saved access information. For example, the first electronic device is in a Wi-Fi network that has never been connected to, and the first electronic device does not save the SSID and password of the Wi-Fi network. At this time, even if the WLAN capability of the first electronic device is turned on, the second electronic device cannot connect to the Wi-Fi network. Therefore, there is no need to prohibit the first electronic device from connecting to the Wi-Fi network that has saved access information. In this way, the first electronic device does not need to execute additional instructions, which can save power consumption of the first electronic device.

[0138] Furthermore, the Wi-Fi network currently in which the first electronic device is located may be an open Wi-Fi network. Since open networks do not require passwords, after the first electronic device enables the WLAN capability, the first electronic device can access the open Wi-Fi network. To this end, after the first electronic device enables the WLAN capability, the first electronic device can also identify the type of the Wi-Fi network currently in which the first electronic device is located. If the type of the current Wi-Fi network is an open Wi-Fi network, the first electronic device can also prohibit the first electronic device from accessing the open Wi-Fi network.

[0139] When the first electronic device is in the screen-on state, the user may turn on the WLAN capability of the first electronic device to access the wireless local area network and conduct Internet services. When the first electronic device switches from the screen-on state to the screen-off state, the first electronic device may turn off the WLAN capability. In some embodiments, when the screen-off time of the first electronic device is longer than a preset time, in order to save power consumption of the electronic device, the first electronic device enters a low-power mode. In the low-power mode, the first electronic device turns off the WLAN capability. Furthermore, when the first electronic device switches from the screen-off state to the screen-on state, the first electronic device may turn on the WLAN capability.

[0140] The first electronic device may receive the first request when the screen is in the on-screen state or the off-screen state. The following describes different situations. The first electronic device has its screen on and its WLAN capability is off. The first electronic device receives the first request, turns on its WLAN capability, and does not connect to any wireless local area network. The first electronic device is in the off-screen state, such as in low-power mode. The first electronic device receives the first request, turns on its WLAN capability, and does not connect to any wireless local area network. In this way, it is possible to avoid receiving Internet messages, avoid receiving Internet messages that trigger the device to light up, and the first electronic device can collaborate with the second electronic device in the off-screen state. It can avoid disturbing the user, take into account the user experience, and save the power consumption of the first electronic device.

[0141] Optionally, for collaborative services that require the screen to be on, such as multi-screen collaboration, camera sharing, etc., the first electronic device can switch from screen off to screen on, and the first electronic device turns on WLAN capability but does not connect to any wireless local area network.

[0142] Furthermore, the first electronic device receives a first operation from the user in the screen-off state, and the first operation is used to trigger the first electronic device to light up the screen, indicating that the user is operating the first electronic device at this time, and the first electronic device can lift the restriction of prohibiting connection to the wireless local area network. Figure 6a shown.

[0143] S605: The first electronic device receives a first operation from the user in a screen-off state.

[0144] The first operation is used to trigger the first electronic device to light up its screen. For example, if the first electronic device is a tablet, the first operation may be a user pressing the tablet's power switch, clicking the touch screen, or unlocking the tablet. For example, if the first electronic device is a PC, the first operation may be a user moving the mouse, pressing a key on the keyboard, or clicking the touch screen.

[0145] In response to the first operation, the first electronic device may attempt to access any wireless local area network. Exemplarily, the first electronic device may execute S606.

[0146] S606: The first electronic device obtains access information of one or more wireless local area networks stored by the first electronic device.

[0147] S607: The first electronic device is allowed to access any one of the one or more Wi-Fi networks.

[0148] After the first electronic device lifts the restriction prohibiting the first electronic device from connecting to the wireless local area network, the first electronic device identifies that the one or more Wi-Fi networks it is currently in are one or more Wi-Fi networks for which access information is stored, and the first electronic device may connect to one of the Wi-Fi networks. The first electronic device identifies that the one or more Wi-Fi networks it is currently in are not one or more Wi-Fi networks for which access information is stored, and the first electronic device may not connect to the Wi-Fi network. The first electronic device identifies that the Wi-Fi network it is currently in is an open Wi-Fi network, and the first electronic device may connect to the open Wi-Fi network.

[0149] Optionally, after the first electronic device completes device collaboration with the second electronic device, the first electronic device may turn off the WLAN capability. For example, in response to the user's second operation, the second electronic device sends an instruction message to the PC to close the Wi-Fi point-to-point P2P connection. In response to the instruction message, the PC turns off the WLAN capability. The second operation is used to trigger the second electronic device to end the device collaboration service. The second operation may, for example, be that the user drags the PC icon 704 away from the icon 702 of the second electronic device on interface 705 so that the PC icon 704 is no longer in contact with the icon 702 of the second electronic device. Alternatively, the second operation may be that the user long presses the PC icon 704 and clicks the interface 705 to pop up a disconnect button. For another example, the first electronic device may also turn off the WLAN capability when no business data is transmitted with the second electronic device within a preset period of time.

[0150] The following describes the method of the embodiment of the present application by assuming that the first electronic device is a tablet computer and the second electronic device is a mobile phone, through the interaction of various software and hardware modules in the mobile phone and the tablet computer.

[0151] like Figure 9 As shown, the tablet computer includes a power consumption management module, a Wi-Fi service module, a communication module 1, and a device collaboration APP 1. The second electronic device may include a communication module 2 and a device collaboration APP 2.

[0152] Device collaboration APP1 and device collaboration APP2 can be XX Internet APP, gallery, video playback APP, device collaboration functions such as multi-screen collaboration function, mirror projection function, etc.

[0153] Device collaboration APP2 includes a control or interface that triggers the mobile phone and tablet computer to establish or terminate device collaboration in response to user operations on the control or interface. Similarly, device collaboration APP1 includes a control or interface that triggers the tablet computer and mobile phone to establish or terminate device collaboration in response to user operations on the control or interface.

[0154] The power management module is used to detect the duration of the tablet's screen being off. If the tablet's screen is off for longer than a preset duration, the module controls the tablet to enter a low-power mode. Specifically, if the module detects that the tablet's screen has been off for longer than a preset duration, it sends a notification message to the Wi-Fi service module, instructing the Wi-Fi service module to disable WLAN capabilities. For example, the power management module can be a power-saving wizard.

[0155] The tablet computer communication module 1 is used to establish one or more of a Bluetooth connection, a USB connection, an NFC connection, an infrared (IRC) connection, and a Wi-Fi connection with the mobile phone communication module 2. The tablet computer communication module 1 can also negotiate with the mobile phone communication module 2 to establish a Wi-Fi point-to-point (P2P) connection.

[0156] S901: The mobile phone turns on Bluetooth and WLAN capabilities, and the tablet turns on Bluetooth and WLAN capabilities, and the communication module 2 in the mobile phone and the communication module 1 in the tablet self-discover each other.

[0157] The communication module 2 in the mobile phone and the communication module 1 in the tablet computer can discover each other by exchanging broadcast messages. For example, the mobile phone and the tablet computer can simultaneously use Bluetooth low energy and / or Wi-Fi P2P scanning to discover each other.

[0158] S902, the communication module 2 in the mobile phone returns the information of the searched tablet computer to the device collaboration APP 2 in the mobile phone, and the communication module 1 in the tablet computer returns the information of the searched mobile phone to the device collaboration APP 1 of the tablet computer.

[0159] The application in the mobile phone saves the electronic devices that have been searched in the available device list. The available device list includes electronic devices that are in the same trust circle as the mobile phone and that have been searched by the mobile phone. Taking the device collaboration APP 1 as an example of file sharing, the application can display the following: Figure 3 The interface 302 shown includes a list of available devices, which includes nearby available electronic devices scanned by the mobile phone.

[0160] S903: After detecting that the tablet computer screen is turned off, the power consumption management module in the tablet computer detects the screen off duration.

[0161] S904: When the screen is off for more than 30 minutes, a notification message 1 is sent to the Wi-Fi service module.

[0162] S905 : In response to the notification message 1 , the Wi-Fi service module disables the WLAN capability.

[0163] S906: In response to the user initiating a connection request for establishing device collaboration with the tablet computer through the device collaboration APP 2, the application 2 identifies whether a Wi-Fi point-to-point (P2P) connection needs to be established with the tablet computer.

[0164] For example, in response to the user Figure 3 In the interface 301 shown, when the Share button is clicked, the Device Collaboration App 2 instructs the Communication Module 2 to scan for nearby available devices and update the list of available devices. In response to the user clicking the tablet in the list of available devices in interface 302, the Device Collaboration App 2 in the phone determines whether a Wi-Fi peer-to-peer (P2P) connection with the tablet is required.

[0165] S907 , if the device collaboration APP 2 recognizes that it is not necessary to establish an application Wi-Fi point-to-point P2P connection with the tablet computer, the device collaboration APP 2 sends a Bluetooth connection request to the communication module 2 to establish a Bluetooth channel.

[0166] For example, the data volume of the collaborative service is small, and the device collaborative APP 2 sends a Bluetooth connection request to the communication module 2 to establish a Bluetooth channel.

[0167] S908 : In response to the Bluetooth connection request, the communication module 2 negotiates with the communication module 1 to establish a Bluetooth connection.

[0168] After establishing a Bluetooth connection, device collaboration APP 2 and device collaboration APP 1 can transfer data to each other via Bluetooth.

[0169] S909, if the device collaboration APP 2 recognizes that a Wi-Fi point-to-point P2P connection needs to be established with the tablet computer, the device collaboration APP 2 sends a connection request to the communication module 2 to establish a Wi-Fi P2P channel with the tablet computer.

[0170] S910: In response to the connection request, the communication module of the mobile phone sends a first request to the communication module 1 in the tablet computer via a Bluetooth connection.

[0171] S911: In response to the first request, the communication module 1 in the tablet computer sends an instruction message 1 to the low power consumption module. The instruction message 1 instructs the low power consumption module to enable WLAN capability.

[0172] S912: In response to the instruction message, the low power consumption module sends a notification message 2 to the Wi-Fi service module.

[0173] S913: In response to the notification message 2, the Wi-Fi service module enables the WLAN capability.

[0174] S914: The Wi-Fi service module obtains access information of one or more Wi-Fi networks saved by the tablet computer.

[0175] S915: The Wi-Fi service module prohibits the tablet computer from connecting to any one of the one or more Wi-Fi networks.

[0176] S916 , the Wi-Fi service module triggers the communication module 1 of the tablet computer to negotiate with the communication module 2 of the mobile phone to establish a P2P connection.

[0177] S917: In response to the user's operation in device collaboration app 2 triggering the termination of device collaboration between the mobile phone and the tablet, app 2 sends a request to communication module 2 to disconnect the Wi-Fi P2P connection from the tablet. Alternatively, after device collaboration app 2 recognizes that the data to be transmitted has been completed, communication module 2 sends a request to disconnect the Wi-Fi P2P connection from the tablet. Alternatively, after device collaboration app 2 recognizes that no service data has been transmitted with the tablet within a preset time period, communication module 2 sends a request to disconnect the Wi-Fi P2P connection from the tablet.

[0178] S918 , in response to the request, the communication module 2 of the mobile phone and the communication module 1 of the tablet computer close the WI-FI point-to-point P2P connection.

[0179] S919: After closing the WI-FI point-to-point P2P connection, the tablet computer communication module 2 may send an instruction message 2 to the low power consumption module. The instruction message 2 instructs the low power consumption module to close the WLAN capability.

[0180] S920: In response to the instruction message, the low power consumption module sends a notification message 3 to the Wi-Fi service module.

[0181] S921: In response to the notification message 3, the Wi-Fi service module disables the WLAN capability.

[0182] The first electronic device can display the access information of one or more wireless local area networks stored. The user can view the access information of one or more wireless local area networks stored by the first electronic device. Figure 10 As shown, the first electronic device may display a settings application interface 1001, which includes WLAN settings options. WLAN settings options may include, for example, WLAN security detection, saved networks, and certificate installation. In response to a user clicking on a saved network in interface 1001, interface 1002 displays the network names of one or more stored wireless local area networks on the first electronic device.

[0183] The embodiment of the present application provides an electronic device, which includes: a memory and one or more processors. The memory is used to store computer program code. The computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can perform the various functions or steps performed by the first electronic device in the above method embodiment. The structure of the electronic device can refer to Figure 4 The structure of the electronic device 400 is shown.

[0184] The embodiment of the present application further provides a computer storage medium, which includes computer instructions. When the computer instructions are in the above electronic device (such as Figure 4 When running on the electronic device 400 shown in the figure, the electronic device performs each function or step in the above method embodiment.

[0185] The embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps in the above method embodiment.

[0186] An embodiment of the present application further provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected via lines. For example, the interface circuit can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit can be used to send signals to other devices (such as a processor). Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instruction is executed by the processor, the electronic device can perform the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.

[0187] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0188] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0189] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0190] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0191] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0192] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for establishing a Wi-Fi point-to-point (P2P) connection, characterized in that: Applied to a first electronic device, the method includes: The WLAN capability of the first electronic device is turned off; The first electronic device receives, in a screen-off state, a first request from a second electronic device, where the first request is used to request establishment of a Wi-Fi point-to-point (P2P) connection with the first electronic device; In response to the first request, the first electronic device turns on the WLAN capability in a screen-off state. After turning on the WLAN capability, the first electronic device does not access the Internet, and the first electronic device establishes a Wi-Fi point-to-point P2P connection with the second electronic device.

2. The method according to claim 1, characterized in that The first electronic device does not access the Internet after enabling the WLAN capability, including: After the first electronic device enables the WLAN capability, it does not access any wireless local area network.

3. The method according to claim 2, characterized in that The first electronic device does not access any wireless local area network after enabling the WLAN capability, including: After the first electronic device enables the WLAN capability, obtaining access information of one or more wireless local area networks stored by the first electronic device, where the access information is used to support the first electronic device to access the corresponding wireless local area network; The first electronic device is prohibited from accessing any wireless local area network of the one or more wireless local area networks.

4. The method according to claim 2 or 3, characterized in that The first electronic device does not access any wireless local area network after enabling the WLAN capability, including: After the first electronic device turns on the WLAN capability, the first electronic device does not access any wireless local area network because the first electronic device is in a screen-off state.

5. The method according to claim 4, characterized in that After the first electronic device enables the WLAN capability, based on the first electronic device being in a screen-off state and not connected to any wireless local area network, the method further includes: In response to the user's first operation, the first electronic device switches from the screen-off state to the screen-on state, and the first electronic device attempts to access one or more wireless local area networks stored by the first electronic device.

6. The method according to any one of claims 1 to 5, characterized in that After the first electronic device establishes a Wi-Fi point-to-point (P2P) connection with the second electronic device, the method further includes: The first electronic device and the second electronic device transmit service data via the Wi-Fi point-to-point (P2P) connection; If the first electronic device does not transmit service data with the second electronic device for a preset period of time, the first electronic device turns off the WLAN capability.

7. The method according to claim 6, characterized in that The data volume of the business data is greater than a preset data volume threshold; or the business type of the business data is a preset type.

8. The method according to any one of claims 1 to 7, characterized in that The WLAN capability of the first electronic device is turned off, including: In response to the first electronic device switching from a screen-on state to a screen-off state, the first electronic device turning off the WLAN capability; The method further comprises: In response to the first electronic device switching from the screen-off state to the screen-on state, the first electronic device enables the WLAN capability.

9. The method according to any one of claims 1 to 8, characterized in that The first electronic device receiving a first request from a second electronic device includes: The second electronic device receives the first request from the second electronic device through a Bluetooth connection between the second electronic device and the first electronic device.

10. The method according to any one of claims 1 to 9, characterized in that The first electronic device includes any one of a tablet computer, a personal computer, and a wearable device.

11. An electronic device comprising: The electronic device includes: a memory, a wireless communication module, a display screen, and one or more processors; the wireless communication module receives and sends data according to the control of the processor to realize communication between the electronic device and other electronic devices; the memory and the display screen are coupled to the processor; wherein the memory is used to store computer program code, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1 to 10.

12. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Method for disconnecting WIFI network and related equipment

    CN110475333A

  • WiFi module control method and device, electronic device and storage medium

    CN110602772A

  • Data transmission method based on Wi-Fi P2P and electronic equipment

    CN115022849A

  • Connection establishment method and device

    CN116801424A