WO2020103592A1 - Method for establishing connection, apparatus, device and storage medium - Google Patents
Method for establishing connection, apparatus, device and storage mediumInfo
- Publication number
- WO2020103592A1 WO2020103592A1 PCT/CN2019/110204 CN2019110204W WO2020103592A1 WO 2020103592 A1 WO2020103592 A1 WO 2020103592A1 CN 2019110204 W CN2019110204 W CN 2019110204W WO 2020103592 A1 WO2020103592 A1 WO 2020103592A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- connection
- request
- information
- connection information
- response
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
Definitions
- connection establishment method and device but not limited to a connection establishment method and device, device, and storage medium.
- the wireless direct connection (WFD, Wireless, Fidelity, Direct) standard based on the IEEE 802.11b standard refers to allowing electronic devices in a wireless network to connect to each other without going through a wireless router. Similar to Bluetooth technology, this standard allows multiple electronic devices to be interconnected in a peer-to-peer (P2P, Peer-to-Peer) form. Compared with the Bluetooth connection link, the direct connection link (ie P2P connection link) of the wireless local area network (Wireless) Fidelity (WiFi) based on the IEEE 802.11b standard is superior to the Bluetooth connection link in data transmission speed and transmission distance. , So it has been widely used. For example, using WFD technology can enable users' laptops to bypass the access point and directly establish a P2P connection with a wireless printer, digital camera, projector, sensor, or TV box.
- WiFi wireless local area network
- the first device needs to establish a P2P connection with the second device, usually, if the first device does not save the P2P connection information of the second device, the first device needs to negotiate with the second device first, and establish their respective And the P2P connection information of the second device can be obtained before the P2P connection with the second device can be achieved.
- the negotiation process between the first device and the second device takes a long time, which is not conducive to the rapid establishment of the P2P connection between the first device and the second device.
- the embodiments of the present application provide a method, device, device, and storage medium for establishing a connection to solve at least one problem in the related art.
- the technical solutions of the embodiments of the present application are implemented as follows:
- an embodiment of the present application provides a connection establishment method.
- the method includes: a first device receives an operation instruction, and the operation instruction is used to instruct the first device to establish a P2P connection with a second device; if the The first device does not save the P2P connection information of the second device, and the first device sends its own P2P connection information to the second device to trigger the second device based on the P2P of the first device Connection information, sending a first connection request to the first device; the first device receiving the first connection request; the first device responding to the first connection request, establishing a P2P connection with the second device .
- an embodiment of the present application provides another method for establishing a connection.
- the method includes: a second device receives P2P connection information of a first device, and the P2P connection information of the first device is that Sent when saving the P2P connection information of the second device; if the working channel of the second device includes the P2P channel indicated by the P2P connection information of the first device, the second device is based on the first The P2P connection information of the device sends a first connection request to the first device to request to establish a P2P connection with the first device.
- an embodiment of the present application provides a connection establishment device, including: a first receiving module configured to receive an operation instruction, the operation instruction used to instruct the connection establishment device to establish a P2P connection with a second device;
- the sending module is configured to send the P2P connection information of the second device to the second device if the P2P connection information of the second device is not saved in the connection establishing device to trigger the second device Send a first connection request to the connection establishment device based on the P2P connection information of the connection establishment device;
- a second receiving module configured to receive the first connection request; a response module configured to respond to the first connection request To establish a P2P connection with the second device.
- an embodiment of the present application provides another apparatus for establishing a connection, including: a third receiving module configured to receive P2P connection information of a first device, and the P2P connection information of the first device is that the first device is in Sent when the P2P connection information of the connection establishment device is not saved; the second sending module is configured if the working channel of the connection establishment device includes the P2P channel indicated by the P2P connection information of the first device, the The connection establishment device sends a first connection request to the first device based on the P2P connection information of the first device to request to establish a P2P connection with the first device.
- an embodiment of the present application provides an electronic device, including a memory and a processor.
- the memory stores a computer program that can run on the processor.
- the processor executes the program, any of the foregoing Steps in the connection establishment method.
- an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, any step in the connection establishment method described above is implemented.
- the first device when the first device needs to establish a P2P connection with the second device, if the first device does not save the P2P connection information of the second device, the first device does not trigger the negotiation process at this time , That is, without sending a negotiation request to the second device, but directly sending its own P2P connection information to the second device, to trigger the second device to send the P2P connection information based on the first device to The first device sends a first connection request, so as to quickly realize a P2P connection between the first device and the second device.
- 1A is a schematic diagram of an implementation process of a connection establishment method according to an embodiment of this application.
- FIG. 1B is a schematic diagram of a P2P connection application interface according to an embodiment of this application.
- connection establishment method 2 is a schematic flowchart of another connection establishment method according to an embodiment of the present application.
- FIG. 3 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application.
- connection establishment method 4 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application.
- connection establishment method 5 is a schematic diagram of an implementation process of another connection establishment method according to an embodiment of the present application.
- FIG. 6 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application.
- connection establishment method 7 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application.
- FIG. 8 is a schematic structural diagram of a connection establishment device according to an embodiment of the present application.
- connection establishment device 9 is a schematic structural diagram of another connection establishment device according to an embodiment of the present application.
- FIG. 10 is a schematic diagram of a hardware entity of an electronic device according to an embodiment of the present application.
- FIG. 1A is a schematic diagram of an implementation process of the connection establishment method according to an embodiment of the present application. As shown in FIG. 1A, the method includes steps S101 to S111:
- the first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
- the P2P connection application interface 101 of the first device displays multiple P2P devices (such as the second device 102, the third device 103, and the fourth device 104) that can establish a P2P connection around it.
- P2P devices such as the second device 102, the third device 103, and the fourth device 1004.
- the user can choose which device to connect to with P2P.
- the user touches the area where the "second device 102" in the P2P connection application interface 101 is located to trigger the first device to establish a P2P connection with the second device 102.
- the first device sends a first group owner (GO, Group Owner) negotiation request (that is, GO Negotiation Request, which is called as follows The first GO negotiation request) to the second device;
- a first group owner GO, Group Owner
- the first device does not save the P2P connection information of the second device: For example, when the first device establishes a P2P connection with the second device for the first time, the first device The P2P connection information of the second device is not saved in. As another example, when the first device and the second device last established a P2P connection, the first device may not save the P2P connection information of the second device.
- the second device responds to the first GO negotiation request and returns a first GO negotiation response (GO Negotiation Response) to the first device;
- the first device receives the first GO negotiation response, starts monitoring the channel, and waits to receive the second GO negotiation request sent by the second device;
- the second device performs P2P connection initialization
- the second device After the second device completes the initialization of the P2P connection, the second device sends the second GO negotiation request to the first device, where the second GO negotiation request carries the negotiation information of the second device ;
- the negotiation information of the second device includes a P2P Media Access Control (MAC) address of the second device, and a P2P channel supported by the second device.
- MAC Media Access Control
- the first device responds to the second GO negotiation request and returns a second GO negotiation response to the second device, where the second GO negotiation response carries the negotiation information of the first device;
- the negotiation information of the first device generally includes the P2P MAC address of the first device and the P2P channel supported by the first device.
- the second device After receiving the second GO negotiation response, the second device returns a GO negotiation confirmation (GO Negotiation Confirm) to the first device;
- the second device can determine the role of P2P connection, such as GO or Group Client (GC, Group Client), if it is GO, waiting to receive the connection request sent by the first device; if it is GC, send the connection request to the first device.
- P2P connection such as GO or Group Client (GC, Group Client)
- GC Group Client
- the P2P channel used for the subsequent establishment of the P2P connection is also confirmed.
- the second device sends a first connection request to the first device based on the negotiation information of the first device;
- the first connection request is used to request to establish a P2P connection with the first device on the P2P channel on which the second device operates, and the first connection request carries the second The P2P MAC address of the device.
- the first device After receiving the first connection request, the first device sends a first connection response to the second device on the P2P channel on which the second device works based on the P2P MAC address of the second device.
- the first connection response is used to inform the second device that a P2P connection can be established; after the second device receives the first connection response, the second device returns a second connection response to the first device, At this time, the first device and the second device complete the establishment of the P2P connection.
- the second device determines that it is the role of the client (that is, the second device serves as a GC). At this time, the second device After returning the GO negotiation confirmation, the first connection request is sent to the first device.
- the first device receives the first connection request
- S111 The first device establishes a P2P connection with the second device in response to the first connection request.
- a method for establishing a connection is provided.
- the first device and the second device first need to complete the negotiation process, that is, the above steps S102 to S108, so that it takes a long time to establish a P2P connection between the first device and the second device time.
- an embodiment of the present application provides another connection establishment method, which is applied to the first device, and the first device is
- the implementation process may be various types of electronic devices with connection establishment capabilities, for example, the first device may include a mobile phone, a tablet computer, a desktop computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, Sensing equipment, set-top boxes, etc.
- the function realized by the method can be realized by the processor in the first device calling the program code.
- the program code can be stored in a computer storage medium. It can be seen that the first device includes at least a processor and a storage medium.
- FIG. 2 is a schematic flowchart of an implementation of another connection establishment method according to an embodiment of the present application. As shown in FIG. 2, the method includes steps S201 to S204:
- the first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
- the first device determines whether to save the P2P connection information of the second device in response to the operation instruction, and if it does not save the P2P connection information of the second device, it proceeds to step S202. If the first device itself stores the P2P connection information of the second device, the first device sends a second connection request to the second device based on the P2P connection information of the second device to request the The second device establishes a P2P connection.
- the first device If the first device does not save the P2P connection information of the second device, the first device sends its own P2P connection information to the second device to trigger the second device to Send P2P connection information of the first device to the first device;
- the P2P connection information of the first device includes the P2P MAC address of the first device, the P2P channel supported by the first device, and the role of the first device in performing a P2P connection with the second device (generally GO). Understandably, if the first device does not save the P2P connection information of the second device, the first device skips the negotiation process with the second device and directly sends its own P2P connection information to The second device, thereby triggering the second device to send a first connection request to the first device based on the P2P connection information of the first device to quickly establish a P2P connection with the second device; wherein, The first connection request is used to request to establish a P2P connection with the first device on the P2P channel on which the second device works. The first connection request carries the P2P MAC address of the second device.
- connection request sent by the second device to the first device it is called a first connection request
- connection request sent by the first device to the second device Called the second connection request
- the first device receives the first connection request
- the first device establishes a P2P connection with the second device in response to the first connection request.
- the first device after the first device receives the first connection request, based on the P2P MAC address of the second device, the first device sends the first to the second device on the P2P channel where the second device works Connection response, the first connection response carries information capable of establishing a P2P connection with the second device, that is, the first connection response is used to inform the second device that a P2P connection can be established; the second After the device receives the first connection response, the second device returns a second connection response to the first device, and the second connection response carries information confirming the establishment of the P2P connection, that is, the second The connection response is used to notify the first device that the P2P connection is successfully established, and at this time, the first device and the second device complete the establishment of the P2P connection.
- connection response if it is a connection response sent by the first device to the second device, it is called a first connection response, if it is a connection response sent by the second device to the first device , Called the second connection response.
- the functions of the first connection response and the second connection response are the same, both of which are to inform the other party that a P2P connection can be established.
- both the first connection response and the second connection response carry confirmation information of "OK".
- the first device when the first device needs to establish a P2P connection with the second device, if the first device does not save the P2P connection information of the second device, the first device does not trigger negotiation Process, that is, not sending a negotiation request to the second device, but directly sending its own P2P connection information to the second device, to trigger the second device based on the P2P connection information of the first device, Sending a first connection request to the first device, so as to quickly realize a P2P connection between the first device and the second device.
- negotiation Process that is, not sending a negotiation request to the second device, but directly sending its own P2P connection information to the second device, to trigger the second device based on the P2P connection information of the first device, Sending a first connection request to the first device, so as to quickly realize a P2P connection between the first device and the second device.
- FIG. 3 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application. As shown in FIG. 3, the method includes steps S301 to S308:
- the first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
- the first device detects whether the P2P connection information of the second device has been saved; if yes, perform step S303; otherwise, perform step S306;
- the first device sends a second connection request to the second device based on the P2P connection information of the second device to request a P2P connection with the second device, and then proceeds to step S304;
- the first device may send a second connection request to the second device based on the two pieces of information.
- the second connection request is used to request to establish a P2P connection with the second device on the P2P channel on which the first device works.
- the second connection request carries the P2P MAC address of the first device.
- the second device After receiving the second connection request, the second device sends a second connection response to the first device on the P2P channel on which the first device works based on the P2P MAC address of the first device.
- the second connection response is used to inform the first device that a P2P connection can be established; after the first device receives the second connection response, the first device returns a first connection response to the second device, At this time, the second device and the first device complete the establishment of the P2P connection.
- step S304 The first device detects whether a connection response (that is, the second connection response) fed back by the second device based on the second connection request is received within a preset duration; if yes, step S305 is executed; Otherwise, step S306 is executed;
- the first device establishes a P2P connection with the second device based on the connection response;
- the first device sends its own P2P connection information to the second device to trigger the second device to send the first device to the first device based on the P2P connection information of the first device Connection request, and then step S307;
- the first device has saved the P2P connection information of the second device, after sending the second connection request to the second device, if the second device has not responded for a long time, this time , The first device does not perform the negotiation process, but sends its own P2P connection information to the second device to trigger the second device to send the first device to the first device based on the P2P connection information of the first device The device sends the first connection request, so as to realize fast P2P connection.
- the second device does not respond for a long time, possibly because the first device is not saved in the second device P2P connection information, or the second device cannot work on the P2P channel used by the current P2P connection.
- the first device receives the first connection request
- the first device establishes a P2P connection with the second device in response to the first connection request.
- FIG. 4 is a schematic flowchart of an implementation of another connection establishment method according to an embodiment of the present application. As shown in FIG. 4, the method includes steps S401 to S407:
- the first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
- the first device If the first device does not save the P2P connection information of the second device, the first device detects whether there is an established non-P2P connection link between the first device and the second device ; If yes, go to step S403; otherwise, go to step S404;
- the first device sends to the second device based on the P2P connection information of the second device After the second connection request, if the first device does not receive the connection response fed back by the second device based on the second connection request within a preset duration, the first device connects its own P2P connection at this time
- the method of sending the information to the second device may also be implemented through steps S403 to S405 or broadcasting.
- the non-P2P connection link may be an infrared link, a Near Field Communication (NFC, Near Field) Communication link, a Bluetooth socket link, and so on.
- NFC Near Field Communication
- Bluetooth socket link and so on.
- the first device sends the P2P connection information of the first device to the second device through the non-P2P connection link, and then proceeds to step S406;
- the first device establishes the non-P2P connection link with the second device
- the first device may also connect the P2P connection of the first device by broadcast The information is sent to the second device, that is, the first device broadcasts its own P2P connection information. If the second device receives the P2P connection information of the first device, the second device The P2P connection information of a device sends a first connection request to the first device.
- the second device when the second device receives the P2P connection information of the first device, if the second device is idle at this time (for example, the second device is not currently establishing a P2P connection with other devices Or, the second device currently establishes a P2P connection with other devices, but the number of devices connected to the second device through P2P does not exceed a preset threshold), the second device sends the first connection to the first device request.
- the first device sends the P2P connection information of the first device to the second device through the established non-P2P connection link;
- the first device when establishing the non-P2P connection link, the first device does not need to negotiate with the second device, which saves time spent in negotiation.
- a non-P2P connection link between the first device and the second device is established through Bluetooth Low Energy (BLE, Bluetooth Low Energy).
- the first device in order to reduce the power consumption of the first device and the second device, usually, uses the established non-P2P connection link to connect the P2P connection information of the first device After sending to the second device, disconnect the non-P2P connection link.
- the first device receives a first connection request sent by the second device to the first device based on the P2P connection information of the first device;
- the first device establishes a P2P connection with the second device in response to the first connection request.
- An embodiment of the present application provides yet another connection establishment method, which is applied to a second device.
- the second device may be various types of electronic devices with connection establishment capabilities during implementation, for example, the first device may Including mobile phones, tablet computers, desktop computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing equipment, set-top boxes, etc.
- the function realized by the method can be realized by the processor in the first device calling the program code.
- the program code can be stored in a computer storage medium. It can be seen that the first device includes at least a processor and a storage medium.
- FIG. 5 is a schematic flowchart of an implementation of another connection establishment method according to an embodiment of the present application. As shown in FIG. 5, the method includes steps S501 to S502:
- the second device receives the P2P connection information of the first device.
- the P2P connection information of the first device is sent by the first device when the P2P connection information of the second device is not saved;
- the P2P connection information of the first device received by the second device may also be sent by the first device in the following example, that is, the first device Has saved the P2P connection information of the second device, the first device sends a second connection request to the second device based on the P2P connection information of the second device, but if the first device is A connection response fed back by the second device based on the second connection request is not received within a preset duration, and the first device sends its own P2P connection information to the second device.
- the second device sends to the first device based on the P2P connection information of the first device A first connection request to request to establish a P2P connection with the first device.
- FIG. 6 is a schematic diagram of an implementation process of another embodiment of the application establishment method. As shown in FIG. 6, the method includes steps S601 to S604:
- the second device receives the P2P connection information of the first device.
- the P2P connection information of the first device is sent by the first device when the P2P connection information of the second device is not saved;
- the second device detects whether the working channel of the second device includes the P2P channel indicated by the P2P connection information of the first device; if so, step S603 is performed; otherwise, step S604 is performed;
- the second device sends a first connection request to the first device based on the P2P connection information of the first device to request to establish a P2P connection with the first device;
- the second device sends its own P2P connection information to the first device to trigger the first device to send a second connection request to the second device based on the P2P connection information of the second device To request to establish a P2P connection with the second device.
- the second device may not support the P2P channel indicated by the P2P connection information of the first device.
- the first device indicates that a 5G channel is used to establish a P2P connection.
- due to the second The device can only work on the 2.4G channel.
- the second device if the second device cannot work as indicated by the P2P connection information of the first device In the P2P channel, the second device sends its own P2P connection information to the first device, triggering the first device to request connection to the second device, thereby improving connection stability.
- the second device sending its own P2P connection information to the first device may include: if there is an established non-P2P connection chain between the second device and the first device Way, the second device sends the P2P connection information of the second device to the first device through the non-P2P connection link; if there is no established connection between the second device and the first device Non-P2P connection link, the second device broadcasts its own P2P connection information; or, if there is no established non-P2P connection link between the second device and the first device, the second device Establishing the non-P2P connection link with the first device, and the second device sending the P2P connection information of the second device to the first device through the established non-P2P connection link.
- FIG. 7 is a schematic diagram of an implementation process of another connection establishment method according to an embodiment of the present application. As shown in FIG. 7, the method includes steps S701 to S711:
- the first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
- the first device If the first device does not save the P2P connection information of the second device, the first device sends its own P2P connection information to the second device;
- the first device if the P2P connection information of the second device has been saved in the first device, the first device sends a second to the second device based on the P2P connection information of the second device Connection request; if the first device does not receive the connection response fed back by the second device based on the second connection request within a preset duration, the first device sends its own P2P connection information to The second device.
- the second device receives P2P connection information of the first device
- the second device detects whether the working channel of the second device includes the P2P channel indicated by the P2P connection information of the first device; if so, step S705 is performed; otherwise, step S708 is performed;
- the second device sends a first connection request to the first device based on the P2P connection information of the first device;
- the first device receives the first connection request
- S707 The first device establishes a P2P connection with the second device in response to the first connection request;
- the second device sends its own P2P connection information to the first device;
- the first device sends a second connection request to the second device based on the P2P connection information of the second device;
- the second device receives the second connection request
- the second device establishes a P2P connection with the first device in response to the second connection request.
- a first device when a first device needs to establish a P2P connection with a second device, it first needs to negotiate Group information with the second device to complete the interaction of P2P connection information between the two parties.
- the process of implementing a P2P connection is relatively time-consuming.
- the first device takes the role of GO within a preset period of time, and quickly generates Group information (ie, its own P2P connection information), and then the first device passes the Group information through the low-power Bluetooth consumption technology is transmitted to the second device.
- the second device After receiving the Group information, the second device, as the role of GC, directly sends the first connection request to the first device, so that the negotiation process is omitted , So you can quickly establish P2P connections at both ends.
- the first device may also use infrared and NFC technologies to transmit the Group information to the second device, or the Bluetooth-based transmission method may also use the socket method to transmit the Group information Transmitted to the second device.
- embodiments of the present application provide an apparatus for establishing a connection.
- the apparatus includes each module included and each unit included in each module, which can be implemented by a processor in an electronic device; Specific logic circuit implementation; in the implementation process, the processor may be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA).
- CPU central processing unit
- MPU microprocessor
- DSP digital signal processor
- FPGA field programmable gate array
- the device 800 includes a first receiving module 801, a first sending module 802, a second receiving module 803, and a connection establishing module 804; ,
- the first receiving module 801 is configured to receive an operation instruction, which is used to instruct the connection establishment apparatus 800 to establish a P2P connection with a second device; it should be noted that, generally speaking, the second device corresponds to The device is the connection establishment device 900 shown in FIG. 9.
- the first sending module 802 is configured to send the P2P connection information of the connection establishing device 800 to the second device if the P2P connection information of the second device is not saved in the connection establishing device 800 to trigger the The second device sends a first connection request to the connection establishment apparatus 800 based on the P2P connection information of the connection establishment apparatus 800;
- the second receiving module 803 is configured to receive the first connection request
- the connection establishment module 804 is configured to establish a P2P connection with the second device in response to the first connection request.
- the first sending module 802 is further configured to, if the connection establishment apparatus 800 has saved the P2P connection information of the second device, based on the P2P connection information of the second device, The two devices send a second connection request to request the establishment of a P2P connection with the second device; the connection establishment module 804 is further configured to receive feedback based on the second connection request if the second device is received within a preset duration Based on the connection response, establishing a P2P connection with the second device based on the connection response.
- the first sending module 802 is further configured to, if the connection response fed back by the second device based on the second connection request is not received within a preset duration, P2P connection information is sent to the second device to trigger the second device to send the first connection request to the connection establishment apparatus 800 based on the P2P connection information of the connection establishment apparatus 800.
- the first sending module 802 includes a sending unit configured to, if there is an established non-P2P connection link between the connection establishing apparatus 800 and the second device, pass The P2P connection link sends the P2P connection information of the connection establishing apparatus 800 to the second device;
- the broadcast unit is configured if there is no established non-P2P connection between the connection establishing apparatus 800 and the second device Link, broadcasting P2P connection information of the connection establishment device 800;
- the first sending module 802 further includes a connection establishment unit; wherein, the connection establishment unit is configured if there is no established non-P2P connection link between the connection establishment apparatus 800 and the second device , Establishing a non-P2P connection link between the connection establishment apparatus 800 and the second device; the sending unit is further configured to use the established non-P2P connection link to communicate the P2P connection information of the connection establishment apparatus 800 Sent to the second device.
- the connection establishment unit is configured if there is no established non-P2P connection link between the connection establishment apparatus 800 and the second device , Establishing a non-P2P connection link between the connection establishment apparatus 800 and the second device; the sending unit is further configured to use the established non-P2P connection link to communicate the P2P connection information of the connection establishment apparatus 800 Sent to the second device.
- FIG. 9 is a schematic structural diagram of another connection establishment device according to an embodiment of the application.
- the device 900 includes a third receiving module 901 and a second sending module 902 ;among them,
- the third receiving module 901 is configured to receive the P2P connection information of the first device, and the P2P connection information of the first device is sent when the first device does not save the P2P connection information of the connection establishing apparatus 900; It should be noted that, generally speaking, the device corresponding to the first device is the connection establishment device 800 shown in FIG. 8.
- the second sending module 902 is configured to, if the working channel of the connection establishment apparatus 900 includes the P2P channel indicated by the P2P connection information of the first device, based on the P2P connection information of the first device, to the first device.
- the device sends a first connection request to request to establish a P2P connection with the first device.
- the second sending module 902 is further configured to, if the working channel of the connection establishing apparatus 900 does not include the P2P channel indicated by the P2P connection information of the first device, P2P connection information is sent to the first device to trigger the first device to send a second connection request to the connection establishment device 900 based on the P2P connection information of the connection establishment device 900 to request to establish with the connection The device 900 establishes a P2P connection.
- connection establishment method is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
- the computer software products are stored in a storage medium and include several instructions to make An electronic device (which may be a mobile phone, tablet computer, desktop computer, personal digital assistant, navigator, digital phone, video phone, television, sensor device, set-top box, etc.) performs all or all of the methods described in the embodiments of this application or section.
- the foregoing storage media include various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (Read Only Memory, ROM), a magnetic disk, or an optical disk.
- program codes such as a USB flash drive, a mobile hard disk, a read-only memory (Read Only Memory, ROM), a magnetic disk, or an optical disk.
- FIG. 10 is a schematic diagram of a hardware entity of the electronic device according to an embodiment of the present application.
- the hardware entity of the electronic device 100 includes: a memory 1001 and a processor 1002.
- the memory 1001 stores a computer program that can run on the processor 1002.
- the processor 1002 executes the program, the steps in the connection establishment method provided in the foregoing embodiments are implemented.
- the memory 1001 is configured to store instructions and applications executable by the processor 1002, and may also cache data to be processed or processed by the processor 1002 and various modules in the electronic device 100 (for example, image data, audio data, voice communication data, and Video communication data) can be achieved through flash memory (FLASH) or random access memory (Random Access Memory, RAM).
- flash memory FLASH
- random access Memory Random Access Memory
- an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the steps in the connection establishment method provided in the above embodiments.
- the disclosed device and method may be implemented in other ways.
- the device embodiments described above are only schematic.
- the division of the units is only a logical function division, and in actual implementation, there may be another division manner, for example, multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored, or not implemented.
- the coupling or direct coupling or communication connection between the displayed or discussed components may be through some interfaces, and the indirect coupling or communication connection of the device or unit may be electrical, mechanical, or other forms of.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- the functional units in the embodiments of the present application may all be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above integration
- the unit can be implemented in the form of hardware, or in the form of hardware plus software functional units.
- the foregoing program may be stored in a computer-readable storage medium.
- the steps of the above method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a read-only memory (Read Only Memory, ROM), a magnetic disk, or an optical disk.
- the integrated unit described above is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
- the computer software products are stored in a storage medium and include several instructions to make An electronic device (which may be a mobile phone, tablet computer, desktop computer, personal digital assistant, navigator, digital phone, video phone, television, sensor device, set-top box, etc.) performs all or all of the methods described in the embodiments of this application or section.
- the foregoing storage media include various media that can store program codes, such as a mobile storage device, a ROM, a magnetic disk, or an optical disk.
- the first device when the first device needs to establish a P2P connection with the second device, if the first device does not save the P2P connection information of the second device, the first device does not trigger the negotiation process at this time , That is, without sending a negotiation request to the second device, but directly sending its own P2P connection information to the second device, to trigger the second device to send the P2P connection information based on the first device to The first device sends a first connection request, so as to quickly realize a P2P connection between the first device and the second device.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
- Communication Control (AREA)
Abstract
Disclosed in the embodiments of the present application are a method for establishing a connection, an apparatus, a device and a storage medium, the method comprising: a first device receiving an operation instruction, the operation instruction being used to indicate the establishment of a P2P connection between the first device and a second device; if P2P connection information of the second device is not saved in the first device, the first device sending P2P connection information of the first device to the second device so as to trigger the second device to send a first connection request to the first device on the basis of the P2P connection information of the first device; the first device receives the first connection request; and the first device establishes a P2P connection with the second device in response to the first connection request.
Description
相关申请的交叉引用Cross-reference of related applications
本申请基于申请号为201811409098.0、申请日为2018年11月23日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。This application is based on a Chinese patent application with an application number of 201811409098.0 and an application date of November 23, 2018, and claims the priority of the Chinese patent application. The entire contents of the Chinese patent application are hereby incorporated into this application by way of introduction.
本申请实施例涉及电子技术,涉及但不限于一种连接建立方法及装置、设备、存储介质。The embodiments of the present application relate to electronic technology, but not limited to a connection establishment method and device, device, and storage medium.
基于IEEE 802.11b标准的无线局域网的直连(WFD,Wireless Fidelity Direct)标准是指允许无线网络中的电子设备无需通过无线路由器即可相互连接。与蓝牙技术类似,这种标准允许多个电子设备之间以点对点(P2P,Peer-to-Peer)的形式互连。相比于蓝牙连接链路,基于IEEE 802.11b标准的无线局域网(Wireless Fidelity,WiFi)的直连链路(即P2P连接链路),其数据传输速度、传输距离等都优于蓝牙连接链路,因此得到了广泛的应用。例如,利用WFD技术能够使用户的笔记本电脑绕过访问点,直接与无线打印机、数码相机、投影仪、传感器或电视盒子等建立P2P连接。The wireless direct connection (WFD, Wireless, Fidelity, Direct) standard based on the IEEE 802.11b standard refers to allowing electronic devices in a wireless network to connect to each other without going through a wireless router. Similar to Bluetooth technology, this standard allows multiple electronic devices to be interconnected in a peer-to-peer (P2P, Peer-to-Peer) form. Compared with the Bluetooth connection link, the direct connection link (ie P2P connection link) of the wireless local area network (Wireless) Fidelity (WiFi) based on the IEEE 802.11b standard is superior to the Bluetooth connection link in data transmission speed and transmission distance. , So it has been widely used. For example, using WFD technology can enable users' laptops to bypass the access point and directly establish a P2P connection with a wireless printer, digital camera, projector, sensor, or TV box.
目前,当第一设备需要与第二设备建立P2P连接时,通常情况下,如果第一设备没有保存第二设备的P2P连接信息,第一设备需要先与第二设备进行协商,在协商确立各自的角色以及获取到第二设备的P2P连接信息后,才能够实现与第二设备之间的P2P连接。At present, when the first device needs to establish a P2P connection with the second device, usually, if the first device does not save the P2P connection information of the second device, the first device needs to negotiate with the second device first, and establish their respective And the P2P connection information of the second device can be obtained before the P2P connection with the second device can be achieved.
然而,第一设备与第二设备完成协商的过程耗费了较长的时间,这样不利于第一设备与第二设备快速建立P2P连接。However, the negotiation process between the first device and the second device takes a long time, which is not conducive to the rapid establishment of the P2P connection between the first device and the second device.
发明内容Summary of the invention
本申请实施例为解决相关技术中存在的至少一个问题而提供一种连接建立方法及装置、设备、存储介质。本申请实施例的技术方案是这样实现的:The embodiments of the present application provide a method, device, device, and storage medium for establishing a connection to solve at least one problem in the related art. The technical solutions of the embodiments of the present application are implemented as follows:
第一方面,本申请实施例提供一种连接建立方法,所述方法包括:第一设备接收操作指令,所述操作指令用于指示所述第一设备与第二设备建立P2P连接;如果所述第一设备中没有保存所述第二设备的P2P连接信息,所述第一设备将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求;所述第一设备接收所述第一连接请求;所述第一设备响应所述第一连接请求,与所述第二设备建立P2P连接。In a first aspect, an embodiment of the present application provides a connection establishment method. The method includes: a first device receives an operation instruction, and the operation instruction is used to instruct the first device to establish a P2P connection with a second device; if the The first device does not save the P2P connection information of the second device, and the first device sends its own P2P connection information to the second device to trigger the second device based on the P2P of the first device Connection information, sending a first connection request to the first device; the first device receiving the first connection request; the first device responding to the first connection request, establishing a P2P connection with the second device .
第二方面,本申请实施例提供另一种连接建立方法,所述方法包括:第二设备接收第一设备的P2P连接信息,所述第一设备的P2P连接信息是所述第一设备在没有保存所 述第二设备的P2P连接信息时所发送的;如果所述第二设备的工作信道包括所述第一设备的P2P连接信息所指示的P2P信道,所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,以请求与所述第一设备建立P2P连接。In a second aspect, an embodiment of the present application provides another method for establishing a connection. The method includes: a second device receives P2P connection information of a first device, and the P2P connection information of the first device is that Sent when saving the P2P connection information of the second device; if the working channel of the second device includes the P2P channel indicated by the P2P connection information of the first device, the second device is based on the first The P2P connection information of the device sends a first connection request to the first device to request to establish a P2P connection with the first device.
第三方面,本申请实施例提供一种连接建立装置,包括:第一接收模块,配置为接收操作指令,所述操作指令用于指示所述连接建立装置与第二设备建立P2P连接;第一发送模块,配置为如果所述连接建立装置中没有保存所述第二设备的P2P连接信息,所述连接建立装置将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述连接建立装置的P2P连接信息,向所述连接建立装置发送第一连接请求;第二接收模块,配置为接收所述第一连接请求;响应模块,配置为响应所述第一连接请求,与所述第二设备建立P2P连接。In a third aspect, an embodiment of the present application provides a connection establishment device, including: a first receiving module configured to receive an operation instruction, the operation instruction used to instruct the connection establishment device to establish a P2P connection with a second device; The sending module is configured to send the P2P connection information of the second device to the second device if the P2P connection information of the second device is not saved in the connection establishing device to trigger the second device Send a first connection request to the connection establishment device based on the P2P connection information of the connection establishment device; a second receiving module configured to receive the first connection request; a response module configured to respond to the first connection request To establish a P2P connection with the second device.
第四方面,本申请实施例提供另一种连接建立装置,包括:第三接收模块,配置为接收第一设备的P2P连接信息,所述第一设备的P2P连接信息是所述第一设备在没有保存所述连接建立装置的P2P连接信息时所发送的;第二发送模块,配置为如果所述连接建立装置的工作信道包括所述第一设备的P2P连接信息所指示的P2P信道,所述连接建立装置基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,以请求与所述第一设备建立P2P连接。According to a fourth aspect, an embodiment of the present application provides another apparatus for establishing a connection, including: a third receiving module configured to receive P2P connection information of a first device, and the P2P connection information of the first device is that the first device is in Sent when the P2P connection information of the connection establishment device is not saved; the second sending module is configured if the working channel of the connection establishment device includes the P2P channel indicated by the P2P connection information of the first device, the The connection establishment device sends a first connection request to the first device based on the P2P connection information of the first device to request to establish a P2P connection with the first device.
第五方面,本申请实施例提供一种电子设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述任一所述的连接建立方法中的步骤。According to a fifth aspect, an embodiment of the present application provides an electronic device, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, any of the foregoing Steps in the connection establishment method.
第六方面,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述任一所述的连接建立方法中的步骤。According to a sixth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, any step in the connection establishment method described above is implemented.
本申请实施例中,在第一设备需要与第二设备建立P2P连接时,如果所述第一设备中没有保存所述第二设备的P2P连接信息,此时所述第一设备不触发协商流程,也就是不发送协商请求给所述第二设备,而是直接将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,从而快速实现第一设备与第二设备的P2P连接。In the embodiment of the present application, when the first device needs to establish a P2P connection with the second device, if the first device does not save the P2P connection information of the second device, the first device does not trigger the negotiation process at this time , That is, without sending a negotiation request to the second device, but directly sending its own P2P connection information to the second device, to trigger the second device to send the P2P connection information based on the first device to The first device sends a first connection request, so as to quickly realize a P2P connection between the first device and the second device.
图1A为本申请实施例连接建立方法的实现流程示意图;1A is a schematic diagram of an implementation process of a connection establishment method according to an embodiment of this application;
图1B为本申请实施例P2P连接应用界面示意图;1B is a schematic diagram of a P2P connection application interface according to an embodiment of this application;
图2为本申请实施例另一连接建立方法的实现流程示意图;2 is a schematic flowchart of another connection establishment method according to an embodiment of the present application;
图3为本申请实施例提供再一连接建立方法的实现流程示意图;3 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application;
图4为本申请实施例提供再一连接建立方法的实现流程示意图;4 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application;
图5为本申请实施例提供又一连接建立方法的实现流程示意图;5 is a schematic diagram of an implementation process of another connection establishment method according to an embodiment of the present application;
图6为本申请实施例提供再一连接建立方法的实现流程示意图;6 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application;
图7为本申请实施例提供又一连接建立方法的实现流程示意图;7 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application;
图8为本申请实施例连接建立装置的组成结构示意图;FIG. 8 is a schematic structural diagram of a connection establishment device according to an embodiment of the present application;
图9为本申请实施例另一连接建立装置的组成结构示意图;9 is a schematic structural diagram of another connection establishment device according to an embodiment of the present application;
图10为本申请实施例电子设备的一种硬件实体示意图。10 is a schematic diagram of a hardware entity of an electronic device according to an embodiment of the present application.
下面结合附图和实施例对本申请的技术方案进一步详细阐述。The technical solution of the present application is further elaborated below with reference to the drawings and embodiments.
本申请实施例提供一连接建立方法,图1A为本申请实施例连接建立方法的实现流程示意图,如图1A所示,该方法包括步骤S101至步骤S111:An embodiment of the present application provides a connection establishment method. FIG. 1A is a schematic diagram of an implementation process of the connection establishment method according to an embodiment of the present application. As shown in FIG. 1A, the method includes steps S101 to S111:
S101、第一设备接收操作指令,所述操作指令用于指示所述第一设备与第二设备建立P2P连接;S101. The first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
例如,图1B所示,在第一设备的P2P连接应用界面101显示周围能够建立P2P连接的多个P2P设备(如第二设备102、第三设备103、第四设备104),这样,基于P2P连接应用界面101,用户可以选择要跟哪个设备进行P2P连接。例如,用户通过触摸P2P连接应用界面101中“第二设备102”所在的区域,触发第一设备与第二设备102建立P2P连接。For example, as shown in FIG. 1B, the P2P connection application interface 101 of the first device displays multiple P2P devices (such as the second device 102, the third device 103, and the fourth device 104) that can establish a P2P connection around it. By connecting to the application interface 101, the user can choose which device to connect to with P2P. For example, the user touches the area where the "second device 102" in the P2P connection application interface 101 is located to trigger the first device to establish a P2P connection with the second device 102.
S102、如果所述第一设备中没有保存所述第二设备的P2P连接信息,所述第一设备发送第一群组拥有者(GO,Group Owner)协商请求(即GO Negotiation Request,如下称为第一GO协商请求)给所述第二设备;S102. If the P2P connection information of the second device is not saved in the first device, the first device sends a first group owner (GO, Group Owner) negotiation request (that is, GO Negotiation Request, which is called as follows The first GO negotiation request) to the second device;
所述第一设备中没有保存所述第二设备的P2P连接信息的原因可能有两种:例如,所述第一设备与所述第二设备第一次建立P2P连接时,所述第一设备中没有保存所述第二设备的P2P连接信息。再如,所述第一设备与所述第二设备在上一次建立P2P连接时,所述第一设备可能没有保存所述第二设备的P2P连接信息。There may be two reasons why the first device does not save the P2P connection information of the second device: For example, when the first device establishes a P2P connection with the second device for the first time, the first device The P2P connection information of the second device is not saved in. As another example, when the first device and the second device last established a P2P connection, the first device may not save the P2P connection information of the second device.
S103、所述第二设备响应所述第一GO协商请求,向所述第一设备返回第一GO协商响应(GO Negotiation Response);S103. The second device responds to the first GO negotiation request and returns a first GO negotiation response (GO Negotiation Response) to the first device;
S104、所述第一设备接收到所述第一GO协商响应,开始监听信道,等待接收所述第二设备发送的第二GO协商请求;S104. The first device receives the first GO negotiation response, starts monitoring the channel, and waits to receive the second GO negotiation request sent by the second device;
S105、所述第二设备执行P2P连接初始化;S105. The second device performs P2P connection initialization;
S106、所述第二设备完成P2P连接初始化后,所述第二设备向所述第一设备发送所述第二GO协商请求,所述第二GO协商请求携带有所述第二设备的协商信息;S106. After the second device completes the initialization of the P2P connection, the second device sends the second GO negotiation request to the first device, where the second GO negotiation request carries the negotiation information of the second device ;
一般来说,所述第二设备的协商信息包括第二设备的P2P媒体访问控制(MAC,Media Access Control)地址、第二设备支持的P2P信道。Generally, the negotiation information of the second device includes a P2P Media Access Control (MAC) address of the second device, and a P2P channel supported by the second device.
S107、所述第一设备响应所述第二GO协商请求,向所述第二设备返回第二GO协商响应,所述第二GO协商响应携带有所述第一设备的协商信息;S107. The first device responds to the second GO negotiation request and returns a second GO negotiation response to the second device, where the second GO negotiation response carries the negotiation information of the first device;
类似地,所述第一设备的协商信息一般包括第一设备的P2P MAC地址、第一设备支持的P2P信道。Similarly, the negotiation information of the first device generally includes the P2P MAC address of the first device and the P2P channel supported by the first device.
S108、所述第二设备接收到所述第二GO协商响应后,向所述第一设备返回GO协 商确认(GO Negotiation Confirm);S108. After receiving the second GO negotiation response, the second device returns a GO negotiation confirmation (GO Negotiation Confirm) to the first device;
需要说明的是,所述第二设备接收到所述第二GO协商响应后,就可以确定在进行P2P连接时的角色了,比如是GO还是群组客户端(GC,Group Client),如果是GO,就等待接收第一设备发送的连接请求;如果是GC,则向第一设备发送连接请求。另外,在协商确认的同时,还确认了后续建立P2P连接所使用的P2P信道。It should be noted that, after receiving the second GO negotiation response, the second device can determine the role of P2P connection, such as GO or Group Client (GC, Group Client), if it is GO, waiting to receive the connection request sent by the first device; if it is GC, send the connection request to the first device. In addition, at the same time as the negotiation confirmation, the P2P channel used for the subsequent establishment of the P2P connection is also confirmed.
S109、所述第二设备基于所述第一设备的协商信息,向所述第一设备发送第一连接请求;S109. The second device sends a first connection request to the first device based on the negotiation information of the first device;
这里,需要说明的是,所述第一连接请求用于请求与所述第一设备在所述第二设备工作的P2P信道上建立P2P连接,所述第一连接请求中携带有所述第二设备的P2P MAC地址。所述第一设备接收到所述第一连接请求之后,基于所述第二设备的P2P MAC地址,在所述第二设备工作的P2P信道上向所述第二设备发送第一连接响应,所述第一连接响应用于告知所述第二设备可以建立P2P连接;所述第二设备接收到所述第一连接响应之后,所述第二设备返回第二连接响应给所述第一设备,此时所述第一设备和所述第二设备完成P2P连接的建立。Here, it should be noted that the first connection request is used to request to establish a P2P connection with the first device on the P2P channel on which the second device operates, and the first connection request carries the second The P2P MAC address of the device. After receiving the first connection request, the first device sends a first connection response to the second device on the P2P channel on which the second device works based on the P2P MAC address of the second device. The first connection response is used to inform the second device that a P2P connection can be established; after the second device receives the first connection response, the second device returns a second connection response to the first device, At this time, the first device and the second device complete the establishment of the P2P connection.
假设所述第二设备在接收到所述第二GO协商响应之后,确定自己是客户端的角色(即所述第二设备作为GC),此时,所述第二设备在向所述第一设备返回GO协商确认之后,向所述第一设备发送所述第一连接请求。Suppose that after receiving the second GO negotiation response, the second device determines that it is the role of the client (that is, the second device serves as a GC). At this time, the second device After returning the GO negotiation confirmation, the first connection request is sent to the first device.
S110、所述第一设备接收所述第一连接请求;S110. The first device receives the first connection request;
S111、所述第一设备响应所述第一连接请求,与所述第二设备建立P2P连接。S111: The first device establishes a P2P connection with the second device in response to the first connection request.
在本申请实施例中,提供一种连接建立方法,在该方法中,所述第一设备在与所述第二设备建立P2P连接之前,如果所述第一设备中没有保存所述第二设备的P2P连接信息,所述第一设备与所述第二设备首先需要先完成协商流程,即上述步骤S102至步骤S108,这样所述第一设备与所述第二设备建立P2P连接需要耗费较长的时间。In an embodiment of the present application, a method for establishing a connection is provided. In this method, before the P2P connection is established between the first device and the second device, if the second device is not saved in the first device P2P connection information, the first device and the second device first need to complete the negotiation process, that is, the above steps S102 to S108, so that it takes a long time to establish a P2P connection between the first device and the second device time.
基于此,为了快速建立所述第一设备与所述第二设备之间的P2P连接,本申请实施例提供另一连接建立方法,该方法应用于所述第一设备,所述第一设备在实施的过程中可以为各种类型的具有连接建立能力的电子设备,例如所述第一设备可以包括手机、平板电脑、台式机、个人数字助理、导航仪、数字电话、视频电话、电视机、传感设备、机顶盒等。该方法所实现的功能可以通过所述第一设备中的处理器调用程序代码来实现,当然程序代码可以保存在计算机存储介质中,可见,该第一设备至少包括处理器和存储介质。Based on this, in order to quickly establish a P2P connection between the first device and the second device, an embodiment of the present application provides another connection establishment method, which is applied to the first device, and the first device is The implementation process may be various types of electronic devices with connection establishment capabilities, for example, the first device may include a mobile phone, a tablet computer, a desktop computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, Sensing equipment, set-top boxes, etc. The function realized by the method can be realized by the processor in the first device calling the program code. Of course, the program code can be stored in a computer storage medium. It can be seen that the first device includes at least a processor and a storage medium.
图2为本申请实施例另一连接建立方法的实现流程示意图,如图2所示,该方法包括步骤S201至步骤S204:FIG. 2 is a schematic flowchart of an implementation of another connection establishment method according to an embodiment of the present application. As shown in FIG. 2, the method includes steps S201 to S204:
S201、第一设备接收操作指令,所述操作指令用于指示所述第一设备与第二设备建立P2P连接;S201. The first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
这里,第一设备响应所述操作指令,确定自身是否保存所述第二设备的P2P连接信息,如果自身没有保存所述第二设备的P2P连接信息,进入步骤S202。如果第一设备 自身保存有所述第二设备的P2P连接信息,所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求,以请求与所述第二设备建立P2P连接。Here, the first device determines whether to save the P2P connection information of the second device in response to the operation instruction, and if it does not save the P2P connection information of the second device, it proceeds to step S202. If the first device itself stores the P2P connection information of the second device, the first device sends a second connection request to the second device based on the P2P connection information of the second device to request the The second device establishes a P2P connection.
S202、如果所述第一设备中没有保存所述第二设备的P2P连接信息,所述第一设备将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求;S202. If the first device does not save the P2P connection information of the second device, the first device sends its own P2P connection information to the second device to trigger the second device to Send P2P connection information of the first device to the first device;
一般来说,所述第一设备的P2P连接信息包括第一设备的P2P MAC地址、第一设备支持的P2P信道、所述第一设备与所述第二设备进行P2P连接时的角色(一般是GO)。可以理解地,如果所述第一设备中没有保存所述第二设备的P2P连接信息,所述第一设备跳过与所述第二设备进行协商的过程,直接将自身的P2P连接信息发送给所述第二设备,从而触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,快速与所述第二设备建立P2P连接;其中,所述第一连接请求用于请求与所述第一设备在所述第二设备工作的P2P信道上建立P2P连接,所述第一连接请求中携带有所述第二设备的P2P MAC地址。In general, the P2P connection information of the first device includes the P2P MAC address of the first device, the P2P channel supported by the first device, and the role of the first device in performing a P2P connection with the second device (generally GO). Understandably, if the first device does not save the P2P connection information of the second device, the first device skips the negotiation process with the second device and directly sends its own P2P connection information to The second device, thereby triggering the second device to send a first connection request to the first device based on the P2P connection information of the first device to quickly establish a P2P connection with the second device; wherein, The first connection request is used to request to establish a P2P connection with the first device on the P2P channel on which the second device works. The first connection request carries the P2P MAC address of the second device.
需要说明的是,在本申请所提供的所有实施例中,如果是第二设备向第一设备发送的连接请求,称为第一连接请求,如果是第一设备向第二设备发送的连接请求,称为第二连接请求。It should be noted that in all the embodiments provided in this application, if it is a connection request sent by the second device to the first device, it is called a first connection request, if it is a connection request sent by the first device to the second device , Called the second connection request.
S203、所述第一设备接收所述第一连接请求;S203. The first device receives the first connection request;
S204、所述第一设备响应所述第一连接请求,与所述第二设备建立P2P连接。S204. The first device establishes a P2P connection with the second device in response to the first connection request.
可以理解地,所述第一设备接收到所述第一连接请求之后,基于所述第二设备的P2P MAC地址,在所述第二设备工作的P2P信道上向所述第二设备发送第一连接响应,所述第一连接响应中携带有能够与所述第二设备建立P2P连接的信息,即,所述第一连接响应用于告知所述第二设备可以建立P2P连接;所述第二设备接收到所述第一连接响应之后,所述第二设备返回第二连接响应给所述第一设备,所述第二连接响应中携带有确认建立P2P连接的信息,即,所述第二连接响应用于告知所述第一设备P2P连接建立成功,此时所述第一设备和所述第二设备完成P2P连接的建立。Understandably, after the first device receives the first connection request, based on the P2P MAC address of the second device, the first device sends the first to the second device on the P2P channel where the second device works Connection response, the first connection response carries information capable of establishing a P2P connection with the second device, that is, the first connection response is used to inform the second device that a P2P connection can be established; the second After the device receives the first connection response, the second device returns a second connection response to the first device, and the second connection response carries information confirming the establishment of the P2P connection, that is, the second The connection response is used to notify the first device that the P2P connection is successfully established, and at this time, the first device and the second device complete the establishment of the P2P connection.
需要说明的是,在本申请所提供的所有实施例中,如果是第一设备向第二设备发送的连接响应,称为第一连接响应,如果是第二设备向第一设备发送的连接响应,称为第二连接响应。所述第一连接响应和所述第二连接响应的作用相同,都是为了告知对方可以建立P2P连接。例如,所述第一连接响应和所述第二连接响应中都携带有“OK”的确认信息。It should be noted that in all the embodiments provided in this application, if it is a connection response sent by the first device to the second device, it is called a first connection response, if it is a connection response sent by the second device to the first device , Called the second connection response. The functions of the first connection response and the second connection response are the same, both of which are to inform the other party that a P2P connection can be established. For example, both the first connection response and the second connection response carry confirmation information of "OK".
在本申请实施例中,在第一设备需要与第二设备建立P2P连接时,如果所述第一设备中没有保存所述第二设备的P2P连接信息,此时所述第一设备不触发协商流程,也就是不发送协商请求给所述第二设备,而是直接将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,从而快速实现第一设备与第二设备的P2P连接。In the embodiment of the present application, when the first device needs to establish a P2P connection with the second device, if the first device does not save the P2P connection information of the second device, the first device does not trigger negotiation Process, that is, not sending a negotiation request to the second device, but directly sending its own P2P connection information to the second device, to trigger the second device based on the P2P connection information of the first device, Sending a first connection request to the first device, so as to quickly realize a P2P connection between the first device and the second device.
本申请实施例提供再一连接建立方法,图3为本申请实施例提供再一连接建立方法 的实现流程示意图,如图3所示,该方法包括步骤S301至步骤S308:An embodiment of the present application provides another connection establishment method. FIG. 3 is a schematic diagram of an implementation process of providing another connection establishment method according to an embodiment of the present application. As shown in FIG. 3, the method includes steps S301 to S308:
S301、第一设备接收操作指令,所述操作指令用于指示所述第一设备与第二设备建立P2P连接;S301. The first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
S302、所述第一设备检测是否已保存所述第二设备的P2P连接信息;如果是,执行步骤S303;否则,执行步骤S306;S302. The first device detects whether the P2P connection information of the second device has been saved; if yes, perform step S303; otherwise, perform step S306;
S303、所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求,以请求与所述第二设备建立P2P连接,然后进入步骤S304;S303. The first device sends a second connection request to the second device based on the P2P connection information of the second device to request a P2P connection with the second device, and then proceeds to step S304;
通常情况下,无论所述第二设备的P2P连接信息中是否包括所述第二设备在进行P2P连接时所扮演的角色,如果所述第二设备的P2P连接信息中包括所述第二设备的P2P MAC地址、所述第二设备所支持的P2P信道,所述第一设备就可以基于这两个信息向所述第二设备发送第二连接请求。所述第二连接请求用于请求与所述第二设备在所述第一设备工作的P2P信道上建立P2P连接,所述第二连接请求中携带有所述第一设备的P2P MAC地址。所述第二设备接收到所述第二连接请求之后,基于所述第一设备的P2P MAC地址,在所述第一设备工作的P2P信道上向所述第一设备发送第二连接响应,所述第二连接响应用于告知所述第一设备可以建立P2P连接;所述第一设备接收到所述第二连接响应之后,所述第一设备返回第一连接响应给所述第二设备,此时所述第二设备和所述第一设备完成P2P连接的建立。Generally, regardless of whether the P2P connection information of the second device includes the role played by the second device in the P2P connection, if the P2P connection information of the second device includes the second device ’s The P2P MAC address and the P2P channel supported by the second device, the first device may send a second connection request to the second device based on the two pieces of information. The second connection request is used to request to establish a P2P connection with the second device on the P2P channel on which the first device works. The second connection request carries the P2P MAC address of the first device. After receiving the second connection request, the second device sends a second connection response to the first device on the P2P channel on which the first device works based on the P2P MAC address of the first device. The second connection response is used to inform the first device that a P2P connection can be established; after the first device receives the second connection response, the first device returns a first connection response to the second device, At this time, the second device and the first device complete the establishment of the P2P connection.
S304、所述第一设备检测是否在预设时长内接收到所述第二设备基于所述第二连接请求所反馈的连接响应(即所述第二连接响应);如果是,执行步骤S305;否则,执行步骤S306;S304: The first device detects whether a connection response (that is, the second connection response) fed back by the second device based on the second connection request is received within a preset duration; if yes, step S305 is executed; Otherwise, step S306 is executed;
S305、所述第一设备基于所述连接响应与所述第二设备建立P2P连接;S305. The first device establishes a P2P connection with the second device based on the connection response;
S306、所述第一设备将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送所述第一连接请求,然后进入步骤S307;S306. The first device sends its own P2P connection information to the second device to trigger the second device to send the first device to the first device based on the P2P connection information of the first device Connection request, and then step S307;
可以理解地,如果所述第一设备中已保存所述第二设备的P2P连接信息,在向第二设备发送所述第二连接请求之后,如果所述第二设备长时间没有响应,此时,所述第一设备不执行协商过程,而是将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送所述第一连接请求,从而实现快速P2P连接。Understandably, if the first device has saved the P2P connection information of the second device, after sending the second connection request to the second device, if the second device has not responded for a long time, this time , The first device does not perform the negotiation process, but sends its own P2P connection information to the second device to trigger the second device to send the first device to the first device based on the P2P connection information of the first device The device sends the first connection request, so as to realize fast P2P connection.
一般来说,所述第一设备向所述第二设备发送所述第二连接请求之后,所述第二设备长时间没有响应,可能是因为所述第二设备中没有保存所述第一设备的P2P连接信息,或者,所述第二设备无法工作在当前P2P连接所使用的P2P信道上。Generally, after the first device sends the second connection request to the second device, the second device does not respond for a long time, possibly because the first device is not saved in the second device P2P connection information, or the second device cannot work on the P2P channel used by the current P2P connection.
S307、所述第一设备接收所述第一连接请求;S307. The first device receives the first connection request;
S308、所述第一设备响应所述第一连接请求,与所述第二设备建立P2P连接。S308. The first device establishes a P2P connection with the second device in response to the first connection request.
本申请实施例提供另一连接建立方法,图4为本申请实施例提供再一连接建立方法的实现流程示意图,如图4所示,该方法包括步骤S401至步骤S407:An embodiment of the present application provides another connection establishment method. FIG. 4 is a schematic flowchart of an implementation of another connection establishment method according to an embodiment of the present application. As shown in FIG. 4, the method includes steps S401 to S407:
S401、第一设备接收操作指令,所述操作指令用于指示所述第一设备与第二设备建立P2P连接;S401. The first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
S402、如果所述第一设备中没有保存所述第二设备的P2P连接信息,所述第一设备检测所述第一设备是否与所述第二设备之间具有已建立的非P2P连接链路;如果是,执行步骤S403;否则,执行步骤S404;S402. If the first device does not save the P2P connection information of the second device, the first device detects whether there is an established non-P2P connection link between the first device and the second device ; If yes, go to step S403; otherwise, go to step S404;
需要说明的是,如果所述第一设备中已保存所述第二设备的P2P连接信息,但是,在所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求之后,如果所述第一设备在预设时长内没有接收到所述第二设备基于所述第二连接请求所反馈的连接响应,此时所述第一设备将自身的P2P连接信息发送给所述第二设备的方式,也可以通过步骤S403至步骤S405或者广播的方式来实现。It should be noted that, if the P2P connection information of the second device has been saved in the first device, but the first device sends to the second device based on the P2P connection information of the second device After the second connection request, if the first device does not receive the connection response fed back by the second device based on the second connection request within a preset duration, the first device connects its own P2P connection at this time The method of sending the information to the second device may also be implemented through steps S403 to S405 or broadcasting.
举例来说,所述非P2P连接链路可以是红外链路、近距离无线通讯技术(NFC,Near Field Communication)链路、蓝牙的套接口(Socket)链路等。For example, the non-P2P connection link may be an infrared link, a Near Field Communication (NFC, Near Field) Communication link, a Bluetooth socket link, and so on.
S403、所述第一设备通过所述非P2P连接链路将所述第一设备的P2P连接信息发送给所述第二设备,然后进入步骤S406;S403. The first device sends the P2P connection information of the first device to the second device through the non-P2P connection link, and then proceeds to step S406;
S404、所述第一设备与所述第二设备建立所述非P2P连接链路;S404. The first device establishes the non-P2P connection link with the second device;
在其他实施例中,如果所述第一设备与所述第二设备之间没有已建立的非P2P连接链路,所述第一设备还可以通过广播的方式将所述第一设备的P2P连接信息发送给所述第二设备,即,所述第一设备广播自身的P2P连接信息,如果所述第二设备接收到所述第一设备的P2P连接信息,所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求。一般来说,当所述第二设备接收到所述第一设备的P2P连接信息时,如果所述第二设备此时是空闲的(如,所述第二设备当前没有和其他设备建立P2P连接,或者,所述第二设备当前和其他设备建立P2P连接,但是通过P2P连接所述第二设备的设备数量没有超出预设阈值),所述第二设备向所述第一设备发送第一连接请求。In other embodiments, if there is no established non-P2P connection link between the first device and the second device, the first device may also connect the P2P connection of the first device by broadcast The information is sent to the second device, that is, the first device broadcasts its own P2P connection information. If the second device receives the P2P connection information of the first device, the second device The P2P connection information of a device sends a first connection request to the first device. Generally speaking, when the second device receives the P2P connection information of the first device, if the second device is idle at this time (for example, the second device is not currently establishing a P2P connection with other devices Or, the second device currently establishes a P2P connection with other devices, but the number of devices connected to the second device through P2P does not exceed a preset threshold), the second device sends the first connection to the first device request.
S405、所述第一设备通过建立的非P2P连接链路将所述第一设备的P2P连接信息发送给所述第二设备;S405. The first device sends the P2P connection information of the first device to the second device through the established non-P2P connection link;
一般来说,在建立所述非P2P连接链路时,所述第一设备不需要与所述第二设备进行协商,这样就省去了协商所耗费的时间。例如,通过蓝牙低功耗蓝牙技术(BLE,Bluetooth Low Energy)建立所述第一设备与所述第二设备之间的非P2P连接链路。Generally speaking, when establishing the non-P2P connection link, the first device does not need to negotiate with the second device, which saves time spent in negotiation. For example, a non-P2P connection link between the first device and the second device is established through Bluetooth Low Energy (BLE, Bluetooth Low Energy).
在其他实施例中,为了降低所述第一设备与所述第二设备的功耗,通常情况下,所述第一设备通过建立的非P2P连接链路将所述第一设备的P2P连接信息发送给所述第二设备之后,断开所述非P2P连接链路。In other embodiments, in order to reduce the power consumption of the first device and the second device, usually, the first device uses the established non-P2P connection link to connect the P2P connection information of the first device After sending to the second device, disconnect the non-P2P connection link.
S406、所述第一设备接收所述第二设备基于所述第一设备的P2P连接信息向所述第一设备发送的第一连接请求;S406. The first device receives a first connection request sent by the second device to the first device based on the P2P connection information of the first device;
S407、所述第一设备响应所述第一连接请求,与所述第二设备建立P2P连接。S407. The first device establishes a P2P connection with the second device in response to the first connection request.
本申请实施例提供又一连接建立方法,该方法应用于第二设备,所述第二设备在实 施的过程中可以为各种类型的具有连接建立能力的电子设备,例如所述第一设备可以包括手机、平板电脑、台式机、个人数字助理、导航仪、数字电话、视频电话、电视机、传感设备、机顶盒等。该方法所实现的功能可以通过所述第一设备中的处理器调用程序代码来实现,当然程序代码可以保存在计算机存储介质中,可见,该第一设备至少包括处理器和存储介质。An embodiment of the present application provides yet another connection establishment method, which is applied to a second device. The second device may be various types of electronic devices with connection establishment capabilities during implementation, for example, the first device may Including mobile phones, tablet computers, desktop computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing equipment, set-top boxes, etc. The function realized by the method can be realized by the processor in the first device calling the program code. Of course, the program code can be stored in a computer storage medium. It can be seen that the first device includes at least a processor and a storage medium.
图5为本申请实施例提供又一连接建立方法的实现流程示意图,如图5所示,该方法包括步骤S501至步骤S502:FIG. 5 is a schematic flowchart of an implementation of another connection establishment method according to an embodiment of the present application. As shown in FIG. 5, the method includes steps S501 to S502:
S501、第二设备接收第一设备的P2P连接信息,所述第一设备的P2P连接信息是所述第一设备在没有保存所述第二设备的P2P连接信息时所发送的;S501. The second device receives the P2P connection information of the first device. The P2P connection information of the first device is sent by the first device when the P2P connection information of the second device is not saved;
需要说明的是,在其他实施例中,所述第二设备接收的所述第一设备的P2P连接信息,也可以是如下示例中所述第一设备所发送的,即:所述第一设备中已保存所述第二设备的P2P连接信息,所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求,但是,如果所述第一设备在预设时长内没有接收到所述第二设备基于所述第二连接请求所反馈的连接响应,所述第一设备将自身的P2P连接信息发送给所述第二设备。It should be noted that, in other embodiments, the P2P connection information of the first device received by the second device may also be sent by the first device in the following example, that is, the first device Has saved the P2P connection information of the second device, the first device sends a second connection request to the second device based on the P2P connection information of the second device, but if the first device is A connection response fed back by the second device based on the second connection request is not received within a preset duration, and the first device sends its own P2P connection information to the second device.
S502、如果所述第二设备的工作信道包括所述第一设备的P2P连接信息所指示的P2P信道,所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,以请求与所述第一设备建立P2P连接。S502. If the working channel of the second device includes the P2P channel indicated by the P2P connection information of the first device, the second device sends to the first device based on the P2P connection information of the first device A first connection request to request to establish a P2P connection with the first device.
本申请实施例提供再一连接建立方法,图6为本申请实施例提供再一连接建立方法的实现流程示意图,如图6所示,该方法包括步骤S601至步骤S604:An embodiment of the present application provides another connection establishment method. FIG. 6 is a schematic diagram of an implementation process of another embodiment of the application establishment method. As shown in FIG. 6, the method includes steps S601 to S604:
S601、第二设备接收第一设备的P2P连接信息,所述第一设备的P2P连接信息是所述第一设备在没有保存所述第二设备的P2P连接信息时所发送的;S601. The second device receives the P2P connection information of the first device. The P2P connection information of the first device is sent by the first device when the P2P connection information of the second device is not saved;
S602、所述第二设备检测所述第二设备的工作信道是否包括所述第一设备的P2P连接信息所指示的P2P信道;如果是,执行步骤S603;否则,执行步骤S604;S602. The second device detects whether the working channel of the second device includes the P2P channel indicated by the P2P connection information of the first device; if so, step S603 is performed; otherwise, step S604 is performed;
S603、所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,以请求与所述第一设备建立P2P连接;S603. The second device sends a first connection request to the first device based on the P2P connection information of the first device to request to establish a P2P connection with the first device;
S604、所述第二设备将自身的P2P连接信息发送给所述第一设备,以触发所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求,以请求与所述第二设备建立P2P连接。S604: The second device sends its own P2P connection information to the first device to trigger the first device to send a second connection request to the second device based on the P2P connection information of the second device To request to establish a P2P connection with the second device.
在实际应用中,所述第二设备可能不支持所述第一设备的P2P连接信息所指示的P2P信道,比如,所述第一设备指示利用5G信道建立P2P连接,但是,由于所述第二设备只能工作在2.4G信道上,此时为了避免因此出现连接失败的情况,在本申请实施例中,如果所述第二设备不能够工作在所述第一设备的P2P连接信息所指示的P2P信道时,所述第二设备将自身的P2P连接信息发送给所述第一设备,触发第一设备来请求连接第二设备,从而提高连接稳定性。In practical applications, the second device may not support the P2P channel indicated by the P2P connection information of the first device. For example, the first device indicates that a 5G channel is used to establish a P2P connection. However, due to the second The device can only work on the 2.4G channel. In this case, in order to avoid a connection failure, in this embodiment of the present application, if the second device cannot work as indicated by the P2P connection information of the first device In the P2P channel, the second device sends its own P2P connection information to the first device, triggering the first device to request connection to the second device, thereby improving connection stability.
在其他实施例中,所述第二设备将自身的P2P连接信息发送给所述第一设备,可以 包括:如果所述第二设备与所述第一设备之间具有已建立的非P2P连接链路,所述第二设备通过所述非P2P连接链路将所述第二设备的P2P连接信息发送给所述第一设备;如果所述第二设备与所述第一设备之间没有已建立的非P2P连接链路,所述第二设备广播自身的P2P连接信息;或者,如果所述第二设备与所述第一设备之间没有已建立的非P2P连接链路,所述第二设备与所述第一设备建立所述非P2P连接链路,所述第二设备通过建立的非P2P连接链路将所述第二设备的P2P连接信息发送给所述第一设备。In other embodiments, the second device sending its own P2P connection information to the first device may include: if there is an established non-P2P connection chain between the second device and the first device Way, the second device sends the P2P connection information of the second device to the first device through the non-P2P connection link; if there is no established connection between the second device and the first device Non-P2P connection link, the second device broadcasts its own P2P connection information; or, if there is no established non-P2P connection link between the second device and the first device, the second device Establishing the non-P2P connection link with the first device, and the second device sending the P2P connection information of the second device to the first device through the established non-P2P connection link.
本申请实施例提供另一连接建立方法,图7为本申请实施例提供又一连接建立方法的实现流程示意图,如图7所示,该方法包括步骤S701至步骤S711:An embodiment of the present application provides another connection establishment method. FIG. 7 is a schematic diagram of an implementation process of another connection establishment method according to an embodiment of the present application. As shown in FIG. 7, the method includes steps S701 to S711:
S701、第一设备接收操作指令,所述操作指令用于指示所述第一设备与第二设备建立P2P连接;S701. The first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a P2P connection with the second device;
S702、如果所述第一设备中没有保存所述第二设备的P2P连接信息,所述第一设备将自身的P2P连接信息发送给所述第二设备;S702. If the first device does not save the P2P connection information of the second device, the first device sends its own P2P connection information to the second device;
在其他实施例中,如果所述第一设备中已保存所述第二设备的P2P连接信息,所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求;如果所述第一设备在预设时长内没有接收到所述第二设备基于所述第二连接请求所反馈的连接响应,此时所述第一设备将自身的P2P连接信息发送给所述第二设备。In other embodiments, if the P2P connection information of the second device has been saved in the first device, the first device sends a second to the second device based on the P2P connection information of the second device Connection request; if the first device does not receive the connection response fed back by the second device based on the second connection request within a preset duration, the first device sends its own P2P connection information to The second device.
S703、所述第二设备接收所述第一设备的P2P连接信息;S703. The second device receives P2P connection information of the first device;
S704、所述第二设备检测所述第二设备的工作信道是否包括所述第一设备的P2P连接信息所指示的P2P信道;如果是,执行步骤S705;否则,执行步骤S708;S704. The second device detects whether the working channel of the second device includes the P2P channel indicated by the P2P connection information of the first device; if so, step S705 is performed; otherwise, step S708 is performed;
S705、所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求;S705. The second device sends a first connection request to the first device based on the P2P connection information of the first device;
S706、所述第一设备接收所述第一连接请求;S706. The first device receives the first connection request;
S707、所述第一设备响应所述第一连接请求,与所述第二设备建立P2P连接;S707: The first device establishes a P2P connection with the second device in response to the first connection request;
S708、所述第二设备将自身的P2P连接信息发送给所述第一设备;S708. The second device sends its own P2P connection information to the first device;
S709、所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求;S709. The first device sends a second connection request to the second device based on the P2P connection information of the second device;
S710、所述第二设备接收所述第二连接请求;S710. The second device receives the second connection request;
S711、所述第二设备响应所述第二连接请求,与所述第一设备建立P2P连接。S711. The second device establishes a P2P connection with the first device in response to the second connection request.
目前,第一设备需要与第二设备建立P2P连接时,首先需要和所述第二设备协商群组(Group)信息,完成双方P2P连接信息的交互,具体过程参见图1A对应的实施例,这样实现P2P连接的过程相对比较耗时。基于此,在本申请实施例中,第一设备在预设的一段时间内作为GO的角色,快速生成Group信息(即自身的P2P连接信息),然后所述第一设备将Group信息通过低功耗蓝牙技术传输给所述第二设备,所述第二设备在接收到Group信息后,作为GC的角色,直接向所述第一设备发送第一连接请求,这样,因为省去了协商的过程,所以能够快速建立两端的P2P连接。At present, when a first device needs to establish a P2P connection with a second device, it first needs to negotiate Group information with the second device to complete the interaction of P2P connection information between the two parties. For the specific process, refer to the embodiment corresponding to FIG. 1A. The process of implementing a P2P connection is relatively time-consuming. Based on this, in the embodiment of the present application, the first device takes the role of GO within a preset period of time, and quickly generates Group information (ie, its own P2P connection information), and then the first device passes the Group information through the low-power Bluetooth consumption technology is transmitted to the second device. After receiving the Group information, the second device, as the role of GC, directly sends the first connection request to the first device, so that the negotiation process is omitted , So you can quickly establish P2P connections at both ends.
需要说明的是,在其他实施例中,所述第一设备也可以利用红外、NFC技术将Group 信息传输给所述第二设备,或者,基于蓝牙的传输方式也可以使用socket的方式将Group信息传输给所述第二设备。It should be noted that, in other embodiments, the first device may also use infrared and NFC technologies to transmit the Group information to the second device, or the Bluetooth-based transmission method may also use the socket method to transmit the Group information Transmitted to the second device.
基于前述的实施例,本申请实施例提供一种连接建立装置,该装置包括所包括的各模块、以及各模块所包括的各单元,可以通过电子设备中的处理器来实现;当然也可通过具体的逻辑电路实现;在实施的过程中,处理器可以为中央处理器(CPU)、微处理器(MPU)、数字信号处理器(DSP)或现场可编程门阵列(FPGA)等。Based on the foregoing embodiments, embodiments of the present application provide an apparatus for establishing a connection. The apparatus includes each module included and each unit included in each module, which can be implemented by a processor in an electronic device; Specific logic circuit implementation; in the implementation process, the processor may be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA).
图8为本申请实施例连接建立装置的组成结构示意图,如图8所示,所述装置800包括第一接收模块801、第一发送模块802、第二接收模块803和连接建立模块804;其中,8 is a schematic structural diagram of a device for establishing a connection according to an embodiment of the present application. As shown in FIG. 8, the device 800 includes a first receiving module 801, a first sending module 802, a second receiving module 803, and a connection establishing module 804; ,
第一接收模块801,配置为接收操作指令,所述操作指令用于指示所述连接建立装置800与第二设备建立P2P连接;需要说明的是,一般来说,所述第二设备所对应的装置为图9所示的连接建立装置900。The first receiving module 801 is configured to receive an operation instruction, which is used to instruct the connection establishment apparatus 800 to establish a P2P connection with a second device; it should be noted that, generally speaking, the second device corresponds to The device is the connection establishment device 900 shown in FIG. 9.
第一发送模块802,配置为如果所述连接建立装置800中没有保存所述第二设备的P2P连接信息,将所述连接建立装置800的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述连接建立装置800的P2P连接信息,向所述连接建立装置800发送第一连接请求;The first sending module 802 is configured to send the P2P connection information of the connection establishing device 800 to the second device if the P2P connection information of the second device is not saved in the connection establishing device 800 to trigger the The second device sends a first connection request to the connection establishment apparatus 800 based on the P2P connection information of the connection establishment apparatus 800;
第二接收模块803,配置为接收所述第一连接请求;The second receiving module 803 is configured to receive the first connection request;
连接建立模块804,配置为响应所述第一连接请求,与所述第二设备建立P2P连接。The connection establishment module 804 is configured to establish a P2P connection with the second device in response to the first connection request.
在其他实施例中,第一发送模块802,还配置为如果所述连接建立装置800中已保存所述第二设备的P2P连接信息,基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求,以请求与所述第二设备建立P2P连接;连接建立模块804,还配置为如果在预设时长内接收到所述第二设备基于所述第二连接请求所反馈的连接响应,基于所述连接响应与所述第二设备建立P2P连接。In other embodiments, the first sending module 802 is further configured to, if the connection establishment apparatus 800 has saved the P2P connection information of the second device, based on the P2P connection information of the second device, The two devices send a second connection request to request the establishment of a P2P connection with the second device; the connection establishment module 804 is further configured to receive feedback based on the second connection request if the second device is received within a preset duration Based on the connection response, establishing a P2P connection with the second device based on the connection response.
在其他实施例中,第一发送模块802,还配置为如果在预设时长内没有接收到所述第二设备基于所述第二连接请求所反馈的连接响应,将所述连接建立装置800的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述连接建立装置800的P2P连接信息,向所述连接建立装置800发送所述第一连接请求。In other embodiments, the first sending module 802 is further configured to, if the connection response fed back by the second device based on the second connection request is not received within a preset duration, P2P connection information is sent to the second device to trigger the second device to send the first connection request to the connection establishment apparatus 800 based on the P2P connection information of the connection establishment apparatus 800.
在其他实施例中,所述第一发送模块802,包括:发送单元,配置为如果所述连接建立装置800与所述第二设备之间具有已建立的非P2P连接链路,通过所述非P2P连接链路将所述连接建立装置800的P2P连接信息发送给所述第二设备;广播单元,配置为如果所述连接建立装置800与所述第二设备之间没有已建立的非P2P连接链路,广播所述连接建立装置800的P2P连接信息;In other embodiments, the first sending module 802 includes a sending unit configured to, if there is an established non-P2P connection link between the connection establishing apparatus 800 and the second device, pass The P2P connection link sends the P2P connection information of the connection establishing apparatus 800 to the second device; the broadcast unit is configured if there is no established non-P2P connection between the connection establishing apparatus 800 and the second device Link, broadcasting P2P connection information of the connection establishment device 800;
或者,所述第一发送模块802,还包括连接建立单元;其中,所述连接建立单元,配置为如果所述连接建立装置800与所述第二设备之间没有已建立的非P2P连接链路,建立所述连接建立装置800与所述第二设备之间的非P2P连接链路;所述发送单元,还配置为通过建立的非P2P连接链路将所述连接建立装置800的P2P连接信息发送给所述 第二设备。Alternatively, the first sending module 802 further includes a connection establishment unit; wherein, the connection establishment unit is configured if there is no established non-P2P connection link between the connection establishment apparatus 800 and the second device , Establishing a non-P2P connection link between the connection establishment apparatus 800 and the second device; the sending unit is further configured to use the established non-P2P connection link to communicate the P2P connection information of the connection establishment apparatus 800 Sent to the second device.
本申请实施例提供另一连接建立装置,图9为本申请实施例另一连接建立装置的组成结构示意图,如图9所示,所述装置900包括第三接收模块901、第二发送模块902;其中,An embodiment of the present application provides another connection establishment device. FIG. 9 is a schematic structural diagram of another connection establishment device according to an embodiment of the application. As shown in FIG. 9, the device 900 includes a third receiving module 901 and a second sending module 902 ;among them,
第三接收模块901,配置为接收第一设备的P2P连接信息,所述第一设备的P2P连接信息是所述第一设备在没有保存所述连接建立装置900的P2P连接信息时所发送的;需要说明的是,一般来说,所述第一设备所对应的装置为图8所示的连接建立装置800。The third receiving module 901 is configured to receive the P2P connection information of the first device, and the P2P connection information of the first device is sent when the first device does not save the P2P connection information of the connection establishing apparatus 900; It should be noted that, generally speaking, the device corresponding to the first device is the connection establishment device 800 shown in FIG. 8.
第二发送模块902,配置为如果所述连接建立装置900的工作信道包括所述第一设备的P2P连接信息所指示的P2P信道,基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,以请求与所述第一设备建立P2P连接。The second sending module 902 is configured to, if the working channel of the connection establishment apparatus 900 includes the P2P channel indicated by the P2P connection information of the first device, based on the P2P connection information of the first device, to the first device The device sends a first connection request to request to establish a P2P connection with the first device.
在其他实施例中,第二发送模块902,还配置为如果所述连接建立装置900的工作信道不包括所述第一设备的P2P连接信息所指示的P2P信道,将所述连接建立装置900的P2P连接信息发送给所述第一设备,以触发所述第一设备基于所述连接建立装置900的P2P连接信息,向所述连接建立装置900发送第二连接请求,以请求与所述连接建立装置900建立P2P连接。In other embodiments, the second sending module 902 is further configured to, if the working channel of the connection establishing apparatus 900 does not include the P2P channel indicated by the P2P connection information of the first device, P2P connection information is sent to the first device to trigger the first device to send a second connection request to the connection establishment device 900 based on the P2P connection information of the connection establishment device 900 to request to establish with the connection The device 900 establishes a P2P connection.
以上装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。The description of the device embodiments above is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
需要说明的是,本申请实施例中,如果以软件功能模块的形式实现上述的连接建立方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台电子设备(可以是手机、平板电脑、台式机、个人数字助理、导航仪、数字电话、视频电话、电视机、传感设备、机顶盒等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本申请实施例不限制于任何特定的硬件和软件结合。It should be noted that, in the embodiments of the present application, if the above connection establishment method is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or contribute to related technologies. The computer software products are stored in a storage medium and include several instructions to make An electronic device (which may be a mobile phone, tablet computer, desktop computer, personal digital assistant, navigator, digital phone, video phone, television, sensor device, set-top box, etc.) performs all or all of the methods described in the embodiments of this application or section. The foregoing storage media include various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (Read Only Memory, ROM), a magnetic disk, or an optical disk. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
对应地,本申请实施例提供一种电子设备,图10为本申请实施例电子设备的一种硬件实体示意图,如图10所示,该电子设备100的硬件实体包括:包括存储器1001和处理器1002,所述存储器1001存储有可在处理器1002上运行的计算机程序,所述处理器1002执行所述程序时实现上述实施例中提供的连接建立方法中的步骤。Correspondingly, an embodiment of the present application provides an electronic device. FIG. 10 is a schematic diagram of a hardware entity of the electronic device according to an embodiment of the present application. As shown in FIG. 10, the hardware entity of the electronic device 100 includes: a memory 1001 and a processor 1002. The memory 1001 stores a computer program that can run on the processor 1002. When the processor 1002 executes the program, the steps in the connection establishment method provided in the foregoing embodiments are implemented.
存储器1001配置为存储由处理器1002可执行的指令和应用,还可以缓存待处理器1002以及电子设备100中各模块待处理或已经处理的数据(例如,图像数据、音频数据、语音通信数据和视频通信数据),可以通过闪存(FLASH)或随机访问存储器(Random Access Memory,RAM)实现。The memory 1001 is configured to store instructions and applications executable by the processor 1002, and may also cache data to be processed or processed by the processor 1002 and various modules in the electronic device 100 (for example, image data, audio data, voice communication data, and Video communication data) can be achieved through flash memory (FLASH) or random access memory (Random Access Memory, RAM).
对应地,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该 计算机程序被处理器执行时实现上述实施例中提供的连接建立方法中的步骤。Correspondingly, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the steps in the connection establishment method provided in the above embodiments.
这里需要指出的是:以上存储介质和设备实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请存储介质和设备实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。It should be noted here that the above description of the storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。It should be understood that “one embodiment” or “one embodiment” mentioned throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Therefore, “in one embodiment” or “in one embodiment” appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence numbers of the above processes does not mean that the execution order is sequential, and the execution order of each process should be determined by its function and inherent logic, and should not be applied to the embodiments of the present application The implementation process constitutes no limitation. The sequence numbers of the above embodiments of the present application are for description only, and do not represent the advantages and disadvantages of the embodiments.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that in this article, the terms "include", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements It also includes other elements that are not explicitly listed, or include elements inherent to such processes, methods, objects, or devices. Without more restrictions, the element defined by the sentence "include one ..." does not exclude that there are other identical elements in the process, method, article or device that includes the element.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed device and method may be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and in actual implementation, there may be another division manner, for example, multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored, or not implemented. In addition, the coupling or direct coupling or communication connection between the displayed or discussed components may be through some interfaces, and the indirect coupling or communication connection of the device or unit may be electrical, mechanical, or other forms of.
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元;既可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, the functional units in the embodiments of the present application may all be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above integration The unit can be implemented in the form of hardware, or in the form of hardware plus software functional units.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art may understand that all or part of the steps to implement the above method embodiments may be completed by program instructions related hardware. The foregoing program may be stored in a computer-readable storage medium. When the program is executed, The steps of the above method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a read-only memory (Read Only Memory, ROM), a magnetic disk, or an optical disk.
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台电子设备 (可以是手机、平板电脑、台式机、个人数字助理、导航仪、数字电话、视频电话、电视机、传感设备、机顶盒等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the integrated unit described above is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or contribute to related technologies. The computer software products are stored in a storage medium and include several instructions to make An electronic device (which may be a mobile phone, tablet computer, desktop computer, personal digital assistant, navigator, digital phone, video phone, television, sensor device, set-top box, etc.) performs all or all of the methods described in the embodiments of this application or section. The foregoing storage media include various media that can store program codes, such as a mobile storage device, a ROM, a magnetic disk, or an optical disk.
以上所述,仅为本申请的实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only the implementation of this application, but the scope of protection of this application is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in this application. Covered within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
本申请实施例中,在第一设备需要与第二设备建立P2P连接时,如果所述第一设备中没有保存所述第二设备的P2P连接信息,此时所述第一设备不触发协商流程,也就是不发送协商请求给所述第二设备,而是直接将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,从而快速实现第一设备与第二设备的P2P连接。In the embodiment of the present application, when the first device needs to establish a P2P connection with the second device, if the first device does not save the P2P connection information of the second device, the first device does not trigger the negotiation process at this time , That is, without sending a negotiation request to the second device, but directly sending its own P2P connection information to the second device, to trigger the second device to send the P2P connection information based on the first device to The first device sends a first connection request, so as to quickly realize a P2P connection between the first device and the second device.
Claims (20)
- 一种连接建立方法,其中,所述方法包括:A connection establishment method, wherein the method includes:第一设备接收操作指令,所述操作指令用于指示所述第一设备与第二设备建立点对点P2P连接;The first device receives an operation instruction, where the operation instruction is used to instruct the first device to establish a point-to-point P2P connection with the second device;如果所述第一设备中没有保存所述第二设备的P2P连接信息,所述第一设备将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求;If the P2P connection information of the second device is not saved in the first device, the first device sends its own P2P connection information to the second device to trigger the second device based on the first Sending P2P connection information of the device to the first device;所述第一设备接收所述第一连接请求;The first device receives the first connection request;所述第一设备响应所述第一连接请求,与所述第二设备建立P2P连接。In response to the first connection request, the first device establishes a P2P connection with the second device.
- 根据权利要求1所述的方法,其中,在所述第一设备接收操作指令之后,所述方法还包括:The method according to claim 1, wherein after the first device receives the operation instruction, the method further comprises:如果所述第一设备中已保存所述第二设备的P2P连接信息,所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求,以请求与所述第二设备建立P2P连接;If the P2P connection information of the second device has been saved in the first device, the first device sends a second connection request to the second device based on the P2P connection information of the second device to request The second device establishes a P2P connection;如果所述第一设备在预设时长内接收到所述第二设备基于所述第二连接请求所反馈的连接响应,所述第一设备基于所述连接响应与所述第二设备建立P2P连接。If the first device receives a connection response fed back by the second device based on the second connection request within a preset duration, the first device establishes a P2P connection with the second device based on the connection response .
- 根据权利要求2所述的方法,其中,所述方法还包括:The method of claim 2, wherein the method further comprises:如果所述第一设备在预设时长内没有接收到所述第二设备基于所述第二连接请求所反馈的连接响应,所述第一设备将自身的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送所述第一连接请求。If the first device does not receive the connection response fed back by the second device based on the second connection request within a preset duration, the first device sends its own P2P connection information to the second device To trigger the second device to send the first connection request to the first device based on the P2P connection information of the first device.
- 根据权利要求1或3所述的方法,其中,所述第一设备将自身的P2P连接信息发送给所述第二设备,包括:The method according to claim 1 or 3, wherein the first device sending its own P2P connection information to the second device includes:如果所述第一设备与所述第二设备之间具有已建立的非P2P连接链路,所述第一设备通过所述非P2P连接链路将所述第一设备的P2P连接信息发送给所述第二设备;或者,If there is an established non-P2P connection link between the first device and the second device, the first device sends the P2P connection information of the first device to the station through the non-P2P connection link Describe the second device; or,如果所述第一设备与所述第二设备之间没有已建立的非P2P连接链路,所述第一设备广播自身的P2P连接信息;或者,If there is no established non-P2P connection link between the first device and the second device, the first device broadcasts its own P2P connection information; or,如果所述第一设备与所述第二设备之间没有已建立的非P2P连接链路,所述第一设备与所述第二设备建立所述非P2P连接链路,所述第一设备通过建立的非P2P连接链路将所述第一设备的P2P连接信息发送给所述第二设备。If there is no established non-P2P connection link between the first device and the second device, the first device establishes the non-P2P connection link with the second device, and the first device passes The established non-P2P connection link sends the P2P connection information of the first device to the second device.
- 根据权利要求4所述的方法,其中,所述第一设备与所述第二设备建立所述非P2P连接链路,包括:The method according to claim 4, wherein the establishment of the non-P2P connection link by the first device and the second device comprises:所述第一设备与所述第二设备建立蓝牙的套接口链路、或者红外链路、或者近距离无线通讯技术链路。The first device and the second device establish a Bluetooth socket link, or an infrared link, or a short-range wireless communication technology link.
- 根据权利要求4所述的方法,其中,所述方法还包括:The method according to claim 4, wherein the method further comprises:所述第一设备通过建立的非P2P连接链路将所述第一设备的P2P连接信息发送给所述第二设备之后,断开所述建立的非P2P连接链路。After the first device sends the P2P connection information of the first device to the second device through the established non-P2P connection link, the established non-P2P connection link is disconnected.
- 根据权利要求1所述的方法,其中,所述第一设备响应所述第一连接请求,与所述第二设备建立P2P连接,包括:The method of claim 1, wherein the first device establishing a P2P connection with the second device in response to the first connection request includes:所述第一设备响应所述第一连接请求,根据所述第一连接请求中携带的所述第二设备的P2P MAC地址,在所述第二设备工作的P2P信道上向所述第二设备发送第一连接响应,所述第一连接响应用于告知所述第二设备可以建立P2P连接;The first device responds to the first connection request and, according to the P2P MAC address of the second device carried in the first connection request, sends the second device a P2P channel on which the second device operates to the second device Sending a first connection response, where the first connection response is used to inform the second device that a P2P connection can be established;所述第一设备接收所述第二设备基于所述第一连接响应所返回的第二连接响应,以实现与所述第二设备建立P2P连接,所述第二连接响应用于告知所述第一设备P2P连接建立成功。The first device receives a second connection response returned by the second device based on the first connection response, to establish a P2P connection with the second device, and the second connection response is used to notify the first A device P2P connection is successfully established.
- 一种连接建立方法,其中,所述方法包括:A connection establishment method, wherein the method includes:第二设备接收第一设备的点对点P2P连接信息,所述第一设备的P2P连接信息是所述第一设备在没有保存所述第二设备的P2P连接信息时所发送的;The second device receives the point-to-point P2P connection information of the first device, and the P2P connection information of the first device is sent when the first device does not save the P2P connection information of the second device;如果所述第二设备的工作信道包括所述第一设备的P2P连接信息所指示的P2P信道,所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,以请求与所述第一设备建立P2P连接。If the working channel of the second device includes the P2P channel indicated by the P2P connection information of the first device, the second device sends the first device to the first device based on the P2P connection information of the first device Connection request to request establishment of a P2P connection with the first device.
- 根据权利要求8所述的方法,其中,所述第二设备基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,包括:The method according to claim 8, wherein the second device sending the first connection request to the first device based on the P2P connection information of the first device includes:如果所述第二设备当前是空闲的,基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求。If the second device is currently idle, based on the P2P connection information of the first device, send a first connection request to the first device.
- 根据权利要求9所述的方法,其中,所述方法还包括:The method of claim 9, wherein the method further comprises:如果所述第二设备当前没有和其他设备建立P2P连接,确定所述第二设备当前是空闲的;If the second device is not currently establishing a P2P connection with other devices, determine that the second device is currently idle;或者,如果所述第二设备当前和其他设备建立P2P连接,且所述其他设备的数量没有超出预设阈值,确定所述第二设备当前是空闲的。Or, if the second device currently establishes a P2P connection with other devices, and the number of the other devices does not exceed a preset threshold, it is determined that the second device is currently idle.
- 根据权利要求8所述的方法,其中,所述方法还包括:The method of claim 8, wherein the method further comprises:所述第二设备接收所述第一设备发送的第一连接响应,所述第一连接响应用于告知所述第二设备可以建立P2P连接;The second device receives a first connection response sent by the first device, where the first connection response is used to inform the second device that a P2P connection can be established;所述第二设备在接收到所述第一连接响应之后,返回第二连接响应给所述第一设备,所述第二连接响应用于告知所述第一设备P2P连接建立成功。After receiving the first connection response, the second device returns a second connection response to the first device, and the second connection response is used to notify the first device that the P2P connection is successfully established.
- 根据权利要求5所述的方法,其中,所述方法还包括:The method of claim 5, wherein the method further comprises:如果所述第二设备的工作信道不包括所述第一设备的P2P连接信息所指示的P2P信道,所述第二设备将自身的P2P连接信息发送给所述第一设备,以触发所述第一设备基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求,以请求与所述第二设备建立P2P连接。If the working channel of the second device does not include the P2P channel indicated by the P2P connection information of the first device, the second device sends its own P2P connection information to the first device to trigger the first A device sends a second connection request to the second device based on the P2P connection information of the second device to request to establish a P2P connection with the second device.
- 根据权利要求12所述的方法,其中,所述第二设备将自身的P2P连接信息发送给所述第一设备,包括:The method according to claim 12, wherein the second device sending its own P2P connection information to the first device comprises:如果所述第二设备与所述第一设备之间具有已建立的非P2P连接链路,所述第二设备通过所述非P2P连接链路将所述第二设备的P2P连接信息发送给所述第一设备;或者,If there is an established non-P2P connection link between the second device and the first device, the second device sends the P2P connection information of the second device to the station through the non-P2P connection link Describe the first device; or,如果所述第二设备与所述第一设备之间没有已建立的非P2P连接链路,所述第二设备广播自身的P2P连接信息;或者,If there is no established non-P2P connection link between the second device and the first device, the second device broadcasts its own P2P connection information; or,如果所述第二设备与所述第一设备之间没有已建立的非P2P连接链路,所述第二设备与所述第一设备建立所述非P2P连接链路,所述第二设备通过建立的非P2P连接链路将所述第二设备的P2P连接信息发送给所述第一设备。If there is no established non-P2P connection link between the second device and the first device, the second device establishes the non-P2P connection link with the first device, and the second device passes The established non-P2P connection link sends the P2P connection information of the second device to the first device.
- 一种连接建立装置,其中,所述装置包括:A connection establishment device, wherein the device includes:第一接收模块,配置为接收操作指令,所述操作指令用于指示所述连接建立装置与第二设备建立点对点P2P连接;The first receiving module is configured to receive an operation instruction used to instruct the connection establishment device to establish a point-to-point P2P connection with the second device;第一发送模块,配置为如果所述连接建立装置中没有保存所述第二设备的P2P连接信息,将所述连接建立装置的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述连接建立装置的P2P连接信息,向所述连接建立装置发送第一连接请求;The first sending module is configured to, if the P2P connection information of the second device is not saved in the connection establishment device, send the P2P connection information of the connection establishment device to the second device to trigger the second The device sends a first connection request to the connection establishment device based on the P2P connection information of the connection establishment device;第二接收模块,配置为接收所述第一连接请求;A second receiving module, configured to receive the first connection request;连接建立模块,配置为响应所述第一连接请求,与所述第二设备建立P2P连接。The connection establishment module is configured to establish a P2P connection with the second device in response to the first connection request.
- 根据权利要求14所述的装置,其中,The apparatus according to claim 14, wherein所述第一发送模块,还配置为:如果所述装置中已保存所述第二设备的P2P连接信息,基于所述第二设备的P2P连接信息,向所述第二设备发送第二连接请求,以请求与所述第二设备建立P2P连接;The first sending module is further configured to: if the device has saved the P2P connection information of the second device, send a second connection request to the second device based on the P2P connection information of the second device To request to establish a P2P connection with the second device;所述连接建立模块,还配置为:如果在预设时长内接收到所述第二设备基于所述第二连接请求所反馈的连接响应,基于所述连接响应与所述第二设备建立P2P连接。The connection establishment module is further configured to: if a connection response fed back by the second device based on the second connection request is received within a preset duration, establish a P2P connection with the second device based on the connection response .
- 根据权利要求15所述的装置,其中,所述第一发送模块,还配置为:The apparatus according to claim 15, wherein the first sending module is further configured to:如果在预设时长内没有接收到所述第二设备基于所述第二连接请求所反馈的连接响应,将所述装置的P2P连接信息发送给所述第二设备,以触发所述第二设备基于所述装置的P2P连接信息,向所述装置发送所述第一连接请求。If the connection response fed back by the second device based on the second connection request is not received within a preset time period, send the P2P connection information of the apparatus to the second device to trigger the second device Based on the P2P connection information of the device, sending the first connection request to the device.
- 一种连接建立装置,其中,所述装置包括:A connection establishment device, wherein the device includes:第三接收模块,配置为接收第一设备的点对点P2P连接信息,所述第一设备的P2P连接信息是所述第一设备在没有保存所述连接建立装置的P2P连接信息时所发送的;The third receiving module is configured to receive the point-to-point P2P connection information of the first device, and the P2P connection information of the first device is sent when the first device does not save the P2P connection information of the connection establishment device;第二发送模块,配置为如果所述连接建立装置的工作信道包括所述第一设备的P2P连接信息所指示的P2P信道,基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求,以请求与所述第一设备建立P2P连接。A second sending module, configured to send to the first device based on the P2P connection information of the first device if the working channel of the connection establishment device includes the P2P channel indicated by the P2P connection information of the first device A first connection request to request to establish a P2P connection with the first device.
- 根据权利要求17所述的装置,其中,所述第二发送模块,配置为:如果所述装置当前是空闲的,基于所述第一设备的P2P连接信息,向所述第一设备发送第一连接请求。The apparatus according to claim 17, wherein the second sending module is configured to: if the apparatus is currently idle, send the first to the first device based on the P2P connection information of the first device Connection request.
- 一种电子设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现权利要求1至7任一项所述的连接建立方法中的步骤;或者,所述处理器执行所述程序时实现权利要求8至13任一项所述的连接建立方法中的步骤。An electronic device, including a memory and a processor, the memory storing a computer program that can run on the processor, wherein the processor implements the program to achieve the connection of any one of claims 1 to 7 The steps in the establishment method; or, when the processor executes the program, the steps in the connection establishment method according to any one of claims 8 to 13 are implemented.
- 一种计算机可读存储介质,其上存储有计算机程序,其中,该计算机程序被处理器执行时实现权利要求1至7任一项所述的连接建立方法中的步骤;或者,该计算机程序被处理器执行时实现权利要求8至13任一项所述的连接建立方法中的步骤。A computer-readable storage medium on which a computer program is stored, wherein, when the computer program is executed by a processor, the steps in the connection establishment method according to any one of claims 1 to 7 are realized; or, the computer program is When executed by the processor, the steps in the connection establishment method according to any one of claims 8 to 13 are implemented.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811409098.0A CN109587667B (en) | 2018-11-23 | 2018-11-23 | A connection establishment method and device, device, and storage medium |
CN201811409098.0 | 2018-11-23 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020103592A1 true WO2020103592A1 (en) | 2020-05-28 |
Family
ID=65924377
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/110204 WO2020103592A1 (en) | 2018-11-23 | 2019-10-09 | Method for establishing connection, apparatus, device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109587667B (en) |
WO (1) | WO2020103592A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP4030794A3 (en) * | 2021-06-08 | 2022-11-30 | Apollo Intelligent Connectivity (Beijing) Technology Co., Ltd. | Method and apparatus for interconnecting vehicle and machine |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109587667B (en) * | 2018-11-23 | 2021-06-18 | Oppo广东移动通信有限公司 | A connection establishment method and device, device, and storage medium |
CN112312586B (en) * | 2019-08-02 | 2023-01-17 | Oppo广东移动通信有限公司 | WiFi direct connection establishing method, device, equipment and storage medium |
CN112351411B (en) * | 2019-08-09 | 2024-06-25 | 荣耀终端有限公司 | Information transmission method and electronic device |
CN111372325B (en) * | 2020-02-21 | 2022-04-26 | 华为技术有限公司 | Method and device for establishing Wi-Fi point-to-point connection |
CN114390337B (en) * | 2020-10-21 | 2023-06-02 | 华为技术有限公司 | Screen projection method and system and electronic equipment |
CN114679732B (en) * | 2020-12-24 | 2024-08-27 | 华为技术有限公司 | Wi-Fi direct connection data transmission method and electronic equipment |
CN114697934A (en) * | 2020-12-31 | 2022-07-01 | 华为技术有限公司 | Method, equipment and system for transmitting data in near field |
CN115315025B (en) * | 2021-05-08 | 2024-12-13 | 广州视源电子科技股份有限公司 | Device connection method, device, device and storage medium |
CN115515254A (en) * | 2021-06-23 | 2022-12-23 | Oppo广东移动通信有限公司 | Point-to-point connection establishment method, device, storage medium and electronic equipment |
CN113709555B (en) * | 2021-08-27 | 2023-03-21 | 联想(北京)有限公司 | Wireless video connection method, device and system |
CN114364026B (en) * | 2021-08-27 | 2023-05-12 | 华为技术有限公司 | Communication method and electronic equipment |
CN113873685B (en) * | 2021-09-22 | 2024-02-06 | 深圳Tcl新技术有限公司 | Method, device and equipment for establishing WiFi direct connection |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014031238A1 (en) * | 2012-08-24 | 2014-02-27 | Intel Corporation | Methods and arrangements to relay packets via wi-fi direct |
CN103813473A (en) * | 2014-01-17 | 2014-05-21 | 深圳市金立通信设备有限公司 | Communication method, terminal and system |
CN104540088A (en) * | 2014-12-23 | 2015-04-22 | 小米科技有限责任公司 | Connection establishment method, terminal and device |
CN104936258A (en) * | 2015-06-17 | 2015-09-23 | 青岛海信移动通信技术股份有限公司 | Network access method, terminal and system |
CN109587667A (en) * | 2018-11-23 | 2019-04-05 | Oppo广东移动通信有限公司 | A connection establishment method and device, device, and storage medium |
Family Cites Families (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20130029237A (en) * | 2011-09-14 | 2013-03-22 | 삼성전자주식회사 | Device and method for connecting device in wireless terminal |
KR101842047B1 (en) * | 2012-03-15 | 2018-03-26 | 삼성전자주식회사 | Method and apparatus for group profile management in wi-fi direct communication system |
US9674643B2 (en) * | 2014-03-17 | 2017-06-06 | Intel IP Corporation | Method, apparatus, and computer readable medium for switching between lower energy and higher energy wireless communication techniques |
CN105451367A (en) * | 2014-08-27 | 2016-03-30 | 华为技术有限公司 | Wireless network connection method, device and system |
CN105704837B (en) * | 2014-11-28 | 2020-02-14 | 华为终端有限公司 | Method and equipment for establishing wireless connection |
US10805781B2 (en) * | 2015-03-05 | 2020-10-13 | Samsung Electronics Co., Ltd. | Method and apparatus for establishing a connection between devices |
CN110602223B (en) * | 2015-06-15 | 2021-10-15 | 展讯通信(上海)有限公司 | Point-to-point equipment and search matching method thereof |
WO2017115397A1 (en) * | 2015-12-28 | 2017-07-06 | Nec Corporation | Method system and device for fast initial link setup in wireless peer to peer network |
KR102487534B1 (en) * | 2016-02-24 | 2023-01-11 | 삼성전자주식회사 | Display apparatus and method for setting a operating channel |
JP6700969B2 (en) * | 2016-05-20 | 2020-05-27 | キヤノン株式会社 | Communication device, control method thereof, and program |
JP6746427B2 (en) * | 2016-08-10 | 2020-08-26 | キヤノン株式会社 | Communication device, communication method, and program |
CN106791069A (en) * | 2016-12-14 | 2017-05-31 | 努比亚技术有限公司 | Terminal connection device and method |
CN106714132B (en) * | 2017-01-24 | 2020-02-14 | 深圳创维-Rgb电子有限公司 | Intelligent display terminal, intelligent equipment, intelligent interaction method and system |
CN107018554B (en) * | 2017-03-07 | 2020-11-06 | Oppo广东移动通信有限公司 | Data transmission method and device and intelligent terminal |
-
2018
- 2018-11-23 CN CN201811409098.0A patent/CN109587667B/en active Active
-
2019
- 2019-10-09 WO PCT/CN2019/110204 patent/WO2020103592A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014031238A1 (en) * | 2012-08-24 | 2014-02-27 | Intel Corporation | Methods and arrangements to relay packets via wi-fi direct |
CN103813473A (en) * | 2014-01-17 | 2014-05-21 | 深圳市金立通信设备有限公司 | Communication method, terminal and system |
CN104540088A (en) * | 2014-12-23 | 2015-04-22 | 小米科技有限责任公司 | Connection establishment method, terminal and device |
CN104936258A (en) * | 2015-06-17 | 2015-09-23 | 青岛海信移动通信技术股份有限公司 | Network access method, terminal and system |
CN109587667A (en) * | 2018-11-23 | 2019-04-05 | Oppo广东移动通信有限公司 | A connection establishment method and device, device, and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP4030794A3 (en) * | 2021-06-08 | 2022-11-30 | Apollo Intelligent Connectivity (Beijing) Technology Co., Ltd. | Method and apparatus for interconnecting vehicle and machine |
Also Published As
Publication number | Publication date |
---|---|
CN109587667B (en) | 2021-06-18 |
CN109587667A (en) | 2019-04-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020103592A1 (en) | Method for establishing connection, apparatus, device and storage medium | |
JP6170310B2 (en) | Peer-to-peer device search method and apparatus in wireless communication network, and device communication method | |
JP6424253B2 (en) | Method and apparatus for relaying data communication in a Bluetooth network | |
CN108419226B (en) | Method for connecting Bluetooth devices and Bluetooth devices | |
KR101736325B1 (en) | Wireless docking service with direct connection to peripherals | |
JP6480481B2 (en) | Device connection apparatus and method in portable terminal | |
WO2020132922A1 (en) | Method and device for connecting bluetooth devices | |
US11357061B2 (en) | System and method of connecting devices via Wi-Fi network | |
CN104469980B (en) | Bluetooth connecting method and bluetooth equipment | |
US9942759B2 (en) | Communication apparatus | |
WO2020134720A1 (en) | Data transmission control method and related product | |
KR101763171B1 (en) | Apparatus and method for connecting peer to peer between a mobile terminal | |
CN111866824A (en) | A method and device for establishing a communication connection and data transmission | |
WO2020221308A1 (en) | Pc5 link establishment method, device and system | |
CN106445739A (en) | A data migration method and terminal equipment | |
CN106454975A (en) | Hotspot network switching method and terminal equipment | |
AU2018427289B2 (en) | Transmission control method and device | |
WO2020093842A1 (en) | Cell switching method, terminal and communication node | |
KR20220045180A (en) | Multimedia broadcast multicast service configuration method, terminal and network-side device | |
US9900829B2 (en) | Communication device, method for controlling the communication device, and program | |
CN114375032A (en) | Data processing method and user equipment | |
CN104378505A (en) | Conference mode setting method and device | |
CN112788772B (en) | Beam failure recovery confirmation method, terminal equipment and storage medium | |
JP2013143627A (en) | Data transmission device and data reception device | |
WO2022147756A1 (en) | Communication method and device, and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19886264 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19886264 Country of ref document: EP Kind code of ref document: A1 |