CN115022849A - Data transmission method based on Wi-Fi P2P and electronic equipment - Google Patents

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

Info

Publication number
CN115022849A
CN115022849A CN202111276093.7A CN202111276093A CN115022849A CN 115022849 A CN115022849 A CN 115022849A CN 202111276093 A CN202111276093 A CN 202111276093A CN 115022849 A CN115022849 A CN 115022849A
Authority
CN
China
Prior art keywords
electronic device
data
electronic
channel
electronic equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111276093.7A
Other languages
Chinese (zh)
Other versions
CN115022849B (en
Inventor
曹诩承
张正科
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202310369125.0A priority Critical patent/CN116367123A/en
Priority to CN202111276093.7A priority patent/CN115022849B/en
Publication of CN115022849A publication Critical patent/CN115022849A/en
Application granted granted Critical
Publication of CN115022849B publication Critical patent/CN115022849B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/70Services for machine-to-machine communication [M2M] or machine type communication [MTC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/436Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
    • H04N21/4363Adapting the video stream to a specific local network, e.g. a Bluetooth® network
    • H04N21/43637Adapting the video stream to a specific local network, e.g. a Bluetooth® network involving a wireless protocol, e.g. Bluetooth, RF or wireless LAN [IEEE 802.11]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/06Authentication
    • H04W12/068Authentication using credential vaults, e.g. password manager applications or one time password [OTP] applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/06Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application provides a data transmission method based on Wi-Fi P2P and electronic equipment, and relates to the technical field of communication. According to the scheme, in a scene that Wi-Fi direct connection is needed between two electronic devices applying a Windows system to transmit data, the networked electronic devices can create a virtual AP as a wireless hotspot, and the other electronic device can be connected to the wireless hotspot as an STA role, so that a Wi-Fi P2P direct connection channel is established between the sending end device and the receiving end device. Through the Wi-Fi P2P direct connection channel, shared data can be transmitted, internet surfing data can also be transmitted, and therefore the devices at two ends can still have internet surfing capability while transmitting data. Therefore, the problem that after a Wi-Fi P2P direct channel is established between two pieces of Windows system equipment, the equipment cannot be connected with a hotspot to surf the internet is solved.

Description

Data transmission method based on Wi-Fi P2P and electronic equipment
Technical Field
The present application relates to the field of communications technologies, and in particular, to a data transmission method and an electronic device based on Wi-Fi P2P.
Background
With the popularization of smart devices and the rapid development of the Internet of things (IoT), more and more devices support the Wi-Fi P2P technology. Two or more devices can be connected with each other through Wi-Fi P2P technology to form a small-range point-to-point network architecture, so that communication between the devices is realized.
In some scenarios, a plurality of devices need to be directly connected to Wi-Fi P2P, and one or more of the devices also need to communicate with a Wi-Fi Access Point (AP) to implement a Wi-Fi internet access service. As IoT is developed, the application of such a scenario will be more and more, so it is very important that the electronic device has the capability of connecting AP and other electronic devices at the same time.
However, in the prior art, when the electronic device is in communication with the AP, if the electronic device is connected to another electronic device through Wi-Fi P2P, the communication between the electronic device and the AP will be greatly affected, which may cause a Wi-Fi internet access service to be blocked or even disconnected, thereby greatly affecting user experience.
Disclosure of Invention
The application provides a data transmission method based on Wi-Fi P2P and electronic equipment, and aims to solve the problem that when the electronic equipment is communicated with an AP (access point), Wi-Fi internet surfing services of the electronic equipment are blocked or interrupted in a scene that the electronic equipment is connected with other electronic equipment through Wi-Fi P2P.
In a first aspect, an embodiment of the present application provides a data transmission method based on Wi-Fi P2P, where the method includes:
the method comprises the steps that a first electronic device receives sharing operation of a user, wherein the sharing operation is used for triggering the first electronic device to send first data to be shared to a second electronic device in a point-to-point P2P transmission mode; the first electronic equipment is connected to the first access point, and the second electronic equipment is connected to the second access point;
responding to the sharing operation, and creating a virtual access point by the first electronic equipment;
the first electronic equipment establishes a P2P channel with the second electronic equipment based on the virtual access point;
the first electronic device and the second electronic device transmit first data and internet data of the second electronic device through the P2P channel;
the first electronic device and the second electronic device are both electronic devices which do not support dual-frequency and dual-emission but support Wi-Fi P2P function.
According to the scheme, in a scene that Wi-Fi direct connection is needed between two electronic devices to transmit data, the networked electronic devices can create a virtual AP as a wireless hotspot, and another electronic device can be connected to the wireless hotspot as an STA role, so that a Wi-Fi P2P direct connection channel is established between the sending end device and the receiving end device. Through the Wi-Fi P2P direct connection channel, shared data can be transmitted, internet surfing data can also be transmitted, and therefore the devices at two ends can still have internet surfing capability while transmitting data. Therefore, the problem that after a Wi-Fi P2P direct channel is established between two electronic devices, the devices cannot be connected with a hotspot to surf the internet is solved.
It should be noted that, in the embodiment of the present application, a virtual AP (i.e., softAP) created by an electronic device may be understood as a part of the electronic device, and the softAP may be a functional module implemented by software and/or a module implemented by a combination of software and hardware in the electronic device, and is not another physical hardware independent from the electronic device.
In a possible implementation manner of the first aspect, the first electronic device and the second electronic device are both devices installed with a Windows system.
In some possible implementations of the first aspect, the P2P channel may include a first Socket channel and a second Socket channel. The first Socket channel is used for transmitting the first data, and the second Socket channel is used for transmitting the internet surfing data of the second electronic device.
According to the scheme provided by the embodiment of the application, in a scene that Wi-Fi direct connection is needed between two electronic devices applying a Windows system to transmit data, the networked electronic devices can create a virtual AP as a wireless hotspot, and the other electronic device can be connected to the wireless hotspot as an STA role, so that a Wi-Fi P2P direct channel is established between the sending end device and the receiving end device. Through the Wi-Fi P2P direct connection channel, shared data can be transmitted, internet surfing data can also be transmitted, and therefore the devices at two ends can still have internet surfing capability while transmitting data. Therefore, the problem that the device cannot be connected with a hotspot to surf the internet after a Wi-Fi P2P direct channel is established between two pieces of Windows system equipment is solved.
In a possible implementation manner of the first aspect, the method may further include: the first electronic equipment interacts internet surfing data of the first electronic equipment and internet surfing data of the second electronic equipment with the network side through the first access point.
In a possible implementation manner of the first aspect, the establishing, by the first electronic device, a P2P tunnel with the second electronic device based on the virtual access point includes:
the method comprises the steps that first electronic equipment sends hotspot information of a virtual access point to second electronic equipment, wherein the hotspot information of the virtual access point comprises a Service Set Identifier (SSID) and a password;
the second electronic equipment is connected to the virtual access point according to the received hotspot information of the virtual access point;
the first electronic device and the second electronic device successfully establish the P2P channel.
In a possible implementation manner of the first aspect, the method may further include: in a case where the second electronic device is connected to the virtual access point, the second electronic device disconnects from the second access point.
In a possible implementation manner of the first aspect, after the first electronic device receives the sharing operation of the user, the method further includes: responding to the sharing operation, displaying first prompt information by the first electronic equipment, wherein the first prompt information is used for prompting: when the first electronic device and the second electronic device perform data transmission, the second electronic device is connected to the wireless local area network of the first electronic device.
In a possible implementation manner of the first aspect, the creating, by the first electronic device, a virtual access point includes:
the first electronic equipment receives confirmation operation of a user on the first prompt message;
in response to a confirmation operation by the user, the first electronic device creates a virtual access point.
In a possible implementation manner of the first aspect, the receiving, by the first electronic device, a sharing operation of a user includes:
the method comprises the steps that first electronic equipment receives first operation of a user, wherein the first operation is operation of selecting first data and triggering sharing;
in response to the first operation, the first electronic device scans for connectable devices in the vicinity;
the first electronic device displaying the identification of the connectable device discovered by the scanning, the identification of the connectable device including the identification of the second electronic device;
the first electronic equipment receives a second operation of the user on the identifier of the second electronic equipment;
the sharing operation may include the first operation and the second operation.
In a possible implementation manner of the first aspect, after the first electronic device receives the sharing operation of the user, the method may further include:
the first electronic equipment and the second electronic equipment establish Bluetooth connection;
the first electronic equipment sends a first request message to the second electronic equipment based on the Bluetooth connection;
the second electronic equipment receives a first request message sent by the first electronic equipment based on the Bluetooth connection;
the second electronic equipment displays the first request message;
wherein, the first request message may be used to prompt: the first electronic device will send data to the second electronic device, and the second electronic device will be connected to the wireless local area network of the first electronic device during data transmission.
In a possible implementation manner of the first aspect, after the second electronic device displays the first request message, the method may further include:
the second electronic equipment receives confirmation operation of the user on the first request message;
the second electronic equipment sends a first message to the first electronic equipment, and the first message can be used for prompting that: the second electronic device has agreed to receive the first data transmitted by the first electronic device.
In a possible implementation manner of the first aspect, the method may further include:
after the second electronic equipment successfully receives the first data, the second electronic equipment disconnects the connection with the virtual access point;
the second electronic device reconnects to the second access point.
In a possible implementation manner of the first aspect, the method may further include:
the first electronic device receives a second response message sent by the second electronic device, wherein the second response message can be used for indicating that the first data has been successfully received;
the first electronic device deletes the virtual access point.
In a second aspect, an embodiment of the present application provides a data transmission method based on Wi-Fi P2P, including:
the method comprises the steps that a first electronic device receives a sharing operation of a user, wherein the sharing operation is used for triggering the first electronic device to send first data to be shared to a second electronic device in a point-to-point P2P transmission mode; wherein the second electronic device is connected to the second access point;
responding to the sharing operation, the first electronic equipment sends a second request message to the second electronic equipment, wherein the second request message is used for requesting the second electronic equipment to create a virtual access point;
the first electronic device establishes a P2P channel with the second electronic device based on the virtual access point;
the first electronic equipment and the second electronic equipment transmit first data and internet surfing data of the first electronic equipment through a P2P channel;
the first electronic equipment and the second electronic equipment are both electronic equipment which does not support dual-frequency and dual-transmission but supports Wi-Fi P2P functions.
In a possible implementation manner of the second aspect, the first electronic device and the second electronic device are both devices installed with a Windows system.
Through the scheme provided by the embodiment of the application, in a scene that Wi-Fi direct connection is needed between two electronic devices applying a Windows system to transmit data, the networked electronic devices can create a virtual AP as a wireless hotspot, and the other electronic device can be connected to the wireless hotspot as an STA role, so that a Wi-Fi P2P direct channel is established between the sending end device and the receiving end device. Through the Wi-Fi P2P direct connection channel, shared data can be transmitted, internet surfing data can also be transmitted, and therefore the devices at two ends can still have internet surfing capability while transmitting data. Therefore, the problem that after a Wi-Fi P2P direct channel is established between two pieces of Windows system equipment, the equipment cannot be connected with a hotspot to surf the internet is solved.
In a possible implementation manner of the second aspect, the P2P channel may include a first Socket channel and a second Socket channel; the first Socket channel is used for transmitting first data, and the second Socket channel is used for transmitting internet surfing data of the first electronic device.
In a possible implementation manner of the second aspect, the method may further include:
the second electronic equipment interacts internet surfing data of the second electronic equipment and internet surfing data of the first equipment with the network side through the second access point.
In a possible implementation manner of the second aspect, the establishing, by the first electronic device, a P2P channel with the second electronic device based on the virtual access point includes:
the method comprises the steps that first electronic equipment receives hotspot information of a virtual access point sent by second electronic equipment, wherein the hotspot information of the virtual access point comprises a Service Set Identifier (SSID) and a password;
the first electronic equipment is connected to the virtual access point according to the received hotspot information of the virtual access point;
the first electronic device and the second electronic device successfully establish the P2P channel.
In a possible implementation manner of the second aspect, after the first electronic device receives the sharing operation of the user, the method may further include:
responding to the sharing operation, the first electronic equipment displays second prompt information, and the second prompt information can be used for prompting: when the first electronic device and the second electronic device perform data transmission, the first electronic device is connected to a wireless local area network of the second electronic device.
In a possible implementation manner of the second aspect, the sending, by the first electronic device, the second request message to the second electronic device includes:
the first electronic equipment receives confirmation operation of the user on the second prompt message;
and responding to the confirmation operation of the user, and sending a second request message to the second electronic equipment by the first electronic equipment.
In a possible implementation manner of the second aspect, the sending, by the first electronic device, the second request message to the second electronic device includes:
the first electronic equipment and the second electronic equipment establish Bluetooth connection;
the first electronic equipment sends a second request message to the second electronic equipment based on the Bluetooth connection;
the second electronic equipment receives a second request message sent by the first electronic equipment based on the Bluetooth connection;
the second electronic equipment displays third prompt information according to the second request message;
wherein, the third prompt message is used for prompting: the first electronic device will send data to the second electronic device and the first electronic device will connect to the wireless local area network of the second electronic device during data transmission.
In a possible implementation manner of the second aspect, after the second electronic device displays the third prompt information according to the second request message, the method may further include:
the second electronic equipment receives confirmation operation of the user on the third prompt message;
the second electronic equipment sends a second response message to the first electronic equipment, wherein the second response message is used for prompting that: the second electronic device has agreed to receive the first data transmitted by the first electronic device.
In a possible implementation manner of the second aspect, the receiving, by the first electronic device, a sharing operation of a user includes:
the method comprises the steps that first electronic equipment receives first operation of a user, wherein the first operation is operation of selecting first data and triggering sharing;
in response to a first operation, the first electronic device scans for connectable devices in the vicinity;
the first electronic device displaying the identification of the connectable device discovered by the scanning, the identification of the connectable device including the identification of the second electronic device;
the first electronic equipment receives a second operation of the user on the identifier of the second electronic equipment;
the sharing operation includes the first operation and the second operation.
In a possible implementation manner of the second aspect, the method may further include:
the first electronic equipment receives a second message sent by the second electronic equipment, wherein the second message is used for indicating that the first data has been successfully received;
the first electronic device disconnects from the virtual access point.
In a possible implementation manner of the second aspect, the method may further include: after the second electronic device successfully receives the first data, the second electronic device deletes the virtual access point.
In a third aspect, an embodiment of the present application provides a data transmission apparatus based on Wi-Fi P2P, where the apparatus includes means for performing the method in the first aspect. The apparatus may correspond to the method described in the first aspect, and for the related description of the units in the apparatus, reference is made to the description of the first aspect, and for brevity, no further description is given here. Alternatively, the apparatus may correspond to performing the method described in the second aspect, and for the description of the units in the apparatus, reference is made to the description of the second aspect, and for brevity, no further description is provided here.
The method described in the first aspect or the second aspect may be implemented by hardware, or may be implemented by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described functions. Such as a detection module or unit, a Wi-Fi module or unit, etc.
In a fourth aspect, embodiments of the present application provide an electronic device, which includes a processor coupled with a memory, the memory being configured to store a computer program or instructions, and the processor being configured to execute the computer program or instructions stored in the memory, so that the method in the first aspect is performed. For example, the processor is for executing a memory-stored computer program or instructions causing the apparatus to perform the method of the first aspect.
In a fifth aspect, the present application provides a computer-readable storage medium on which a computer program (also referred to as instructions or codes) for implementing the method in the first aspect is stored. The computer program, when executed by a computer, causes the computer to perform the method of the first aspect, for example.
In a sixth aspect, an embodiment of the present application provides a chip including a processor. The processor is adapted to read and execute the computer program stored in the memory to perform the method of the first aspect and any possible implementation thereof. Optionally, the chip further comprises a memory, and the memory is connected with the processor through a circuit or a wire.
In a seventh aspect, the present application provides a chip system comprising a processor. The processor is adapted to read and execute the computer program stored in the memory to perform the method of the first aspect and any possible implementation thereof. Optionally, the chip system further comprises a memory, and the memory is connected with the processor through a circuit or a wire.
In an eighth aspect, the present application provides a computer program product, which includes a computer program (also referred to as instructions or code), and when the computer program is executed by a computer, the computer realizes the method in the first aspect.
It is understood that the beneficial effects of the second aspect to the eighth aspect can be referred to the related description of the first aspect, and are not described herein again.
Drawings
Fig. 1 is a schematic application scenario diagram of a data transmission method based on Wi-Fi P2P according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a Wi-Fi P2P application scenario according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a process of data interaction between modules of two electronic devices according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a data transmission method based on Wi-Fi P2P according to a first embodiment of the present application;
FIG. 5 is a schematic diagram of a user interface of a data transmission method based on Wi-Fi P2P according to the first embodiment of the present application;
FIG. 6 is a schematic block diagram of a Wi-Fi P2P-based data transmission method according to a first embodiment of the present application;
fig. 7 is a diagram illustrating an exemplary processing flow of a sending end in a data transmission method based on Wi-Fi P2P according to a first embodiment of the present application;
fig. 8 is a diagram illustrating an exemplary processing flow of a receiving end in a Wi-Fi P2P-based data transmission method according to a first embodiment of the present application;
FIG. 9 is a schematic block diagram of another Wi-Fi P2P-based data transmission method provided in the first embodiment of the present application;
fig. 10 is a schematic flowchart of a data transmission method based on Wi-Fi P2P according to a second embodiment of the present application;
FIG. 11 is a schematic block diagram of a Wi-Fi P2P-based data transmission method according to a second embodiment of the present application;
FIG. 12 is another schematic block diagram of a Wi-Fi P2P-based data transmission method according to the second embodiment of the present application;
fig. 13 is a schematic flowchart of a data transmission method based on Wi-Fi P2P according to a third embodiment of the present application;
fig. 14 is a schematic block diagram of a Wi-Fi P2P-based data transmission method according to a third embodiment of the present application;
fig. 15 is a schematic structural diagram of a data transmission device based on Wi-Fi P2P according to an embodiment of the present application;
fig. 16 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
The term "and/or" herein is an association relationship describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. The symbol "/" herein denotes a relationship in which the associated object is or, for example, a/B denotes a or B.
The terms "first" and "second," and the like, in the description and in the claims herein are used for distinguishing between different objects and not for describing a particular order of the objects. For example, the first electronic device and the second electronic device, etc. are for distinguishing different electronic devices, and are not for describing a specific order of the electronic devices.
In the embodiments of the present application, words such as "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present relevant concepts in a concrete fashion.
In the description of the embodiments of the present application, unless otherwise specified, "a plurality" means two or more, for example, a plurality of processing units means two or more processing units, or the like; plural means two or more elements, and the like.
In order to facilitate understanding of the embodiments of the present application, some terms of the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
1) Access point AP and station STA
A Wireless Local Area Network (WLAN) is mainly composed of Stations (STAs) and Access Points (APs). The STA device is an electronic device in the WLAN and functions as an STA, and the AP device is an electronic device in the WLAN and functions as an AP. In a WLAN, one or more STA devices may establish a wireless connection with an AP device through a built-in wireless network card or Wi-Fi module. The AP equipment can provide wireless connection service for the STA equipment, and a plurality of STA equipment can access the same Wi-Fi network through the AP equipment to realize mutual connection. The AP device may be connected to the internet through a wire, so that the STA device may connect to the internet through the AP device, for example, may download data from the internet side or upload data to the internet side, that is, the STA device may implement a Wi-Fi internet access service through the AP device.
In this embodiment, the STA device may be a notebook computer, or a desktop computer with a wireless network card, that is, a Personal Computer (PC), or may be other electronic devices using a Windows system, which is not limited in this application. The AP device may be a wireless router.
Exemplarily, as shown in fig. 1 (a), the electronic device 1 and the electronic device 2 are STA devices, the wireless router 3 is an AP device, the electronic device 1 and the electronic device 2 establish wireless connection with the wireless router 3 through a Wi-Fi channel, respectively, and the wireless router 3 is connected to the network server 4 through a wire. In this way, the electronic device 1 and the electronic device 2 of the personal computer can respectively realize the internet access service through the wireless router 3. It should be noted that, the electronic device 1 and the electronic device 2 are exemplarily illustrated as being connected to the same wireless router, and it can be understood that, in actual implementation, the electronic device 1 and the electronic device 2 may be respectively connected to different wireless routers to implement an internet service.
For ease of illustration, devices that will support Wi-Fi wireless connectivity may be referred to below as Wi-Fi devices.
2) Wi-Fi P2P (peer-to-peer, end-to-end or point-to-point)
Wi-Fi P2P is a technical specification introduced by the Wi-Fi alliance, also known as Wi-Fi Direct (Wi-Fi Direct), which supports a plurality of Wi-Fi devices to form a peer-to-peer network (also known as P2P Group) and communicate with each other without an AP. For ease of illustration, Wi-Fi devices that support Wi-Fi P2P wireless connectivity may be referred to below as Wi-Fi P2P devices or P2P devices.
Two roles are defined in the P2P architecture, which are:
(a) go (group owner): AP role in P2P network.
(b) Gc (group client): STA role in P2P network.
After P2P negotiation is completed among a plurality of P2P devices, one of the P2P devices acts as GO, i.e., AP role; the other P2P devices act as GCs, i.e., STAs. It should be noted that there can be only one GO in a P2P network, and one GO can support connections with one or more GCs.
A Wi-Fi P2P connection may be applied in scenarios where large amounts of data are transferred wirelessly between devices. For example, in practical implementation, Wi-Fi P2P technology may be used for Wi-Fi on-screen display, for example, a P2P-enabled smart phone may be directly connected to a P2P-enabled smart tv via Wi-Fi P2P technology, and the smart phone may then transmit its own on-screen display content to the smart tv for display. Therefore, the direct connection between Wi-Fi devices expands the use scene of the Wi-Fi technology by means of the Wi-Fi P2P technology.
3) Virtual AP (Soft access point, SoftAP)
The virtual AP is also referred to as a virtual hot spot or a simulated hot spot. Through the wireless network card, the virtual AP function can be realized on the electronic equipment by using special software, and wireless networking is realized. That is, the carrier in the WLAN is used as a wireless access point, and a computer, a mobile phone or other internet access devices are connected to the carrier, and then internet access is performed through the carrier network (e.g. 3G/4G/5G).
In practical implementation, when a large amount of data needs to be wirelessly transmitted between two electronic devices supporting P2P capability and applying the Windows system, the two electronic devices may be connected by a SoftAP-STA scheme: one electronic device can create a SoftAP through a built-in wireless network card to serve as a wireless hotspot; another electronic device may be a STA that connects to the wireless hotspot to enable a Wi-Fi P2P connection between devices.
Exemplarily, as shown in fig. 1 (b), assuming that the electronic device 1 and the electronic device 2 support Wi-Fi P2P, the electronic device 1 may create a SoftAP as a wireless hotspot without connecting an AP; the electronic device 2 may be connected to the wireless hotspot, so that the electronic device 1 and the electronic device 2 may directly establish connection and perform data interaction and sharing, for example, may implement a multi-screen interaction function. Illustratively, through a Wi-Fi P2P connection, an image displayed on the screen of the electronic device 1 may be sent to the electronic device 2 for screen projection.
In some scenarios, a direct connection may need to be made between multiple devices via Wi-Fi P2P, and one or more of the multiple devices may need to communicate with the AP device via a Wi-Fi connection. However, in the prior art, when one STA device attempts to connect to other devices through Wi-Fi P2P while there is communication with an AP device, the communication between the STA device and the AP device is greatly affected.
By taking a specific scenario as an example, fig. 2 shows a schematic diagram of a Wi-Fi P2P application scenario according to an embodiment of the present application. As shown in fig. 2 (a), the electronic device 1, acting as an STA, establishes a connection with the first AP based on the Wi-Fi protocol; the electronic device 2, acting as an STA, establishes a connection with the second AP based on the Wi-Fi protocol. The electronic device 1 and the electronic device 2 both use a Windows system and both support Wi-Fi P2P. Optionally, the first AP and the second AP may be the same AP or different APs, and the embodiment of the present application is not limited.
As shown in fig. 2 (b), in a file sharing scenario implemented through a P2P connection, the electronic device 1 at the sending end creates a virtual AP, and the electronic device 2 at the receiving end serves as an STA, which may establish a Wi-Fi P2P data transmission channel. However, in the case where the electronic device 2 is connected to the second AP and is downloading a file or playing a network video from the network, if the electronic device 2 and the electronic device 1 establish a P2P connection to receive the file, the downloading of the network video or the file played on the electronic device 2 may be blocked, and even the electronic device 2 may be disconnected from the network, for example, the electronic device 2 may display a prompt message: "device 1 sends you a file, and your network connection will be temporarily interrupted during transmission", which greatly affects the communication experience of the user.
That is, a Windows system device (e.g., the electronic device 2 described above) cannot support two STA roles simultaneously: one STA role is used to connect to a wireless hotspot (e.g., the second AP) to enable a web service, and another STA role is used to connect to another device (e.g., the electronic device 1 described above) to establish a Wi-Fi P2P connection.
In principle, when the electronic device 2 attempts to establish a Wi-Fi P2P connection with the electronic device 1 while there is communication with the AP, the electronic device 2 needs to perform a device discovery operation, such as scanning (scan), listening (listen), or searching (search), on multiple channels in order to discover (discover) the electronic device 1 and establish a connection therewith. When the electronic device 2 communicates with the second AP, the channel responsible for data communication with the second AP is in a working state, and since data communication and device discovery operation cannot be performed simultaneously, if the electronic device 2 performs scanning, monitoring or searching operation again at this time, the channel communicating with the AP cannot work at the time when the device discovery operation occurs, thereby affecting communication between the electronic device 2 and the AP.
It should be noted that, the scene description is performed on the premise that the electronic device does not support Dual Band Dual Current (DBDC). Specifically, while an STA device that does not support DBDC connects to an AP hotspot to surf the internet, if the STA device establishes a Wi-Fi P2P data transmission channel with other devices, the STA device may no longer connect to the hotspot to surf the internet, that is, the internet surfing service may be interrupted.
In view of this, an embodiment of the present application provides a data transmission method based on Wi-Fi P2P, where in a scenario where Wi-Fi direct is required between two electronic devices applying a Windows system to transmit data, a virtual AP may be created by an electronic device that has been networked as a wireless hotspot, and another electronic device may be connected to the wireless hotspot as an STA role, so that a Wi-Fi P2P channel is established between a sending end device and a receiving end device. The Wi-Fi P2P channel can be used for transmitting shared data and internet surfing data, so that the equipment at two ends can still have internet surfing capability while transmitting data. Therefore, the problem that the equipment cannot be connected with a hot spot to surf the internet after a Wi-Fi P2P channel is established between two pieces of Windows system equipment is solved.
The execution subject of the data transmission method based on Wi-Fi P2P provided in the embodiment of the present application may be the electronic device that supports Wi-Fi P2P and applies a Windows system, or may be a functional module and/or a functional entity that can implement the data transmission method based on Wi-Fi P2P in the electronic device, and the scheme of the present application may be implemented by hardware and/or software, and may be specifically determined according to actual usage requirements, which is not limited in the embodiment of the present application.
First, a description will be given of a procedure of establishing a Wi-Fi P2P connection between devices according to an embodiment of the present application, in conjunction with a data interaction procedure between modules of the electronic device 1 and modules of the electronic device 2. Fig. 3 is a schematic diagram of a process of data interaction between each module in the electronic device 1 and each module in the electronic device 2.
As shown in fig. 3, the electronic apparatus 1 may include: the device located in the application program layer cooperates with the APP, the first discovery connection module located in the system layer, and the first Bluetooth chip and the first Wi-Fi chip located in the hardware layer. The electronic device 2 may include: a second discovery connection module and a collaboration service module (not shown) located at the system layer, and a second bluetooth chip and a second Wi-Fi chip located at the hardware layer. As shown in FIG. 3, the process of data interaction between modules may include steps A1 through A16.
Step a1, the device in the electronic device 1 cooperates with the APP to receive the sharing operation input by the user.
For example, a control (e.g., a sharing control) for triggering connection between devices and sharing a file may be included in the interface of the device collaboration APP. For example, the sharing operation input by the user may be a series of operations that the user triggers to share after selecting a picture. For example, after the user selects a certain picture in the electronic device 1, the electronic device 1 may pop up an interface of the device cooperation APP, and when the user selects the sharing control, the electronic device 1 may scan and find surrounding connectable electronic devices and display an identifier of one or more scanned electronic devices for the user to select; after the user selects one device identifier, the sharing operation can be completed.
Step a2, the device sends a message to the first discovery connection module in cooperation with the APP, instructing the first discovery connection module to scan for nearby connectable devices.
After the device cooperates with the APP to receive the sharing operation input by the user, the device cooperates with the APP to send an inter-process communication (IPC) message to the first discovery connection module. The IPC message may carry a scan indication instruction for instructing the first discovery connection module to invoke the capability scan of the first bluetooth chip to discover nearby connectable electronic devices.
Step A3, the first discovery connection module invokes the Bluetooth capability scan of the first Bluetooth chip to discover nearby connectable devices.
After receiving the IPC message, the first discovery connection module calls the capability scan of the first Bluetooth chip to discover nearby connectable electronic equipment.
In step a4, the electronic device 1 broadcasts a scanning signal through the first bluetooth chip.
In step a5, the electronic device 2 may receive the scanning signal of the electronic device 1 through the second bluetooth chip, and forward the scanning signal to the second discovery connection module of the electronic device 2.
Step a6, the second discovery connection module of electronic device 2 feeds back the basic information of electronic device 2 itself to the first discovery connection module of electronic device 1.
For example, the basic information of the electronic device 2 may include an internet protocol address (IP address), a media access control address (MAC address), a universal unique identifier (uuid), a device identification, a device name, and the like of the electronic device 2.
When the first discovery connection module of the electronic device 1 scans the connectable electronic device 2, the first discovery connection module may acquire basic information of the electronic device 2.
In step a7, the first discovery connection module sends basic information (e.g. device name, MAC address) of the discovered connectable electronic device to the device cooperation APP.
Step A8, the device, in cooperation with the APP, presents basic information of one or more connectable devices discovered by the scanning in a connectable device list for display to the user for viewing.
In some embodiments, the device, in cooperation with the APP, displays a connectable device list including all devices, such as a tablet, a mobile phone, or a wearable device, that have bluetooth enabled in the vicinity of the electronic device 1.
In other embodiments, after the device cooperation APP receives information of all devices with the bluetooth function turned on, the devices supporting Wi-Fi P2P may be screened out for display, for example, if the wearable device does not support Wi-Fi P2P, the wearable device is no longer displayed in the connectable device list in cooperation with the APP.
In particular, electronic device 2 is included in the connectable one or more electronic devices discovered by the device in cooperation with the APP scan.
In step a9, when the user clicks the electronic device 2 in the connectable device list, the device cooperation APP may receive a click operation of the user.
Step a10, the device cooperates with the APP to send an IPC message to the first discovery connection module, which is used to instruct the first discovery connection module to call the first bluetooth chip to establish a bluetooth connection with the electronic device 2.
Wherein, the IPC message may carry basic information of the electronic device 2.
The bluetooth connection may be established by using a Bluetooth Low Energy (BLE) technology, or may be established by using other bluetooth technologies, which is not limited in the embodiment of the present application.
Step a11, after receiving the IPC message, the first discovery connection module may invoke the capability of the first bluetooth chip to perform bluetooth connection with the second bluetooth chip of the electronic device 2, so as to implement communication connection between the electronic device 1 and the electronic device 2.
Step a12, the electronic device 1 and the electronic device 2 successfully establish the bluetooth connection.
Step a13, the electronic device 1 and the electronic device 2 negotiate to establish a P2P connection based on the bluetooth connection.
Based on the bluetooth connection, the electronic device 1 and the electronic device 2 may interact with each other according to the network connection condition. For example, electronic device 2 may send a message to electronic device 1 indicating that electronic device 2 is or is not networked.
In the embodiment of the present application, when negotiating to establish a P2P connection, different scenarios may correspond to different schemes or policies:
(1) the electronic device 1 at the transmitting end and the electronic device 2 at the receiving end are both networked.
The first scheme is as follows: the electronic device 1 creates a virtual AP as a wireless hotspot, and the electronic device 2 at the receiving end serves as an STA role and is connected to the wireless hotspot, so that a P2P connection can be successfully established between the electronic device 1 and the electronic device 2, data can be directly transmitted, the internet access service of the electronic device 1 is not affected, and the electronic device 2 can implement the internet access service through the wireless hotspot corresponding to the electronic device 1.
According to the second scheme, the electronic device 2 creates a virtual AP as a wireless hotspot, the electronic device 1 at the receiving end serves as an STA role and is connected to the wireless hotspot, so that the P2P connection can be successfully established between the electronic device 1 and the electronic device 2, data can be directly transmitted, the internet access service of the electronic device 2 is not affected, and the electronic device 1 can realize the internet access service through the wireless hotspot corresponding to the electronic device 2.
Alternatively, when the electronic device 1 at the transmitting end is networked, the virtual AP may be created by default by the transmitting end device, regardless of the networking condition of the electronic device 2 at the receiving end.
(2) The electronic device 1 at the transmitting end is not networked, and the electronic device 2 at the receiving end is networked.
The electronic device 2 creates a virtual AP as a wireless hotspot, and the electronic device 1 serves as an STA role and is connected to the wireless hotspot, so that a P2P connection can be successfully established between the electronic device 1 and the electronic device 2, data can be directly transmitted, internet access services of the electronic device 2 are not affected, and the electronic device 1 can implement the internet access services through the wireless hotspot corresponding to the electronic device 2.
(3) A scenario in which the electronic device 1 of the transmitting end is networked, and the electronic device 2 of the receiving end is not networked.
The electronic device 1 creates a virtual AP as a wireless hotspot, and the electronic device 2 serves as an STA role and is connected to the wireless hotspot, so that a P2P connection can be successfully established between the electronic device 1 and the electronic device 2, data can be directly transmitted, internet access services of the electronic device 1 are not affected, and the electronic device 2 can implement the internet access services through the wireless hotspot corresponding to the electronic device 1.
(4) The electronic device 1 at the transmitting end and the electronic device 2 at the receiving end are not connected to the network.
Either of electronic device 1 and electronic device 2 may create a wireless hotspot to enable an inter-device P2P connection. For example, the electronic device 1 creates a virtual AP as a wireless hotspot, and the electronic device 2 plays a role of STA to connect to the wireless hotspot, so that a P2P connection can be successfully established between the electronic device 1 and the electronic device 2, and data can be directly transmitted.
Taking the scenario (1) as an example, the scenario one is correspondingly implemented as a14-a 23; the second scheme of scenario (1) is similar to the first scheme, and is not described herein again. Then, the scenario A24-A32 corresponding to the scenario (2) is taken as an example for illustration; the scheme corresponding to the scenario (3) is similar to the scheme corresponding to the scenario (2), and is not described herein again. The (4) th scenario is not important, and therefore the processing procedure is not shown in the flowchart.
Step a14, the first discovery connection module of the electronic device 1 calls the first Wi-Fi chip to create a virtual AP.
The virtual AP has a Service Set Identifier (SSID) and a password.
Step a15, the first discovery connection module sends the SSID and password to the second discovery connection module of the electronic device 2 via the established bluetooth connection.
Step A16, the second discovery connection module of the electronic device 2 calls the second Wi-Fi chip, and establishes a Wi-Fi P2P connection with the electronic device 1 according to the received SSID and password.
In step a17, the electronic device 2 connects to the virtual AP corresponding to the electronic device 1. If the electronic device 2 is networked through the second AP, the second Wi-Fi chip of the electronic device 2 disconnects from the second AP.
Step A18, a Wi-Fi P2P channel is successfully established between electronic device 1 and electronic device 2.
The Wi-Fi P2P channel is a physical channel for carrying data transmission.
Step a19, a Socket channel is established between electronic device 1 and electronic device 2.
Wherein the Socket channel is a logical channel established based on the Wi-Fi P2P channel.
In practical applications, the Socket channel implements data transmission based on IP of the two-end device or module, a certain determined port, and a protocol (e.g., TCP/IP, UDP, SMTP, FTP, etc.) convention supported by negotiation of the two-end device.
The service module of the electronic device may create one or more Socket channels according to the current service condition, and respectively transmit data of different services. Specifically, according to the scheme of the application, the current service may include a transmission service of shared data and a transmission service of internet data, and based on this, the electronic device 1 may create two Socket channels, which are respectively referred to as Socket channel 1 and Socket channel 2. Socket channel 1 may be used to transmit shared data, and Socket channel 2 may be used to transmit internet data.
In step a20, data is shared between the electronic device 1 and the electronic device 2 through the Socket channel 1.
Step a21, the internet surfing data of the electronic device 2 is transmitted between the electronic device 1 and the electronic device 2 through the Socket channel 2.
In this way, the electronic device 1 and the electronic device 2 may implement data sharing and internet access services through the P2P channel.
In step a22, after the sharing is finished, the electronic device 1 deletes the virtual AP.
Here, in response to a user trigger operation, the electronic apparatus 1 may delete the virtual AP; or after the sharing is finished, the electronic device 1 may automatically delete the virtual AP.
Step a23, the electronic device 2 disconnects from the virtual AP and automatically selects a usable hot spot, for example, the electronic device 2 automatically connects to the second AP that is connected previously.
As can be seen from the above a14-a23, in the case where the electronic device 1 is networked, the electronic device 1 creates a virtual AP as a wireless hotspot; the electronic device 2 is used as an STA role and connected to the virtual AP created by the electronic device 1, so that a P2P channel and a Socket channel are established between the devices, and the purposes of data sharing and internet service are achieved.
The following description will be made with reference to a24-a32 as described below to describe an implementation of establishing a P2P channel between devices in a case where the electronic device 1 at the transmitting end is not networked and the electronic device 2 at the receiving end is networked.
Step a24, the second discovery connection module of electronic device 2 invokes the second Wi-Fi chip to create the virtual AP.
Also, the virtual AP has a Service Set Identifier (SSID) and a password.
Step a25, the second discovery connection module sends the SSID and the password to the first discovery connection module of the electronic device 1 through the established bluetooth connection.
Step A26, the first discovery connection module of the electronic device 1 calls the first Wi-Fi chip, and establishes Wi-Fi P2P connection with the electronic device 2 according to the received SSID and password.
The electronic device 1 is connected to the virtual AP corresponding to the electronic device 2.
Step A27, the electronic device 1 and the electronic device 2 successfully establish a Wi-Fi P2P connection.
Step a28, a Socket channel is established between electronic device 1 and electronic device 2.
Similarly, two Socket channels are established between the electronic device 1 and the electronic device 2, and are respectively called Socket channel 1 and Socket channel 2. Socket channel 1 can be used for transmitting shared data, and Socket channel 2 can be used for transmitting internet data.
In step a29, data is shared between the electronic device 1 and the electronic device 2 through the Socket channel 1.
Step a30, the internet surfing data of the electronic device 1 is transmitted between the electronic device 1 and the electronic device 2 through the Socket channel 2.
In this way, the electronic device 1 and the electronic device 2 may implement data sharing and internet access services based on the Wi-Fi P2P channel.
In step a31, after the sharing is finished, the electronic device 1 disconnects from the virtual AP.
The electronic device 1 may automatically select a usable hotspot, for example, the electronic device 1 may automatically connect to the previously connected AP.
In step a32, the electronic device 2 deletes the virtual AP.
Here, in response to a user trigger operation, the electronic apparatus 1 may delete the virtual AP; or after the sharing is finished, the electronic device 1 may automatically delete the virtual AP.
As can be seen from the above a24-a32, when the electronic device 1 at the transmitting end is not networked but the electronic device 2 at the receiving end is networked, the electronic device 2 creates a virtual AP as a wireless hotspot; the electronic device 1, as an STA role, is connected to the virtual AP created by the electronic device 2, so that a P2P channel and a Socket channel are established between the devices, thereby achieving the purpose of data sharing and internet access service.
The Wi-Fi P2P-based data transmission method provided by the embodiments of the present application is exemplarily described below by three embodiments with reference to the drawings. For convenience of explanation, the electronic device 1 at the transmitting end may be hereinafter referred to as a transmitting-end device, and the electronic device 2 at the receiving end may be hereinafter referred to as a receiving-end device.
First embodiment
The first embodiment mainly describes how to perform data transmission between the sending end device and the receiving end device through Wi-Fi P2P and how to implement the purpose of uninterrupted internet access service of the networked devices in a scenario where both the sending end device and the receiving end device are networked.
Fig. 4 is a flowchart illustrating a data transmission method based on Wi-Fi P2P according to a first embodiment of the present application. Referring to FIG. 4, the method 100 includes steps S101-S105 described below.
S101, the electronic device 1 receives a first operation of a user, wherein the first operation is used for triggering the electronic device 1 to send first data to the electronic device 2 in a P2P transmission mode.
The electronic device 1 and the electronic device 2 are devices to which a Windows system is applied. Electronic device 1 and electronic device 2 both support the Wi-Fi P2P protocol, and the P2P functionality of electronic device 1 and electronic device 2 has been turned on by default. The P2P function may also be referred to as an inter-transmission or sharing function, which is not limited in this embodiment of the present application.
Alternatively, the first operation may include a plurality of sub-operations. For example, the first operation includes a first sub-operation, a second sub-operation, a third sub-operation, and a fourth sub-operation described below. Illustratively, as shown in fig. 5, when the user needs to share the picture 40 (i.e. the first data) on the electronic device 1 to the electronic device 2, the user may select the picture 40 of the electronic device 1 (a first sub-operation), when the menu bar 41 pops up, the user may click the "sharing" control in the menu bar 41 (a second sub-operation), and then the electronic device 1 may automatically scan to find the surrounding connectable devices. After the electronic device 1 discovers the electronic device 2, the electronic device 1 displays the identification 42 of the electronic device 2. In response to an operation (third sub-operation) of the user selecting the identifier 42 of the electronic device 2, the electronic device 1 may display a prompt window 43 for prompting the user to confirm whether to send the picture 40 to the electronic device 2. In response to the user clicking the send control in the prompt window 43 (fourth sub-operation), the electronic device 1 may send a message to share a picture to the electronic device 2. As shown in fig. 4, the electronic device 2 may display a picture sharing message prompt box 44, where the message prompt box 44 is used to prompt: device 1 shares a picture with you, refuses or receives. It will be appreciated that the first operation corresponds to the sharing operation described above in fig. 3.
Optionally, the Wi-Fi P2P function of the electronic device 1 may be activated by being triggered by a user, may be activated autonomously when the electronic device 1 is activated, or may be activated under a specific condition, and the embodiment of the present application is not limited.
In the first embodiment, as described above, when the electronic device 1 receives the first operation of the user, first the electronic device 1 discovers the electronic device 2 by broadcasting, scanning, or the like, and then the electronic device 1 can directly initiate the establishment of the P2P channel with the electronic device 2 if the electronic device 1 is networked. Specifically, the electronic device 1 creates a virtual AP as a wireless hotspot; the electronic device 2 acts as an STA and connects to the virtual AP created by the electronic device 1, thereby implementing the establishment of a P2P channel between devices. That is to say, in the case that the sending end device is already networked, the sending end device may default to create the virtual AP as the wireless hotspot, without knowing the networking situation of the receiving end device, and without negotiating with the receiving end device which end device creates the virtual AP.
In other embodiments, when the electronic device 1 receives the first operation of the user, the electronic device 1 and the electronic device 2 may first establish a bluetooth connection channel, and then perform information interaction through the bluetooth connection channel to negotiate establishment of a P2P channel between the devices. For example, one of the electronic device 1 and the electronic device 2 may be determined as the virtual AP role according to the networking situation of both parties. Alternatively, electronic device 1 and electronic device 2 may negotiate that the networked peer device create a virtual AP as a wireless hotspot.
If the electronic device 1 is connected to the first AP and the electronic device 2 is connected to the second AP, that is, both the sending end device and the receiving end device are already networked. In this case, the transmitting end may create a virtual AP as a wireless hotspot; or, the receiving end may create a virtual AP as a wireless hotspot. Alternatively, the electronic device 1 and the electronic device 2 may negotiate the creation of the virtual AP by the transmitting end. For convenience of explanation, fig. 3 exemplifies that the electronic device 1 at the transmitting end creates a virtual AP. Optionally, the first AP and the second AP may be the same AP or different APs, and the embodiment of the present application is not limited.
S102, the electronic device 1 creates a virtual AP.
Referring to fig. 5 again, in the case where the sending-end device creates a virtual AP, when the electronic device 1 sends the picture 40 to the electronic device 2, the prompt window 43 popped up by the electronic device 1 prompts: the opposite party in transmission is connected to the local network; the message prompt box 44 of the electronic device 2 prompts: the transmitting local machine will connect to the other network.
S103, the electronic device 1 and the electronic device 2 establish a P2P channel based on the virtual AP.
In the embodiment of the present application, the electronic device 1 serving as a sending end creates a virtual AP as a wireless hotspot. Further, the electronic device 2, acting as an STA, may connect to the virtual AP created by the electronic device 1. It can be understood that in the case where the electronic device 2 is connected to the virtual AP created by the electronic device 1, the electronic device 1 and the electronic device 2 successfully establish the P2P tunnel.
S104, the electronic device 1 sends the first data to the electronic device 2 through the P2P channel, and transmits the internet data of the electronic device 2.
It is understood that the electronic device 1 and the electronic device 2 can directly transmit data through the P2P channel, and do not indirectly transmit data through the server.
In the embodiment of the present application, the P2P channel established between the electronic device 1 and the electronic device 2 is a physical channel, which can be used as two logical channels in specific applications: one of the logical channels is used to transmit first data to be shared, and may be referred to as a sharing channel; the other logical channel is used for transmitting internet data of the electronic device 2, and may be referred to as an internet data channel.
And S105, the electronic device 1 transmits the internet surfing data of the electronic device 1 and the internet surfing data of the electronic device 2 with the network side through the first AP.
The electronic device 1 not only can serve as an STA role, but also interacts with a network side through the first AP; moreover, the electronic device 1 may also serve as a virtual AP role, establish a P2P channel with the electronic device 2 serving as an STA role, and perform data transmission; and, the electronic device 1 can also provide the internet access capability for the electronic device 2 in case the electronic device 1 is networked. That is to say, according to the scheme of the application, while the electronic device serves as an STA role to communicate with the AP, the electronic device can serve as a virtual AP role to establish a P2P channel with other devices, so that end-to-end data transmission is achieved, and in this case, communication (i.e., internet access service) between the electronic device and the AP is not affected, so that multi-device interaction experience can be improved.
In the embodiment of the present application, in a case where the electronic device 2 establishes the P2P channel with the electronic device 1, the electronic device 2 may disconnect the connection with the originally connected second AP.
Optionally, in this embodiment of the application, the electronic device 2 may display networking prompt information, where the networking prompt information is used to prompt the electronic device 2 to surf the internet through the wireless hotspot corresponding to the electronic device 1.
In some embodiments, the networking prompt may include an option to confirm networking and an option to disable networking for selection by the user.
In one aspect, in response to a confirmation of a networking operation by the user on the electronic device 2, the electronic device 2 may surf the internet through the wireless hotspot. In this case, the P2P channel established between the electronic device 1 and the electronic device 2 can be used as two logical channels: one of the logic channels is a sharing channel, and is used for data mutual transmission (for example, first data transmission); the other logical channel is an internet data channel and is used for transmitting internet data of the electronic device 2.
On the other hand, in response to the user's prohibition of networking operations on the electronic device 2, the electronic device 2 may not surf the internet through the wireless hotspot. In this case, the P2P channel established between the electronic device 1 and the electronic device 2 may be used as a sharing channel only for data mutual transmission.
The method steps described above with respect to fig. 4 are further described below with respect to fig. 6. Fig. 6 is a schematic block diagram of a data transmission method based on Wi-Fi P2P according to a first embodiment of the present application. Under the condition that the devices at the two ends are both accessed to the network, the sending end has a SoftAP role, the receiving end has an STA role, and the receiving end and the sending end can share file data and share internet surfing capability on the established Wi-Fi P2P channel through the logic shown in FIG. 4.
As shown in fig. 6 (a), the electronic device 1 connects to the first AP as a STA role, thereby forming a first Wi-Fi network through which the electronic device 1 can connect to the internet; the electronic device 2 connects to the second AP in a STA role, thereby forming a second Wi-Fi network through which the electronic device 2 can connect to the internet.
As shown in fig. 6 (b), when the user triggers the electronic device 1 to share data to the electronic device 2 in a P2P manner, the electronic device 1 at the sending end may create a virtual AP (i.e., SoftAP) as a wireless hotspot. The electronic device 2 at the receiving end may be connected to the SoftAP created by the electronic device 1 in a STA role, so that the electronic device 1 and the electronic device 2 establish a P2P channel (including a shared data channel and an internet data channel).
As shown in (a) and (b) of fig. 6, the first Wi-Fi network of the transmitting end is still reserved, and the second Wi-Fi network of the receiving end is disconnected; and a third Wi-Fi network is newly established between the sending end equipment and the receiving end equipment. Based on the newly-built third Wi-Fi network, data sharing can be performed between the sending end device and the receiving end device, internet surfing data of the receiving end device can also be transmitted, wherein the internet surfing data of the receiving end device can be transmitted to the sending end device through the internet surfing data channel, and then interaction with the internet side is performed through the first AP. That is to say, the receiving end device may be networked through the AP to which the sending end device is correspondingly connected, so that the internet access service of the receiving end device is not affected.
In this embodiment of the application, under the condition that both the sending end device and the receiving end device are networked, when a virtual AP is created as a wireless hotspot by the sending end device, the sending end device and the receiving end device not only can establish a P2P channel and share data through the P2P channel, but also can transmit internet data of the receiving end device through the P2P channel, that is, the receiving end device can be networked through an AP to which the sending end device is correspondingly connected, so that both the sending end device and the receiving end device can continue to surf the internet, and the user interaction experience is improved.
It should be noted that, in the embodiment of the present application, the virtual AP created by the electronic device, for example, the softAP module shown in fig. 6 and the softAP module shown in fig. 9, fig. 11, fig. 12, and fig. 14 described below, may be both part of the electronic device, and the softAP may be a functional module implemented by software and/or a module implemented by a combination of software and hardware in the electronic device, and is not another physical hardware independent from the electronic device.
In the following, with reference to fig. 7 and fig. 8, a data transmission method based on Wi-Fi P2P according to an embodiment of the present application is described from the perspective of a transmitting end and a receiving end, respectively.
For the sending end: the sending end uses the electronic device 1 with the wireless network function to create a network sharing hotspot and starts the network sharing hotspot to share files. The sending end equipment is connected with the AP to carry out internet surfing activities, and the internet surfing activities are not influenced by network sharing hotspots.
For the receiving end: the receiving end uses the electronic device 2 with the wireless network function to connect the network sharing hotspot of the sending end and establish direct connection with the sending end, and the receiving end receives the file shared by the sending end. If the sending end can normally carry out the internet surfing activity, after the receiving end is connected with the network sharing hotspot of the sending end, the receiving end can have the internet surfing activity capability through the network sharing hotspot.
Fig. 7 is a diagram illustrating an exemplary processing flow of a sending end in a data transmission method based on Wi-Fi P2P according to a first embodiment of the present application. As shown in fig. 7, the processing flow on the transmitting end includes steps S1011 to S1018. It is to be understood that the main execution bodies of the processing flow are all the sending end, for example, the electronic device 1.
S1011, the transmitting end and the receiving end have established a basic communication connection.
Illustratively, the base communication connection may be a bluetooth connection.
S1012, the transmitting end obtains a configuration file associated with the WLAN connection.
And S1013, when the sending end acquires the configuration file associated with the WLAN connection, the sending end creates a network sharing hotspot by using the configuration file.
The sending end device may be installed with a wireless network card driver supporting a virtual Wi-Fi function, and the driver may be used to create a virtual AP, that is, a software virtual AP. Through the virtual AP, the network connection on the sending terminal equipment can be shared to the receiving terminal equipment, and the function of the wireless router is realized. The wireless network card may be connected to the AP, or may also virtualize a hot spot (hotspot) at the same time, and share the hotspot with the receiving end device.
And S1014, when the sending end does not acquire the configuration file, the sending end acquires a configuration file list associated with the locally stored WLAN connection.
Further, when the sending end acquires the configuration file list, the sending end uses the existing configuration files in the configuration file list to create the network sharing hotspot.
And S1015, after the sending end successfully creates the network sharing hotspot by adopting the configuration file, the sending end sets the name and the password of the network sharing hotspot.
The network sharing hotspot name may be an SSID.
S1016, when the network sharing hotspot is opened, the sending end shares the file with the receiving end after the receiving end connects to the network sharing hotspot.
S1017, the sending end opens the network sharing hotspot under the condition that the network sharing hotspot is not opened.
Further, after the receiving end is connected with the network sharing hotspot, the sending end shares the file with the receiving end.
And S1018, when the sharing is finished, the sending end closes the network sharing hotspot.
Fig. 8 is a diagram illustrating an exemplary processing flow of a receiving end in a Wi-Fi P2P-based data transmission method according to an embodiment of the present application. As shown in fig. 8, the processing flow of the transmitting end includes steps S2011-S2019. It is understood that the main body of the processing flow is a receiving end, such as the electronic device 2.
S2011, the receiving end and the sending end have established a basic communication connection.
Illustratively, the base communication connection may be a bluetooth connection.
S2012, the receiving end obtains the handle of the WLAN connection.
Illustratively, the receiving end may receive a Wi-Fi P2P connection establishment request sent by the sending end, and the Wi-Fi P2P connection establishment request may include a handle of the WLAN connection. The handle of the WLAN connection may include information parameters related to the Wi-Fi P2P connection.
S2013, the receiving end obtains the available wireless network card.
S2014, the receiving end disconnects the current hot spot.
S2015, the receiving end scans a Wi-Fi network sharing hotspot of the sending end through the WLAN module.
S2016, the receiving end sets configuration information for connecting the network sharing hot spot.
And S2017, connecting the receiving terminal to the network sharing hotspot.
And S2018, the receiving end receives the file shared by the sending end.
And S2019, when the sharing is finished, the receiving end disconnects the network sharing hotspot.
In this application embodiment, under the condition that both the sending end device and the receiving end device are networked, when a virtual AP is created as a wireless hotspot by the receiving end device, the sending end device and the receiving end device not only can establish a P2P channel and share data through the P2P channel, but also can transmit internet data of the sending end device through the P2P channel, that is, the sending end device can be networked through an AP to which the receiving end device is correspondingly connected, so that both the sending end device and the receiving end device can continue to surf the internet, and the interactive experience of the devices is improved.
It should be noted that, in the first embodiment, the virtual AP is created by the electronic device 1 at the sending end as an example, and it can be understood that, in actual implementation, when both the sending end device and the receiving end device are networked, and a user triggers the electronic device 1 to share data to the electronic device 2 in a P2P manner, the electronic device 2 at the receiving end may also create the virtual AP as a wireless hot spot; the electronic device 1 connects to the virtual AP created by the electronic device 2 in a STA role, so that a P2P channel is established between the transmitting end and the receiving end.
Under the condition that the electronic device 1 is connected to the virtual AP created by the electronic device 2, the electronic device 1 may display networking prompt information, where the networking prompt information is used to prompt the electronic device 1 to implement internet surfing through the wireless hotspot corresponding to the electronic device 2. For a specific implementation manner that the receiving end device creates the virtual AP and establishes the P2P channel with the sending end device through the virtual AP, reference may be made to the description of fig. 3, which is not described herein again.
The method steps for creating the virtual AP by the receiving end device are further described below with reference to fig. 9. Fig. 9 is a schematic block diagram of another Wi-Fi P2P-based data transmission method according to the first embodiment of the present application.
Fig. 9 (a) is the same as that shown in fig. 6 (a), and both the electronic apparatus 1 and the electronic apparatus 2 are networked. When the user triggers the electronic device 1 to share data to the electronic device 2 in a P2P manner, the electronic device 1 at the transmitting end may negotiate with the electronic device 2 at the receiving end about establishing the P2P channel.
As shown in fig. 9 (b), the electronic device 2 on the receiving side may create a virtual AP (i.e., SoftAP) as a wireless hot spot. The electronic device 1 at the transmitting end may connect to the SoftAP created by the electronic device 2 as an STA role, so that the electronic device 1 and the electronic device 2 establish a P2P channel (including a shared data channel and an internet data channel).
Referring to fig. 9 (a) and (b), the first Wi-Fi network of the transmitting end is disconnected, and the second Wi-Fi network of the receiving end remains; and a fourth Wi-Fi network is newly established between the sending end equipment and the receiving end equipment. Based on the newly-built fourth Wi-Fi network, not only data sharing can be carried out between the sending end device and the receiving end device, but also internet surfing data of the sending end device can be transmitted, wherein the internet surfing data of the sending end device can be transmitted to the receiving end device through the internet surfing data channel, and then the sending end device and the receiving end device interact through the second AP. That is to say, the sending end device may be networked through the AP to which the receiving end device is correspondingly connected, so that the internet access service of the sending end device is not affected.
Second embodiment
The second embodiment mainly describes how to perform data transmission between the sending end device and the receiving end device through Wi-Fi P2P and how to achieve the purpose of uninterrupted internet access service of the networked devices in a scenario where only one of the sending end device and the receiving end device is networked.
Fig. 10 is a flowchart illustrating a data transmission method based on Wi-Fi P2P according to a second embodiment of the present application. Referring to FIG. 10, the method 200 includes steps S201 and S202A-S205A described below, or includes steps S201 and S202B-S205B.
S201, the electronic device 1 receives a first operation of a user, where the first operation is used to trigger the electronic device 1 to send first data to the electronic device 2 in a P2P transmission manner.
For the first operation, the bluetooth connection establishment, and the negotiation for establishing the P2P channel, reference may be made to the detailed description of the first operation in the first embodiment, and details are not repeated herein.
After step S201, if the electronic device 1 is already networked and the electronic device 2 is not networked, steps S202A-S205A described below are continuously performed; or to continue to perform steps S202B-S205B described below in the case where electronic device 1 is not networked and electronic device 2 is networked.
S202A, if the electronic device 1 is connected to the first AP and the electronic device 2 is not networked, the electronic device 1 creates a virtual AP.
S203A, the electronic device 1 and the electronic device 2 establish a P2P channel based on the virtual AP.
It is understood that the electronic device 1 is connected to the first AP and the electronic device 2 is not networked, which indicates that only the electronic device 1 of the electronic devices 1 and 2 is networked, that is, only the sending end device of the sending end device and the receiving end device is networked.
In this embodiment of the application, when the electronic device 1 receives the first operation of the user, the electronic device 1 and the electronic device 2 may first establish a bluetooth connection channel, and then perform information interaction based on the bluetooth connection channel, negotiate to establish a virtual AP as a wireless hotspot by the networked device at the end. Specifically to the second embodiment, since the electronic device 1 as the transmitting end is already networked, the electronic device 1 may create a virtual AP as a wireless hotspot.
Illustratively, when the electronic device 1 receives the first operation of the user, the electronic device 1 first discovers the electronic device 2 by broadcasting, scanning, etc., and then the electronic device 1 may directly initiate establishing the P2P channel with the electronic device 2. Wherein, because the electronic device 1 is networked, the electronic device 1 creates a virtual AP as a wireless hotspot; the electronic device 2, acting as an STA, connects to the virtual AP created by the electronic device 1. It can be understood that in the case where the electronic device 2 is connected to the virtual AP created by the electronic device 1, the electronic device 1 and the electronic device 2 successfully establish the P2P tunnel.
S204A, the electronic device 1 transmits the first data to the electronic device 2 through the P2P channel.
S205A, the electronic device 1 interacts data with the network side through the first AP.
The electronic device 1 can not only serve as an STA role, but also interact data with a network side through the first AP; furthermore, the electronic device 1 may also establish a P2P channel with the electronic device 2 in the role of STA as a virtual AP and perform data transmission. That is to say, according to the scheme of the application, while the electronic device serves as an STA role to communicate with the AP, the electronic device can serve as a virtual AP role to establish a P2P channel with other devices, so that end-to-end data transmission is achieved, and in this case, communication (i.e., internet access service) between the electronic device and the AP is not affected, so that multi-device interactive experience can be improved.
Optionally, in a case that the electronic device 2 is connected to the virtual AP created by the electronic device 1, the electronic device 2 may also implement internet access through a wireless hotspot corresponding to the electronic device 1.
In some embodiments, the electronic device 2 may display a networking prompt message, where the networking prompt message is used to prompt that the electronic device 2 can surf the internet through the wireless hotspot corresponding to the electronic device 1.
In some embodiments, the networking prompt may include an option to confirm networking and an option to disable networking for selection by the user.
On one hand, in response to the user confirming the networking operation on the electronic device 2, the electronic device 2 may surf the internet through the wireless hotspot. In this case, the P2P channel established between the electronic device 1 and the electronic device 2 can be used as two logical channels in a specific application: one of the logic channels is an internet data channel and is used for transmitting internet data of the electronic device 2; the other logical channel, namely the sharing channel, is only used for transmitting the first data.
On the other hand, in response to the user's prohibition of networking on the electronic device 2, the electronic device 2 may not surf the internet through the wireless hotspot. In this case, the P2P channel, i.e. the sharing channel, established between the electronic device 1 and the electronic device 2 is only used for transmitting the first data.
The above steps S202A-S205A describe that, in the case that the sender device is networked, the sender device may create a virtual AP as a wireless hotspot, and then the receiver device connects to the wireless hotspot, so that a P2P channel is successfully established between the devices, and end-to-end data transmission is achieved. The following describes how to establish the P2P channel in the case that the sink device is already networked in conjunction with steps S202B-S205B.
S202B, if the electronic device 1 is not networked and the electronic device 2 is connected to the second AP, the electronic device 2 creates a virtual AP.
S203B, the electronic device 1 and the electronic device 2 establish a P2P channel based on the virtual AP.
It is understood that the electronic device 1 is not networked and the electronic device 2 is connected to the second AP, which indicates that only the electronic device 2 of the electronic devices 1 and 2 is networked, that is, only the receiving device of the transmitting device and the receiving device is networked.
In this embodiment of the application, when the electronic device 1 receives the first operation of the user, the electronic device 1 and the electronic device 2 may first establish a bluetooth connection channel, and then perform information interaction based on the bluetooth connection channel, negotiate to establish a virtual AP as a wireless hotspot by the networked device at the end. Specifically to the second embodiment, since the electronic device 2 as the receiving end is already networked, the electronic device 2 may create a virtual AP as a wireless hotspot.
Illustratively, when the electronic device 1 receives the first operation of the user, the electronic device 1 first discovers the electronic device 2 through the bluetooth technology, and then the electronic device 1 negotiates with the electronic device 2 to establish the P2P channel. The electronic device 2 is networked, and the electronic device 2 can create a virtual AP as a wireless hotspot; the electronic device 1, acting as an STA, connects to the virtual AP created by the electronic device 2. It can be understood that, in the case where the electronic device 1 is connected to the virtual AP created by the electronic device 2, the electronic device 1 and the electronic device 2 successfully establish the P2P tunnel.
S204B, the electronic device 1 transmits the first data to the electronic device 2 through the P2P channel.
S205B, the electronic device 2 interacts data with the network side through the second AP.
The electronic device 2 can not only serve as an STA role, but also interact with the network side through the second AP; furthermore, the electronic device 2 may also establish a P2P channel with the electronic device 1 in the role of STA as a virtual AP and perform data transmission.
Optionally, in this embodiment of the application, when the electronic device 1 is connected to the virtual AP created by the electronic device 2, the electronic device 1 may also implement internet surfing through a wireless hotspot corresponding to the electronic device 2.
In some embodiments, the electronic device 1 may display a networking prompt message, where the networking prompt message is used to prompt the electronic device 1 to surf the internet through the wireless hotspot corresponding to the electronic device 2.
In some embodiments, the networking prompt may include an option to confirm networking and an option to disable networking for selection by the user.
In one aspect, in response to a confirmation of a networking operation by the user on the electronic device 1, the electronic device 1 may be networked through a corresponding wireless hotspot of the electronic device 2. In this case, the P2P channel established between the electronic device 1 and the electronic device 2 may be used as two logical channels in a specific application: one of the logic channels is an internet data channel and is used for transmitting internet data of the electronic device 2; the other logic channel is a sharing channel and is used for transmitting the first data.
On the other hand, in response to the user's prohibition of networking operations on the electronic device 1, the electronic device 1 may not be networked through the corresponding wireless hotspot of the electronic device 2. In this case, the P2P channel, i.e., the sharing channel, established between the electronic device 1 and the electronic device 2 is only used for transmitting the first data.
Through the above steps S202B-S205B, under the condition that the receiving end device is networked, the receiving end device may create a virtual AP as a wireless hotspot, and then the sending end device connects to the wireless hotspot, so that a P2P channel is successfully established between the devices, and end-to-end data transmission is implemented.
According to the scheme of the application, the electronic device can serve as a virtual AP role to establish a P2P channel with other devices while serving as an STA role to communicate with the AP, end-to-end data transmission is achieved, and communication (namely internet access service) between the electronic device and the AP is not affected under the condition, so that multi-device interaction experience can be improved.
The method steps for creating a virtual AP by a sender as described in fig. 10 above are further described below with reference to fig. 11. Fig. 11 is a schematic block diagram of a data transmission method based on Wi-Fi P2P according to a second embodiment of the present application.
As shown in fig. 11 (a), the electronic device 1 connects to the first AP as an STA role, thereby forming a first Wi-Fi network through which the electronic device 1 can connect to the internet. The electronic device 2 is not networked.
As shown in fig. 11 (b), when the user triggers the electronic device 1 to share data to the electronic device 2 in a P2P manner, the electronic device 1 at the sending end may create a virtual AP (i.e., SoftAP) as a wireless hotspot. The electronic device 2 at the receiving end may be connected to the SoftAP created by the electronic device 1 in a STA role, so that the electronic device 1 and the electronic device 2 establish a P2P channel (including a shared data channel and an internet data channel).
As shown in (a) and (b) of fig. 11, the first Wi-Fi network of the transmitting end still remains, and a fifth Wi-Fi network is newly established between the transmitting end device and the receiving end device. Based on the newly-built fifth Wi-Fi network, data sharing can be performed between the sending end device and the receiving end device, internet surfing data of the receiving end device can also be transmitted, wherein the internet surfing data of the receiving end device can be sent to the sending end device through the internet surfing data channel, and then interaction with the internet side is performed through the first AP. That is to say, the receiving end device may implement networking through the AP to which the sending end device is correspondingly connected.
In this embodiment of the application, under the condition that the sending end device is networked and the receiving end device is not networked, the sending end device may create the virtual AP as the wireless hotspot, and thus the sending end device and the receiving end device may establish a P2P channel based on the wireless hotspot, and the data sharing may be implemented through the P2P channel, and the internet access capability may also be provided for the receiving end device, and the original internet access service of the sending end device may not be affected, so that the interactive experience of the device may be improved.
The method steps for creating a virtual AP by a receiving end described in fig. 10 above are further described below with reference to fig. 12. Fig. 12 is a schematic block diagram of another Wi-Fi P2P-based data transmission method according to the second embodiment of the present application.
As shown in fig. 12 (a), the electronic apparatus 1 is not networked. The electronic device 2 connects to the second AP in a STA role, thereby forming a second Wi-Fi network through which the electronic device 2 can connect to the internet. When the user triggers the electronic device 1 to share data to the electronic device 2 in a P2P manner, the electronic device 1 at the transmitting end may negotiate with the electronic device 2 at the receiving end about establishing the P2P channel.
As shown in fig. 12 (b), the electronic device 2 on the receiving side may create a virtual AP (i.e., SoftAP) as a wireless hot spot. The electronic device 1 at the sending end may connect to the SoftAP created by the electronic device 2 as a STA role, so that the electronic device 1 and the electronic device 2 establish a P2P channel (including a shared data channel and an internet data channel).
As shown in (a) and (b) of fig. 12, the second Wi-Fi network of the receiving end still remains, and a sixth Wi-Fi network is newly established between the transmitting end device and the receiving end device. Based on the newly-built sixth Wi-Fi network, the sending end device and the receiving end device can share data and can transmit internet surfing data of the sending end device, wherein the internet surfing data of the sending end device can be sent to the receiving end device through the internet surfing data channel and then interacts with the internet side through the second AP. That is, the sending end device may implement networking through the AP to which the receiving end device is correspondingly connected.
In this embodiment of the application, under the condition that the sending end device is not networked and the receiving end device is already networked, the receiving end device may create the virtual AP as the wireless hotspot, and thus the sending end device and the receiving end device may establish a P2P channel based on the wireless hotspot, and the data sharing may be implemented through the P2P channel, and the sending end device may also provide the internet access capability, and the original internet access service of the receiving end device may not be affected, so as to improve the device interaction experience.
Third embodiment
The third embodiment mainly describes how data transmission is performed between a sending end device and a receiving end device through Wi-Fi P2P in a scenario where neither the sending end device nor the receiving end device is networked.
Fig. 13 is a flowchart illustrating a data transmission method based on Wi-Fi P2P according to a third embodiment of the present application. Referring to FIG. 13, the method 300 includes steps S301-S304 described below.
S301, the electronic device 1 receives a first operation of the user, where the first operation is used to trigger the electronic device 1 to send first data to the electronic device 2 in a P2P manner.
The electronic device 1 and the electronic device 2 are devices to which a Windows system is applied. Electronic device 1 and electronic device 2 support the Wi-Fi P2P protocol. For the first operation, the bluetooth connection establishment, and the negotiation for establishing the P2P channel, reference may be made to the detailed description of the first operation in the first embodiment, and details are not described herein again.
That is, after step S301, in a case where the electronic device 1 and the electronic device 2 are not networked, the execution of step S302A or S302B described below is continued, i.e., the execution of S302A or S302B is selected.
S302A, if neither electronic device 1 nor electronic device 2 is networked, then electronic device 1 creates a virtual AP.
S302B, if neither electronic device 1 nor electronic device 2 is networked, then electronic device 2 creates a virtual AP.
S303, the electronic device 1 and the electronic device 2 establish a P2P channel based on the virtual AP.
S304, the electronic device 1 transmits the first data to the electronic device 2 through the P2P channel.
Under the condition that the electronic equipment 1 and the electronic equipment 2 are not connected to the network, the electronic equipment 1 at the sending end can create a virtual AP as a wireless hotspot; the electronic device 2 at the receiving end is connected to the wireless hotspot as an STA role, and the electronic device 1 and the electronic device 2 thereby establish a P2P channel and perform end-to-end data transmission through the P2P channel. Or, the electronic device 2 at the receiving end may create a virtual AP as a wireless hotspot; the electronic device 1 at the sending end, acting as an STA, connects to the wireless hotspot, so that the electronic device 1 and the electronic device 2 establish a P2P channel, and perform end-to-end data transmission through the P2P channel.
The method steps for creating a virtual AP by a receiving end as described in fig. 13 above are further described with reference to fig. 14. Fig. 14 is a schematic block diagram of a data transmission method based on Wi-Fi P2P according to a third embodiment of the present application.
As shown in fig. 14 (a), neither the electronic apparatus 1 nor the electronic apparatus 2 is networked.
When the user triggers the electronic device 1 to share data to the electronic device 2 in a P2P manner, the electronic device 1 at the transmitting end may negotiate with the electronic device 2 at the receiving end about establishing the P2P channel.
As shown in fig. 14 (b), a virtual AP (i.e., SoftAP) may be created by the electronic device 1 at the transmitting end as a wireless hot spot. The electronic device 2 on the receiving side may connect to the SoftAP created by the electronic device 1 in the STA role, so that the electronic device 1 and the electronic device 2 establish a P2P channel (including a shared data channel). And a seventh Wi-Fi network is newly established between the sending end equipment and the receiving end equipment. And based on the newly-built seventh Wi-Fi network, data sharing can be performed between the sending end device and the receiving end device.
Alternatively, as shown in fig. 14 (c), a virtual AP (i.e., SoftAP) may be created by the electronic device 2 at the receiving end as a wireless hot spot. The electronic device 1 on the transmitting side may connect to the SoftAP created by the electronic device 2 in the STA role, so that the electronic device 1 and the electronic device 2 establish a P2P channel (including a shared data channel). An eighth Wi-Fi network is newly established between the sending end device and the receiving end device. And based on the newly-built eighth Wi-Fi network, data sharing can be performed between the sending end device and the receiving end device.
In this embodiment of the application, under the condition that neither the sending end device nor the receiving end device is networked, a virtual AP may be created by any one of the sending end device and the receiving end device as a wireless hotspot, and thus, the sending end device and the receiving end device may establish a P2P channel based on the wireless hotspot, and data sharing may be achieved through the P2P channel, so that device interaction experience may be improved.
In summary, the three embodiments take three application scenarios as examples, and the data transmission method based on Wi-Fi P2P provided in the embodiments of the present application is exemplarily described.
Scene one: under the condition that a sending end and a receiving end are respectively connected with an AP (access point) for surfing the Internet, if the sending end and the receiving end both need a Wi-Fi direct channel to exchange personal data, the sending end establishes the Wi-Fi channel in a SoftAP role and the receiving end in an STA role, so that the sending end can provide the Internet surfing capability for the receiving end; or the receiving end establishes the Wi-Fi channel in a SoftAP role and the sending end in an STA role, so that the receiving end can provide internet access capability for the sending end. Therefore, shared data can be transmitted on the same P2P channel, and both end devices can be ensured to be on the internet.
Scene two: under the condition that only one of the sending end and the receiving end is accessed to the network, one end of the accessed network has a SoftAP role, one end of the unaccessed network has an STA role, and the sending end and the receiving end can only share file data on the established Wi-Fi P2P channel. Meanwhile, the established P2P channel does not affect the internet access state of the device at the end of the accessed network.
Scene three: under the condition that the sending end and the receiving end are not connected with the network, the receiving end is used as an STA role and the sending end is used as a SoftAP role, or the sending end is used as the STA role and the receiving end is used as the SoftAP role, and the sending end and the receiving end can only share file data on the established Wi-Fi P2P channel.
Through the embodiment of the application, on a Wi-Fi P2P channel for transmitting and receiving shared data by two parties, one device can use a hot spot of the other device, and the device can still have internet surfing capability while transmitting data. Therefore, the problem that when a large amount of data is transmitted between two Windows system devices in a wireless mode, the devices cannot be connected with a hot spot to surf the internet after a Wi-Fi P2P channel is established is solved.
In some embodiments, for a scenario that cross-device wireless data transmission cannot be established in a Wi-Fi P2P GO-GC manner, and each device also has a request for connecting an AP hotspot internet surfing, the scheme provided by the embodiments of the present application may also be used, and the transmitting end and the receiving end may share file data and share internet surfing capability on an established Wi-Fi P2P channel.
In some embodiments, the scheme provided by the embodiment of the application can also be applied to two Surface devices with Windows systems, and the sending end and the receiving end can share file data and share internet surfing capability on the established Wi-Fi P2P channel.
It should also be noted that in the embodiments of the present application, "greater than" may be replaced by "greater than or equal to" and "less than or equal to" may be replaced by "less than", or "greater than or equal to" may be replaced by "greater than" and "less than" may be replaced by "less than or equal to".
The various embodiments described herein may be implemented as stand-alone solutions or combined in accordance with inherent logic and are intended to fall within the scope of the present application.
It is to be understood that the methods and operations implemented by the electronic device in the above method embodiments may also be implemented by components (e.g., chips or circuits) that can be used in the electronic device.
Embodiments of the methods provided herein are described above, and embodiments of the apparatus provided herein are described below. It should be understood that the description of the apparatus embodiments corresponds to the description of the method embodiments, and therefore, for brevity, details are not repeated here, since the details that are not described in detail may be referred to the above method embodiments.
The solutions provided by the embodiments of the present application have been described above primarily in terms of method steps. It is understood that, in order to implement the above functions, the electronic device implementing the method includes corresponding hardware structures and/or software modules for performing the respective functions. Those of skill in the art would appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is performed in hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
According to the method example, the electronic device may be divided into the functional modules, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, the division of the modules in the embodiment of the present application is schematic, and is only one logical function division, and other feasible division manners may be available in actual implementation. The following description will be given taking the example of dividing each functional module corresponding to each function.
Fig. 15 is a schematic block diagram of a Wi-Fi P2P-based data transmission device 800 according to an embodiment of the present application. The apparatus 800 may be used to perform the actions performed by the electronic device in the above method embodiments. The apparatus 800 includes a detection unit 810 and a Wi-Fi unit 820.
The detecting unit 810 is configured to receive a sharing operation of a user, where the sharing operation is used to trigger the first electronic device to send first data to be shared to the second electronic device in a point-to-point P2P transmission manner; the first electronic equipment is connected to the first access point, and the second electronic equipment is connected to the second access point;
a Wi-Fi unit 820 configured to, in response to the sharing operation, create a virtual access point by the first electronic device;
a Wi-Fi unit 820 further configured to establish a P2P channel between the first electronic device and the second electronic device based on the virtual access point;
the Wi-Fi unit 820 is further configured to transmit first data and internet data of the second electronic device between the first electronic device and the second electronic device through the P2P channel;
the first electronic device and the second electronic device are both electronic devices which do not support dual-frequency and dual-emission but support Wi-Fi P2P function.
Alternatively, the first electronic device and the second electronic device may both be devices installed with Windows systems.
According to the scheme, in a scene that Wi-Fi direct connection is needed between two electronic devices to transmit data, the networked electronic devices can create a virtual AP as a wireless hotspot, and another electronic device can be connected to the wireless hotspot as an STA role, so that a Wi-Fi P2P direct connection channel is established between the sending end device and the receiving end device. Through the Wi-Fi P2P direct connection channel, shared data can be transmitted, internet surfing data can also be transmitted, and therefore the devices at two ends can still have internet surfing capability while transmitting data. Therefore, the problem that the equipment cannot be connected with a hot spot to surf the internet after a Wi-Fi P2P direct connection channel is established between two pieces of electronic equipment is solved.
The apparatus 800 according to the embodiment of the present application may correspond to performing the method described in the embodiment of the present application, and the above and other operations and/or functions of the units in the apparatus 800 are respectively for implementing corresponding flows of the method, and are not described herein again for brevity.
Fig. 16 is a schematic structural diagram of an electronic device 900 provided in an embodiment of the present application. The electronic device 900 may include a processor 910, an external memory interface 920, an internal memory 921, a Universal Serial Bus (USB) interface 930, a charging management module 940, a power management unit 941, a battery 942, an antenna 1, an antenna 2, a mobile communication module 950, a wireless communication module 960, an audio module 970, a speaker 970A, a receiver 970B, a microphone 970C, an earphone interface 970D, a sensor module 980, a button 990, a motor 991, an indicator 992, a camera 993, a display 994, and a Subscriber Identification Module (SIM) card interface 995, etc. Wherein sensor module 980 may include a pressure sensor 980A, a gyroscope sensor 980B, a barometric sensor 980C, a magnetic sensor 980D, an acceleration sensor 980E, a distance sensor 980F, a proximity light sensor 980G, a fingerprint sensor 980H, a temperature sensor 980I, a touch sensor 980J, an ambient light sensor 980K, and a bone conduction sensor 980L, among others.
It is to be understood that the illustrated structure of the embodiments of the present application does not constitute a specific limitation to the electronic device 900. In other embodiments of the present application, electronic device 900 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 910 may include one or more processing units, such as: the processor 910 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors. The controller may be, among other things, a neural center and a command center of the electronic device 900. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 910 for storing instructions and data. In some embodiments, the memory in the processor 910 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 910. If the processor 910 needs to reuse the instruction or data, it can be called directly from memory. Avoiding repeated accesses reduces the latency of the processor 910, thereby increasing the efficiency of the system.
In some embodiments, processor 910 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (mobile industry processor interface, GPIO), a general-purpose-input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, a bus/Universal Serial Bus (USB) interface, and/or the like. It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present application is only an illustration, and does not limit the structure of the electronic device 900. In other embodiments of the present application, the electronic device 900 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 940 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 940 may receive charging input from a wired charger via the USB interface 930. In some wireless charging embodiments, the charging management module 940 may receive wireless charging input through a wireless charging coil of the electronic device 900. The charging management module 940 can also supply power to the electronic device through the power management unit 941 while charging the battery 942.
The power management unit 941 is used to connect the battery 942, the charging management module 940 and the processor 910. The power management unit 941 receives input from the battery 942 and/or the charging management module 940, and provides power to the processor 910, the internal memory 921, the external memory, the display 994, the camera 993, the wireless communication module 960, and the like. The power management unit 941 can also be used to monitor battery capacity, battery cycle number, battery state of health (leakage, impedance), etc. In other embodiments, the power management unit 941 may also be disposed in the processor 910. In other embodiments, the power management unit 941 and the charging management module 940 may be disposed in the same device.
The wireless communication function of the electronic device 900 may be implemented by the antenna 1, the antenna 2, the mobile communication module 950, the wireless communication module 960, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 900 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 950 may provide a solution for wireless communication including 2G/3G/4G/5G, etc. applied to the electronic device 900. The mobile communication module 950 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 950 can receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 950 can also amplify the signal modulated by the modem processor and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 950 may be disposed in the processor 910. In some embodiments, at least some of the functional blocks of the mobile communication module 950 may be provided in the same device as at least some of the blocks of the processor 910.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 970A, the receiver 970B, etc.) or displays an image or video through the display screen 994. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be separate from the processor 910 and may be located in the same device as the mobile communication module 950 or other functional modules.
The wireless communication module 960 may provide a solution for wireless communication applied on the electronic device 900, including WLAN (e.g., Wi-Fi), BT, Global Navigation Satellite System (GNSS), FM, NFC, IR, or general 2.4G/5G wireless communication technologies. The wireless communication module 960 may be one or more devices integrating at least one communication processing module. The wireless communication module 960 receives an electromagnetic wave via the antenna 2, performs frequency modulation and filtering on an electromagnetic wave signal, and transmits the processed signal to the processor 910. The wireless communication module 960 may also receive signals to be transmitted from the processor 910, frequency-modulate and amplify the signals, and convert the signals into electromagnetic waves via the antenna 2 to radiate the electromagnetic waves.
In some embodiments, the wireless communication module 960 may be a Wi-Fi and/or Bluetooth chip. The electronic device 900 may establish a connection with a chip of an electronic device such as a wireless headset through the chip, so as to implement wireless communication and service processing between the electronic device 900 and other electronic devices through the connection. The Bluetooth chip can generally support BR/EDR Bluetooth and BLE.
In some embodiments, antenna 1 of electronic device 900 is coupled to mobile communication module 950 and antenna 2 is coupled to wireless communication module 960 so that electronic device 900 may communicate with networks and other devices via wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), General Packet Radio Service (GPRS), code division multiple access (code division multiple access, CDMA), Wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (TDSCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technologies, and the like. GNSS may include Global Positioning System (GPS), global navigation satellite system (GLONASS), beidou satellite navigation system (BDS), quasi-zenith satellite system (QZSS), and/or Satellite Based Augmentation System (SBAS).
The electronic device 900 implements display functions via the GPU, the display screen 994, and the application processor, among other things. The GPU is a microprocessor for image processing, and is connected to the display screen 994 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 910 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 994 is used to display images, video, and the like. The display screen 994 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the electronic device 900 may include 1 or N display screens 994, N being a positive integer greater than 1.
The electronic device 900 may implement a shooting function through an ISP, a camera 993, a video codec, a GPU, a display screen 994, an application processor, and the like.
The ISP is used to process data fed back by the camera 993. For example, when a photo is taken, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converting into an image visible to naked eyes. The ISP can also carry out algorithm optimization on noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in the camera 993.
The camera 993 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, the electronic device 900 may include 1 or N cameras 993, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the electronic device 900 selects at a frequency bin, the digital signal processor is used to perform a fourier transform or the like on the frequency bin energy.
Video codecs are used to compress or decompress digital video. The electronic device 900 may support one or more video codecs. In this way, electronic device 900 may play or record video in a variety of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. Applications such as intelligent cognition of the electronic device 900 can be achieved through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 920 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device 900. The external memory card communicates with the processor 910 through the external memory interface 920 to implement a data storage function. For example, files such as music, video, etc. are saved in the external memory card.
The internal memory 921 may be used to store computer-executable program code, which includes instructions. The processor 910 executes various functional applications of the electronic device 900 and data processing by executing instructions stored in the internal memory 921. The internal memory 921 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, and the like) required by at least one function, and the like. The data storage area may store data created during use of the electronic device 900 (e.g., audio data, phone book, etc.), and the like. In addition, the internal memory 921 may include a high-speed random access memory, and may also include a nonvolatile memory such as at least one of a magnetic disk storage device, a flash memory device, a Universal Flash Storage (UFS), and the like.
The processor 910 can be configured to execute the program code, and call the relevant modules to implement the functions of the electronic device in the embodiment of the present application. For example, establishing a plurality of communication links with another electronic device; when a preset service (such as a file transfer service) exists, data of the preset service is transmitted with another electronic device through a plurality of communication links.
The electronic device 900 may implement audio functions through a speaker 970A, a receiver 970B, a microphone 970C, an earphone interface 970D, an application processor, etc. in the audio module 970. Such as music playing, recording, etc.
The audio module 970 is used to convert digital audio information into an analog audio signal output and also used to convert an analog audio input into a digital audio signal. The audio module 970 may also be used to encode and decode audio signals. In some embodiments, the audio module 970 may be disposed in the processor 910, or some functional modules of the audio module 970 may be disposed in the processor 910.
The speaker 970A, also called a "horn", is used to convert audio electrical signals into sound signals. The electronic device 900 may listen to music through the speaker 970A or listen to a hands-free call.
Receiver 970B, also referred to as an "earpiece," is used to convert the electrical audio signal into an acoustic signal. When the electronic device 900 receives a call or voice information, it can receive voice by placing the receiver 970B close to the ear of the person.
Microphone 970C, also referred to as a "microphone," is used to convert acoustic signals into electrical signals. When making a call or sending voice information, the user can input a voice signal into the microphone 970C by making a sound by approaching the microphone 970C through the mouth of the user. The electronic device 900 may be provided with at least one microphone 970C. In other embodiments, the electronic device 900 may be provided with two microphones 970C to achieve a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 900 may further include three, four or more microphones 970C to collect sound signals, reduce noise, identify sound sources, perform directional recording, and so on.
The earphone interface 970D is used to connect a wired earphone. The headset interface 970D may be the USB interface 930, or may be a 3.5mm open mobile electronic device platform (OMTP) standard interface, a cellular telecommunications industry association (cellular telecommunications industry association) standard interface of the USA.
The pressure sensor 980A is configured to sense a pressure signal, which can be converted to an electrical signal. In some embodiments, pressure sensor 980A may be disposed on display screen 994. Pressure sensor 980A can be of a wide variety, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a sensor comprising at least two parallel plates having an electrically conductive material. When a force acts on the pressure sensor 980A, the capacitance between the electrodes changes. The electronic device 900 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 994, the electronic apparatus 900 detects the intensity of the touch operation based on the pressure sensor 980A. The electronic device 900 may also calculate the location of the touch based on the detection signal of the pressure sensor 980A. In some embodiments, the touch operations that are applied to the same touch position but different touch operation intensities may correspond to different operation instructions. For example: and when the touch operation with the touch operation intensity smaller than the first pressure threshold value acts on the short message application icon, executing an instruction for viewing the short message. And when the touch operation with the touch operation intensity larger than or equal to the first pressure threshold value acts on the short message application icon, executing an instruction of newly building the short message.
The gyro sensor 980B may be used to determine the motion pose of the electronic device 900. In some embodiments, the angular velocity of electronic device 900 about three axes (e.g., x, y, and z axes) may be determined by gyroscope sensor 980B. The gyro sensor 980B may be used for photographing anti-shake. Illustratively, when the shutter is pressed, the gyro sensor 980B detects the shake angle of the electronic device 900, calculates the distance to be compensated for by the lens module according to the shake angle, and enables the lens to counteract the shake of the electronic device 900 through reverse movement, thereby achieving anti-shake. The gyroscope sensor 980B can also be used for navigation, body sensing game scenes.
Acceleration sensor 980E may detect the magnitude of acceleration of electronic device 900 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the electronic device 900 is stationary. The method can also be used for recognizing the posture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
The distance sensor 980F is used to measure distance. The electronic device 900 may measure distance by infrared or laser. In some embodiments, taking a picture of a scene, electronic device 900 may utilize range sensor 980F to measure distances to achieve fast focus.
The proximity light sensor 980G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 900 emits infrared light outward through the light emitting diodes. The electronic device 900 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it may be determined that there is an object near the electronic device 900. When insufficient reflected light is detected, the electronic device 900 can determine that there are no objects near the electronic device 900. The electronic device 900 may utilize the proximity light sensor 980G to detect that the user is holding the electronic device 900 close to the ear for a call, so as to automatically turn off the screen to save power. The proximity light sensor 980G can also be used in holster mode, pocket mode auto unlock and lock screen.
The ambient light sensor 980K is used to sense ambient light brightness. The electronic device 900 may adaptively adjust the brightness of the display 994 based on the perceived ambient light brightness. The ambient light sensor 980K may also be used to automatically adjust the white balance when taking a picture. Ambient light sensor 980K may also cooperate with proximity light sensor 980G to detect whether electronic device 900 is in a pocket to prevent inadvertent touches.
Barometric pressure sensor 980C is used to measure barometric pressure. In some embodiments, electronic device 900 calculates altitude, aiding in positioning and navigation, from barometric pressure values measured by barometric pressure sensor 980C.
The magnetic sensor 980D includes a hall sensor. The electronic device 900 may detect displacement of the electronic device 900 using the magnetic sensor 980D. In some embodiments, the hall sensor may form a linear trapezoidal magnetic field (or called a ramp magnetic field) by using the magnet, a displacement change of the hall plate in the linear magnetic field is consistent with a magnetic field intensity change, a formed hall potential is also proportional to the displacement, and the electronic device 900 obtains the hall potential to measure the displacement.
The fingerprint sensor 980H is used to capture a fingerprint. The electronic device 900 may utilize the collected fingerprint characteristics to implement fingerprint unlocking, access an application lock, fingerprint photographing, fingerprint answering, and the like.
The temperature sensor 980I is used to detect temperature. In some embodiments, the electronic device 900 implements a temperature handling strategy using the temperature detected by the temperature sensor 980I. For example, when the temperature reported by temperature sensor 980I exceeds a threshold, electronic device 900 performs a reduction in performance of a processor located near temperature sensor 980I to reduce power consumption and implement thermal protection. In other embodiments, the electronic device 900 heats the battery 942 when the temperature is below another threshold to avoid low temperatures causing the electronic device 900 to shut down abnormally. In other embodiments, the electronic device 900 performs a boost on the output voltage of the battery 942 when the temperature is below a further threshold to avoid an abnormal shutdown due to low temperature.
Touch sensor 980J, also referred to as a "touch panel". The touch sensor 980J may be disposed on the display screen 994, and the touch sensor 980J and the display screen 994 form a touch screen, which is also referred to as a "touch screen". The touch sensor 980J is used to detect a touch operation acting thereon or nearby. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 994. In other embodiments, the touch sensor 980J may be disposed on a surface of the electronic device 900 at a different location than the display screen 994.
Bone conduction sensor 980L can acquire a vibration signal. In some embodiments, the bone conduction sensor 980L can acquire vibration signals of the human voice vibrating bone mass. The bone conduction sensor 980L can also receive a blood pressure pulsation signal by contacting the human pulse. In some embodiments, the bone conduction sensor 980L may also be disposed in a headset, integrated into a bone conduction headset. The audio module 970 may analyze a voice signal based on the vibration signal of the bone mass vibrated by the sound part acquired by the bone conduction sensor 980L, thereby implementing a voice function. The application processor can analyze heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 980L, and the heart rate detection function is realized.
The keys 990 include a power-on key, a volume key, and the like. The keys 990 may be mechanical keys. Or may be touch keys. The electronic device 900 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 900.
The motor 991 may generate a vibration cue. The motor 991 may be used for incoming call vibration prompts, as well as for touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 991 may also respond to different vibration feedback effects when it is operated by touching different areas of the display screen 994. Different application scenarios (e.g., time reminding, receiving information, alarm clock, game, etc.) may also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The indicator 992 may be an indicator light, and may be used to indicate a charging state, a change in the amount of power, or may be used to indicate a message, a missed call, a notification, or the like.
The SIM card interface 995 is used to connect SIM cards. The SIM card can be brought into and out of contact with the electronic device 900 by being inserted into the SIM card interface 995 or being pulled out of the SIM card interface 995. The electronic device 900 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 995 may support a Nano SIM card, a Micro SIM card, a SIM card, etc. The same SIM card interface 995 can insert multiple cards at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 995 may also be compatible with different types of SIM cards. The SIM card interface 995 may also be compatible with external memory cards. The electronic device 900 interacts with the network through the SIM card to implement functions such as communication and data communication. In some embodiments, electronic device 900 employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the electronic device 900 and cannot be separated from the electronic device 900.
The electronic device 900 may be a mobile terminal or a non-mobile terminal. By way of example, the electronic device 900 may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted terminal, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), a wireless headset, a wireless bracelet, wireless smart glasses, a wireless watch, an Augmented Reality (AR)/Virtual Reality (VR) device, a desktop computer, a smart appliance (e.g., a television, a sound box, a refrigerator, an air purifier, an air conditioner, an electric rice cooker), and the like. The electronic device 900 may also be referred to collectively as an Internet of Things (IoT) device. The embodiment of the present application does not specifically limit the device type of the electronic device 900.
It should be understood that the electronic device 900 shown in fig. 16 may correspond to the apparatus 800 shown in fig. 15. The sensor module 980 and the wireless communication module 960 in the electronic device 900 shown in fig. 16 may correspond to the detection unit 810 and the Wi-Fi unit 820 in the apparatus 800 in fig. 15, respectively.
In actual implementation, the processor 910 executes the computer executable instructions in the memory 921 to perform the operational steps of the above-described method by the electronic device 900 when the electronic device 900 is running.
Optionally, in some embodiments, the present application provides a chip, which is coupled with a memory, and is configured to read and execute a computer program or instructions stored in the memory to perform the method in the foregoing embodiments.
Optionally, in some embodiments, the present application provides an electronic device comprising a chip for reading and executing a computer program or instructions stored by a memory, such that the methods in the embodiments are performed.
Optionally, in some embodiments, the present application further provides a computer-readable storage medium storing program code, which, when executed on a computer, causes the computer to perform the method in the foregoing embodiments.
Optionally, in some embodiments, the present application further provides a computer program product, which includes computer program code, when the computer program code runs on a computer, the computer is caused to execute the method in the foregoing embodiments.
In an embodiment of the application, an electronic device includes a hardware layer, an operating system layer running on top of the hardware layer, and an application layer running on top of the operating system layer. The hardware layer may include hardware such as a Central Processing Unit (CPU), a Memory Management Unit (MMU), and a memory (also referred to as a main memory). The operating system of the operating system layer may be any one or more computer operating systems that implement business processing through processes (processes), such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a windows operating system. The application layer may include applications such as a browser, an address book, word processing software, and instant messaging software.
The embodiment of the present application does not particularly limit a specific structure of an execution subject of the method provided by the embodiment of the present application, as long as communication can be performed by the method provided by the embodiment of the present application by running a program in which codes of the method provided by the embodiment of the present application are recorded. For example, an execution subject of the method provided by the embodiment of the present application may be an electronic device, or a functional module capable of calling a program and executing the program in the electronic device.
Various aspects or features of the disclosure may be implemented as a method, apparatus, or article of manufacture using standard programming and/or engineering techniques. The term "article of manufacture" as used herein is intended to encompass a computer program accessible from any computer-readable device, carrier, or media. For example, computer-readable media may include, but are not limited to: magnetic storage devices (e.g., hard disk, floppy disk, or magnetic tape), optical disks (e.g., Compact Disk (CD), Digital Versatile Disk (DVD), etc.), smart cards, and flash memory devices (e.g., erasable programmable read-only memory (EPROM), card, stick, or key drive, etc.).
Various storage media described herein can represent one or more devices and/or other machine-readable media for storing information. The term "machine-readable medium" can include, but is not limited to: wireless channels and various other media capable of storing, containing, and/or carrying instruction(s) and/or data.
It should be understood that the processor referred to in the embodiments of the present application may be a Central Processing Unit (CPU), and may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will also be appreciated that the memory referred to in the embodiments herein may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. Volatile memory can be Random Access Memory (RAM). For example, RAM can be used as external cache memory. By way of example and not limitation, RAM may include the following forms: static Random Access Memory (SRAM), dynamic random access memory (dynamic RAM, DRAM), Synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and direct bus RAM (DR RAM).
It should be noted that when the processor is a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, the memory (memory module) may be integrated into the processor.
It should also be noted that the memory described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
Those of ordinary skill in the art will appreciate that the various illustrative elements and steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. Furthermore, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, or portions thereof, may be embodied in the form of a computer software product stored in a storage medium, the computer software product including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage media may include, but are not limited to: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (17)

1. A data transmission method based on Wi-FiP2P is characterized by comprising the following steps:
the method comprises the steps that a first electronic device receives sharing operation of a user, wherein the sharing operation is used for triggering the first electronic device to send first data to be shared to a second electronic device in a point-to-point P2P transmission mode; wherein the first electronic device is connected to a first access point and the second electronic device is connected to a second access point;
in response to the sharing operation, the first electronic equipment creates a virtual access point;
the first electronic device establishes a P2P channel with the second electronic device based on the virtual access point;
the first electronic device and the second electronic device transmit the first data and the internet surfing data of the second electronic device through the P2P channel;
the first electronic device and the second electronic device are both electronic devices which do not support dual-frequency and dual-emission but support Wi-FiP2P functions.
2. The method of claim 1, wherein the first electronic device and the second electronic device are both devices with Windows systems installed.
3. The method of claim 1 or 2, wherein the P2P channel comprises a first Socket channel and a second Socket channel;
the first Socket channel is used for transmitting the first data, and the second Socket channel is used for transmitting the internet surfing data of the second electronic device.
4. The method according to any one of claims 1 to 3, further comprising:
and the first electronic equipment interacts internet surfing data of the first electronic equipment and internet surfing data of the second electronic equipment with a network side through the first access point.
5. The method of any one of claims 1-4, wherein the first electronic device establishes a P2P tunnel with the second electronic device based on the virtual access point, comprising:
the first electronic equipment sends hotspot information of the virtual access point to the second electronic equipment, wherein the hotspot information of the virtual access point comprises a Service Set Identifier (SSID) and a password;
the second electronic equipment is connected to the virtual access point according to the received hotspot information of the virtual access point;
the first electronic device and the second electronic device successfully establish the P2P channel.
6. The method of claim 5, further comprising:
in a case where the second electronic device is connected to the virtual access point, the second electronic device disconnects from the second access point.
7. The method according to any one of claims 1 to 6, wherein after the first electronic device receives a sharing operation of a user, the method further comprises:
responding to the sharing operation, the first electronic equipment displays first prompt information, and the first prompt information is used for prompting: when the first electronic equipment and the second electronic equipment perform data transmission, the second electronic equipment is connected to a wireless local area network of the first electronic equipment.
8. The method of claim 7, wherein the first electronic device creates a virtual access point, comprising:
the first electronic equipment receives confirmation operation of a user on the first prompt message;
in response to a confirmation operation by a user, the first electronic device creates the virtual access point.
9. The method according to any one of claims 1 to 8, wherein the first electronic device receives a sharing operation of a user, and the method comprises the following steps:
the first electronic equipment receives a first operation of a user, wherein the first operation is an operation of selecting the first data and triggering sharing;
in response to the first operation, the first electronic device scans for connectable devices in the vicinity;
the first electronic device displaying an identifier of a connectable device discovered by scanning, the identifier of the connectable device including an identifier of the second electronic device;
the first electronic equipment receives a second operation of a user on the identification of the second electronic equipment;
wherein the sharing operation comprises the first operation and the second operation.
10. The method according to any one of claims 1 to 9, wherein after the first electronic device receives a sharing operation of a user, the method further comprises:
the first electronic equipment and the second electronic equipment establish Bluetooth connection;
the first electronic device sends a first request message to the second electronic device based on the Bluetooth connection;
the second electronic equipment receives the first request message sent by the first electronic equipment based on the Bluetooth connection;
the second electronic equipment displays the first request message;
wherein the first request message is used to prompt: the first electronic device will send data to the second electronic device, and the second electronic device will be connected to the wireless local area network of the first electronic device during data transmission.
11. The method of claim 10, wherein after the second electronic device displays the first request message, the method further comprises:
the second electronic equipment receives confirmation operation of a user on the first request message;
the second electronic equipment sends a first message to the first electronic equipment, wherein the first message is used for prompting that: the second electronic device has agreed to receive the first data sent by the first electronic device.
12. The method according to any one of claims 1 to 11, further comprising:
after the second electronic device successfully receives the first data, the second electronic device disconnects from the virtual access point;
the second electronic device reconnects to the second access point.
13. The method according to any one of claims 1 to 12, further comprising:
the first electronic equipment receives a second response message sent by the second electronic equipment, wherein the second response message is used for indicating that the first data has been successfully received;
the first electronic device deletes the virtual access point.
14. An electronic device comprising a processor coupled with a memory, the processor to execute a computer program or instructions stored in the memory to cause the electronic device to implement the method of any of claims 1-13.
15. A chip system, wherein the chip system is coupled with a memory, and the chip system is configured to read and execute a computer program stored in the memory to implement the method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that it stores a computer program which, when run on an electronic device, causes the electronic device to perform the method of any of claims 1 to 13.
17. A computer program product, characterized in that it causes a computer to carry out the method according to any one of claims 1 to 13 when said computer program product is run on the computer.
CN202111276093.7A 2021-10-29 2021-10-29 Data transmission method based on Wi-Fi P2P and electronic equipment Active CN115022849B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202310369125.0A CN116367123A (en) 2021-10-29 2021-10-29 Wi-Fi P2P-based data transmission method and electronic equipment
CN202111276093.7A CN115022849B (en) 2021-10-29 2021-10-29 Data transmission method based on Wi-Fi P2P and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111276093.7A CN115022849B (en) 2021-10-29 2021-10-29 Data transmission method based on Wi-Fi P2P and electronic equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202310369125.0A Division CN116367123A (en) 2021-10-29 2021-10-29 Wi-Fi P2P-based data transmission method and electronic equipment

Publications (2)

Publication Number Publication Date
CN115022849A true CN115022849A (en) 2022-09-06
CN115022849B CN115022849B (en) 2023-04-14

Family

ID=83064204

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202310369125.0A Pending CN116367123A (en) 2021-10-29 2021-10-29 Wi-Fi P2P-based data transmission method and electronic equipment
CN202111276093.7A Active CN115022849B (en) 2021-10-29 2021-10-29 Data transmission method based on Wi-Fi P2P and electronic equipment

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202310369125.0A Pending CN116367123A (en) 2021-10-29 2021-10-29 Wi-Fi P2P-based data transmission method and electronic equipment

Country Status (1)

Country Link
CN (2) CN116367123A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117715050A (en) * 2023-06-12 2024-03-15 荣耀终端有限公司 Network sharing method and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160174277A1 (en) * 2014-12-12 2016-06-16 Samsung Electronics Co., Ltd. Method of connecting wireless network and electronic device thereof
CN106454766A (en) * 2016-09-27 2017-02-22 盐城工学院 Real-time cooperation data sharing system based on Android system and Wi-Fi Direct
CN107426726A (en) * 2017-07-07 2017-12-01 珠海市魅族科技有限公司 Network sharing method and device, terminal and storage medium
CN111026484A (en) * 2019-12-02 2020-04-17 维沃移动通信有限公司 Application sharing method, first electronic device and computer-readable storage medium
CN113038627A (en) * 2019-12-05 2021-06-25 华为技术有限公司 File sharing method, mobile device and computer storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160174277A1 (en) * 2014-12-12 2016-06-16 Samsung Electronics Co., Ltd. Method of connecting wireless network and electronic device thereof
CN106454766A (en) * 2016-09-27 2017-02-22 盐城工学院 Real-time cooperation data sharing system based on Android system and Wi-Fi Direct
CN107426726A (en) * 2017-07-07 2017-12-01 珠海市魅族科技有限公司 Network sharing method and device, terminal and storage medium
CN111026484A (en) * 2019-12-02 2020-04-17 维沃移动通信有限公司 Application sharing method, first electronic device and computer-readable storage medium
CN113038627A (en) * 2019-12-05 2021-06-25 华为技术有限公司 File sharing method, mobile device and computer storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117715050A (en) * 2023-06-12 2024-03-15 荣耀终端有限公司 Network sharing method and electronic equipment

Also Published As

Publication number Publication date
CN116367123A (en) 2023-06-30
CN115022849B (en) 2023-04-14

Similar Documents

Publication Publication Date Title
JP7378576B2 (en) Terminal device, method and system for implementing one-touch screen projection using remote control device
WO2021036835A1 (en) Bluetooth search method and system, and related apparatus
CN112469013B (en) Bluetooth connection method and related device
CN113438354B (en) Data transmission method and device, electronic equipment and storage medium
WO2021043198A1 (en) Bluetooth pairing method, and related device
WO2021169698A1 (en) Connection management method and related device
WO2022127690A1 (en) Terminal device, multi-link communication method and chip
CN114390337A (en) Screen projection method and system and electronic equipment
WO2021027623A1 (en) Device capability discovery method and p2p device
US20230199886A1 (en) System and method for providing wireless network access, and electronic device
CN114339709A (en) Wireless communication method and terminal device
WO2021197071A1 (en) Wireless communication system and method
CN113645571A (en) Data transmission method and electronic equipment
CN114531742A (en) Dual Wi-Fi connection method and electronic equipment
CN114339698A (en) Method for establishing wireless connection through equipment touch, electronic equipment and chip
CN115022849B (en) Data transmission method based on Wi-Fi P2P and electronic equipment
CN115022852B (en) Method for controlling Bluetooth transmission rate and electronic equipment
CN117425227A (en) Method and device for establishing session based on WiFi direct connection
CN115145517A (en) Screen projection method, electronic equipment and system
CN117062252B (en) Data transmission method and electronic equipment
WO2023236670A1 (en) Data transmission management method, electronic device and storage medium
WO2023051204A1 (en) Cross-device connection method, electronic device and storage medium
EP4277351A1 (en) Wi-fi access method and related device
CN115529639A (en) Network switching method and device, user equipment and readable storage medium
CN115802326A (en) Bluetooth connection method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant