Equipment connection method and device, electronic equipment and storage medium
By establishing a first communication connection, determining a role and sending configuration information during the device connection process, the problems of low efficiency and insufficient security of the device connection are solved, and a more efficient and secure device connection is achieved.
Patent Information
- Application Number
- CN202311359689.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-19
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, the equipment discovery and equipment connection efficiency are low during the equipment connection process, and there is a problem of using unsafe protocols.
By establishing a first communication connection between the first device and the second device, negotiation information is sent to determine the role, and configuration information is sent after determining the group owner and the group client to establish the second communication connection.
Reduces the time for device discovery and device connection, improves the efficiency and security of device connection, and avoids the use of unsafe protocols.
Smart Images

Figure CN119865930A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of device connection, and in particular to a device connection method, device, electronic device and storage medium. Background Art
[0002] P2P (peer-to-peer, point-to-point direct connection technology) connection is a direct connection between at least two electronic devices, without the need for a server or other intermediary device. In the related art, when two electronic devices need to connect, the two electronic devices first go through the device discovery phase, the negotiation phase, and the WSC (Wi-Fi Simple Configuration) interaction phase, and then enter the connection phase. It takes a long time from device discovery to device connection, and the efficiency of device discovery and device connection is relatively low. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides a device connection method, an apparatus, an electronic device and a storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, a device connection method is provided, which is applied to a first device, and the method includes:
[0005] Establishing a first communication connection with a second device;
[0006] Sending first negotiation information to the second device through the first communication connection, where the first negotiation information is used to determine a role of the first device and a role of the second device, where the roles include a group owner or a group client;
[0007] In response to determining that the first device is the group owner and the second device is the group client, sending configuration information to the second device through the first communication connection, the configuration information including information required to establish a second communication connection;
[0008] Establishing the second communication connection with the second device.
[0009] In some embodiments, before establishing the first communication connection with the second device, the method further includes:
[0010] The second device that can be connected is determined by short-range communication.
[0011] In some embodiments, in response to determining that the first device is the group owner and the second device is the group client, before sending configuration information to the second device through the first communication connection, the method further includes:
[0012] receiving, through the first communication connection, second negotiation information sent by the second device, where the second negotiation information is used to determine a role of the first device and a role of the second device;
[0013] Based on the first negotiation information and the second negotiation information, a role of the first device and a role of the second device are determined.
[0014] In some embodiments, the first negotiation information includes at least one of the device type of the first device, the frequency band supported by the first device, and the communication channel supported by the first device, and the second protocol information includes at least one of the device type of the second device, the frequency band supported by the second device, and the communication channel supported by the second device.
[0015] In some embodiments, establishing the second communication connection with the second device includes:
[0016] receiving a connection request sent by the second device;
[0017] In response to the connection request, establishing the second communication connection with the second device.
[0018] In some embodiments, before sending the configuration information to the second device through the first communication connection, the method further includes:
[0019] The configuration information is generated, wherein the configuration information at least includes a service set identifier and password information.
[0020] According to a second aspect of an embodiment of the present disclosure, a device connection method is provided, which is applied to a second device, and the method includes:
[0021] Establishing a first communication connection with a first device;
[0022] Sending second negotiation information to the first device through the first communication connection, where the second negotiation information is used to determine a role of the first device and a role of the second device, where the roles include a group owner or a group client;
[0023] In response to determining that the first device is the group owner and the second device is the group client, receiving configuration information sent by the first device through the first communication connection, the configuration information including information required to establish a second communication connection;
[0024] Establishing the second communication connection with the first device.
[0025] In some embodiments, before establishing the first communication connection with the first device, the method further includes:
[0026] Determine the first device that can be connected through short-range communication.
[0027] In some embodiments, in response to determining that the first device is the group owner and the second device is the group client, before receiving the configuration information sent by the first device through the first communication connection, the method further includes:
[0028] receiving, through the first communication connection, first negotiation information sent by the first device, where the first negotiation information is used to determine a role of the first device and a role of the second device;
[0029] Based on the first negotiation information and the second negotiation information, a role of the first device and a role of the second device are determined.
[0030] In some embodiments, the first negotiation information includes at least one of the device type of the first device, the frequency band supported by the first device, and the communication channel supported by the first device, and the second protocol information includes at least one of the device type of the second device, the frequency band supported by the second device, and the communication channel supported by the second device.
[0031] In some embodiments, establishing the second communication connection with the first device includes:
[0032] Perform channel scanning based on the configuration information;
[0033] In response to scanning the first device, a connection request is sent to the first device to establish the second communication connection with the first device.
[0034] In some embodiments, the configuration information includes at least a service set identifier and password information.
[0035] According to a third aspect of an embodiment of the present disclosure, there is provided a device connection apparatus, which is configured on a first device, and the apparatus includes:
[0036] A first connection establishing module, configured to establish a first communication connection with a second device;
[0037] a negotiation information sending module, configured to send first negotiation information to the second device through the first communication connection, wherein the first negotiation information is used to determine a role of the first device and a role of the second device, wherein the roles include a group owner or a group client;
[0038] a configuration information sending module, configured to, in response to determining that the first device is the group owner and the second device is the group client, send configuration information to the second device through the first communication connection, the configuration information including information required to establish a second communication connection;
[0039] The second connection establishing module is configured to establish the second communication connection with the second device.
[0040] According to a fourth aspect of an embodiment of the present disclosure, there is provided a device connection apparatus, which is configured on a second device, and the apparatus includes:
[0041] A first connection establishing module, configured to establish a first communication connection with a first device;
[0042] a negotiation information sending module, configured to send second negotiation information to the first device through the first communication connection, wherein the second negotiation information is used to determine a role of the first device and a role of the second device, wherein the roles include a group owner or a group client;
[0043] a configuration information receiving module, configured to, in response to determining that the first device is the group owner and the second device is the group client, receive configuration information sent by the first device through the first communication connection, the configuration information including information required to establish a second communication connection;
[0044] The second connection establishing module is configured to establish the second communication connection with the first device.
[0045] According to a fifth aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0046] processor;
[0047] a memory for storing processor-executable instructions;
[0048] The processor is configured to execute the method as described in the first aspect or the second aspect of the embodiment of the present disclosure.
[0049] According to the sixth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the method described in the first aspect or the second aspect of the embodiment of the present disclosure.
[0050] The above method of the present disclosure has the following beneficial effects:
[0051] In the method provided by the embodiment of the present disclosure, the first device first establishes a first communication connection with the second device, and sends first negotiation information to the second device through the first communication connection to determine the role of the first device and the role of the second device. In response to determining that the first device is the group owner and the second device is the group client, the configuration information is sent to the second device through the first communication connection, and the configuration information includes information required to establish the second communication connection, and the second communication connection is established with the second device. The first device and the second device interact through the first communication connection established in advance, which can reduce the time of device discovery and device connection when establishing the second communication connection, improve the efficiency of device discovery and device connection, and can also avoid the use of unsafe protocols, thereby improving the security and success rate of communication connections.
[0052] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0054] Figure 1 is a flow chart showing a device connection method according to an exemplary embodiment;
[0055] Figure 2 is a flow chart showing another device connection method according to an exemplary embodiment;
[0056] Figure 3 A flowchart of another device connection method according to an exemplary embodiment;
[0057] Figure 4 is a flow chart showing another device connection method according to an exemplary embodiment;
[0058] Figure 5 is a block diagram of a device connection apparatus according to an exemplary embodiment;
[0059] Figure 6 is a block diagram of another device connection apparatus according to an exemplary embodiment;
[0060] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0061] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0062] The device connection method provided by the embodiment of the present disclosure is applied to scenarios where different devices are interconnected. For example, scenarios where different devices are interconnected include: screen projection, file transfer, etc. between different devices.
[0063] The method provided by the embodiments of the present disclosure may be executed by a first device and a second device. The first device and the second device may be devices of the same type or devices of different types. For example, the first device and the second device may be mobile phones, tablet computers, laptop computers, desktop computers, smart home devices, vehicle-mounted terminals, televisions, projectors and other devices.
[0064] Below through Figure 1 and Figure 2 The embodiment shown describes the device connection process from the perspectives of the first device and the second device respectively:
[0065] Figure 1 is a flowchart of a device connection method according to an exemplary embodiment, which is executed by a first device, see Figure 1 , the method comprises the following steps:
[0066] Step S101: Establish a first communication connection with a second device.
[0067] The first communication connection is an OOB (Out of Band) connection. For example, the first communication connection can be any one of a local area network connection, a Bluetooth (BT) connection, a BLE (Bluetooth Low Energy) connection, an NFC (Near Field Communication) connection, and a QR code connection.
[0068] Step S102: sending first negotiation information to the second device through the first communication connection, where the first negotiation information is used to determine a role of the first device and a role of the second device, where the roles include a group owner or a group client.
[0069] After the first device establishes a first communication connection with the second device, the first device and the second device can interact through the first communication connection. In order to subsequently establish a second communication connection between the first device and the second device, the first device and the second device first negotiate to determine the role of the first device and the role of the second device, and the roles include a group owner (GroupOwner, GO) and a group client (Group Client, GC).
[0070] In order to negotiate with the second device, the first device sends first negotiation information to the second device. The first negotiation information is used to determine the role of the first device and the role of the second device. The first negotiation information is used to characterize the capabilities and status of the first device itself, that is, the first negotiation information is used to characterize whether the first device supports establishing a second communication connection, and the role that the first device can play.
[0071] Step S103, in response to determining that the first device is the group owner and the second device is the group client, sending configuration information to the second device through the first communication connection, the configuration information including information required to establish a second communication connection.
[0072] In the embodiment of the present disclosure, the first device and the second device can determine the role of the first device and the role of the second device through negotiation. When it is determined that the first device is a GO and the second device is a GC, the first device, as a GO, can actively send configuration information to the second device connected to the first device. The configuration information includes information required to establish a second communication connection, so that the first device can communicate with the first device based on the configuration information when it is necessary to establish a second communication connection with the first device.
[0073] Optionally, the configuration information includes at least one of a service set identifier (SSID), password information, a communication channel, and address information of the first device. The service set identifier is used to characterize the network to which the first device is connected, the password information is the password required to connect to the first device, the communication channel is the channel occupied when the first device establishes a second communication connection with other devices, and the address information may be a MAC (Media Access Control) address or an IP address.
[0074] Step S104: Establish a second communication connection with a second device.
[0075] After the first device sends configuration information to the second device, the first device and the second device can establish a second communication connection based on the configuration information, the second communication connection is different from the first communication connection, and the first communication connection and the second communication connection are independent of each other. The second communication connection can be a P2P connection.
[0076] In the method provided by the embodiment of the present disclosure, the first device first establishes a first communication connection with the second device, and sends first negotiation information to the second device through the first communication connection to determine the role of the first device and the role of the second device. In response to determining that the first device is the group owner and the second device is the group client, the configuration information is sent to the second device through the first communication connection, and the configuration information includes information required to establish the second communication connection, and the second communication connection is established with the second device. The first device and the second device interact through the first communication connection established in advance, which can reduce the time of device discovery and device connection when establishing the second communication connection, improve the efficiency of device discovery and device connection, and can also avoid the use of unsafe protocols, thereby improving the security and success rate of communication connections.
[0077] Figure 2 is a flowchart of another device connection method according to an exemplary embodiment, which is executed by the second device. Figure 2 , the method comprises the following steps:
[0078] Step S201: Establish a first communication connection with a first device.
[0079] Step S202: Send second negotiation information to the first device through the first communication connection, where the second negotiation information is used to determine a role of the first device and a role of the second device, where the roles include a group owner or a group client.
[0080] The operations performed by the second device in steps S201 and S202 are the same as the operations performed by the first device in the above steps S101 and S102. The implementation methods refer to the above steps S101 and S102 and are not repeated here.
[0081] The second negotiation information is used to determine the role of the first device and the role of the second device. The second negotiation information is used to characterize the capabilities and status of the second device itself, that is, the second negotiation information is used to characterize whether the second device supports establishing a second communication connection and the role that the second device can play.
[0082] Step S203, in response to determining that the first device is the group owner and the second device is the group client, receiving configuration information sent by the first device through the first communication connection, the configuration information including information required to establish a second communication connection.
[0083] In the embodiment of the present disclosure, the first device and the second device can determine the role of the first device and the role of the second device through negotiation. When the first device is determined to be a GO and the second device is a GC, the second device, as a GC, can receive configuration information sent by the first device, and the configuration information includes information required to establish a second communication connection, so that the first device can establish a communication connection with the first device based on the configuration information when it needs to establish a second communication connection with the first device. For an explanation of the configuration information, see the above step S103, which will not be introduced here.
[0084] Step S204: Establish a second communication connection with the first device.
[0085] The implementation of step S204 refers to the above step S104 and will not be described in detail here.
[0086] In the method provided by the embodiment of the present disclosure, the second device first establishes a first communication connection with the second device, sends second negotiation information to the first device through the first communication connection to determine the role of the first device and the role of the second device, and in response to determining that the first device is the group owner and the second device is the group client, receives the configuration information sent by the first device through the first communication connection, the configuration information includes the information required to establish the second communication connection, and establishes the second communication connection with the first device. The first device and the second device interact through the first communication connection established in advance, which can reduce the time of device discovery and device connection when establishing the second communication connection, improve the efficiency of device discovery and device connection, and can also avoid the use of unsafe protocols, thereby improving the security and success rate of communication connections.
[0087] Figure 3 A flowchart of another device connection method according to an exemplary embodiment is shown, which is executed by a first device and a second device. Figure 3 , the method comprises the following steps:
[0088] Step S301: A first device establishes a first communication connection with a second device.
[0089] Before a first device establishes a first communication connection with a second device, the first device and the second device need to discover each other, that is, the first device determines a second device that can establish a communication connection with the first device, and the second device determines a first device that can establish a communication connection with the second device, and the first device and the second device need to use the same communication method to discover each other.
[0090] In some embodiments, for a first device, the first device determines a connectable second device through a short-distance communication method, and for a second device, the second device determines a connectable first device through a short-distance communication method. The short-distance communication method includes Bluetooth, BLE, local area network, NFC, QR code, etc., and the short-distance communication method used by the first device and the second device is the same.
[0091] In some embodiments, the first communication connection established between the first device and the second device is related to the short-range communication method adopted by the first device and the second device. For example, if the first device and the second device discover each other through BLE, the first device and the second device establish a BLE connection; or if the first device and the second device discover each other through a local area network, the first device and the second device establish a local area network connection.
[0092] Step S302: The first device sends first negotiation information to the second device through the first communication connection.
[0093] The first negotiation information is used to determine the role of the first device and the role of the second device.
[0094] In some embodiments, the first negotiation information includes at least one of a device type of the first device, a frequency band supported by the first device, and a communication channel supported by the first device.
[0095] For the device type of the first device, some devices (for example, tablet computers) can act as both GO and GC, some devices (for example, mobile phones) can act as GO but not GC, and some devices (for example, projectors) can act as GC but not GO. Therefore, the device type of the first device is included in the first negotiation information, so that it can be determined whether the first device can act as GC or GC based on the device type of the first device.
[0096] For the frequency band and communication channel supported by the first device, the frequency band and communication channel supported by the first device can indicate the communication mode and communication performance supported by the first device. For example, if the first device supports the 5GHz channel, then the communication performance in the subsequent communication process is significantly better than that of the 2.4GHz channel.
[0097] Of course, in some embodiments, the first negotiation information may also include other information. For example, if the first device and the second device discover each other through a QR code, the first negotiation information may also include information on whether the first device is the scanner or the scanned device of the QR code.
[0098] Step S303: The second device receives first negotiation information sent by the first device through the first communication connection.
[0099] Step S304: The second device sends second negotiation information to the first device through the first communication connection.
[0100] The second negotiation information is used to determine the role of the first device and the role of the second device.
[0101] In some embodiments, the second negotiation information includes at least one of a device type of the second device, a frequency band supported by the second device, and a communication channel supported by the second device.
[0102] Regarding the device type of the second device, some devices (for example, tablet computers) can act as both GO and GC, some devices (for example, mobile phones) can act as GO but not GC, and some devices (for example, projectors) can act as GC but not GO. Therefore, the device type of the second device is included in the second negotiation information, so that it can be determined whether the second device can act as GC or GC based on the device type of the second device.
[0103] For the frequency band and communication channel supported by the second device, the frequency band and communication channel supported by the second device can indicate the communication mode and communication performance supported by the second device. For example, if the second device supports the 5GHz channel, then the communication performance during the subsequent communication process is significantly better than that of the 2.4GHz channel.
[0104] Of course, in some embodiments, the second negotiation information may also include other information. For example, if the first device and the second device discover each other through a QR code, the second negotiation information may also include information on whether the second device is the scanner or the scanned device of the QR code.
[0105] Step S305: The first device receives second negotiation information sent by the second device through the first communication connection.
[0106] It should be noted that the embodiment of the present disclosure is only described by taking the example of first executing steps S302 and S303 and then executing steps S304 and S305. In another embodiment, steps S304 and S305 may be executed first, and then steps S302 and S303, or steps S302 and S303, and steps S304 and S305 may be executed simultaneously.
[0107] Step S306: The first device and the second device determine a role of the first device and a role of the second device based on the first negotiation information and the second negotiation information.
[0108] In the embodiment of the present disclosure, the first device and the second device negotiate a role of the first device and a role of the second device based on the first negotiation information and the second negotiation information.
[0109] In one example, the first device determines that the first device is a GO based on the first negotiation information and the second negotiation information, and sends information that the first device is a GO to the second device. When the second device returns confirmation information to the first device, it indicates that the second device agrees that the first device is a GO. Therefore, it can be determined that the first device is a GO and the second device is a GC.
[0110] In another example, the first device is connected to the second device by scanning a QR code presented by the second device. In this case, the first device may be defaulted to be a GO and the second device may be defaulted to be a GC.
[0111] Of course, the first device and the second device may also adopt other methods to negotiate the role of the first device and the role of the second device, which will not be described in detail in the embodiment of the present disclosure.
[0112] Step S307: in response to determining that the first device is the group owner and the second device is the group client, the first device sends configuration information to the second device through the first communication connection.
[0113] The embodiment of the present disclosure is described by taking the first device being a GO and the second device being a GC as an example.
[0114] When the first device is a GO, the first device generates configuration information and sends the configuration information to the second device. The configuration information includes at least a service set identifier and password information. Optionally, the configuration information also includes a communication channel and address information of the first device. The service set identifier is used to characterize the network to which the first device is connected, the password information is the password required to connect to the first device, the communication channel is the channel occupied when the first device establishes a second communication connection with other devices, and the address information can be a MAC address or an IP address. Optionally, the communication channel can be represented by a center frequency (Frequency), or the communication channel can be directly represented by a channel, for example, the communication channel is directly represented as a 36 channel.
[0115] In some embodiments, in order to improve the security of configuration information, when generating configuration information, the service set identifier and password information can be randomly generated. Alternatively, the service set identifier and password information are set by the user. For example, the first device displays a configuration interface to the user, and the user can enter the service set identifier and password information in the configuration interface. Setting by the user can not only improve security, but also allow the user to perform customized configuration as needed, thereby improving the user experience.
[0116] In some embodiments, in order to improve the performance of the second communication connection, when generating the configuration information, a 5 GHz channel or a channel of other high frequency bands may be configured, or the same channel as the current WLAN (Wireless Lan, wireless local area network) may be configured.
[0117] In addition, in some embodiments, in order to improve the security of configuration information transmission, the configuration information may be encrypted and the encrypted configuration information may be sent to the second device.
[0118] Step S308: In response to determining that the first device is the group owner and the second device is the group client, the second device receives the configuration information sent by the first device through the first communication connection.
[0119] Step S309: The second device performs channel scanning based on the configuration information, and in response to scanning the first device, sends a connection request to the first device to establish a second communication connection with the first device.
[0120] After receiving the configuration information, the second device may perform channel scanning based on the configuration information, for example, based on the communication channel in the configuration information, perform channel scanning on the communication channel, thereby scanning the first device. Optionally, after receiving the encrypted configuration information, the second device decrypts the encrypted configuration information to obtain the decrypted configuration information, and performs channel scanning based on the decrypted configuration information.
[0121] The connection request is used to request to establish a second communication connection with the first device. The second device sends a connection request to the first device, the first device receives the connection request, and in response to the connection request, the first device establishes a second communication connection with the second device.
[0122] In some embodiments, the second device sends an authentication request (Auth Req) to the first device, where the authentication request is used to request authentication of the second device. The first device receives the authentication request, and in response to the authentication request, returns an authentication success notification (Auth Resp) to the second device. In response to receiving the authentication success notification, the second device sends an association request (Assoc Req) to the first device. The first device receives the association request, and in response to the association request, returns an association notification (Assoc Resp) to the second device. After that, the second device performs a 4-way handshake (4way-handshake) with the first device, and the second communication connection between the first device and the second device is established.
[0123] In the method provided by the embodiment of the present disclosure, the first device and the second device interact through the first communication connection established in advance, which can reduce the time of device discovery and device connection when establishing the second communication connection, improve the efficiency of device discovery and device connection, and avoid the use of unsafe protocols, thereby improving the security and success rate of the communication connection. In addition, in the process of establishing the second communication connection, the connection discovery process can be reduced, and the use of unsafe and unstable protocols (for example, WSC protocol) can be avoided, thereby improving the security of the subsequent communication process and increasing the success rate of establishing the second communication connection.
[0124] In one example, the first communication connection is an OOB connection, and the second communication connection is a P2P connection, see Figure 4 The flowchart of the device connection method shown is executed by the first device and the second device, and includes the following steps:
[0125] Step 1: A first device establishes an OOB connection with a second device.
[0126] Step 2: The first device obtains first negotiation information and sends it to the second device through an OOB message; the second device obtains second negotiation information and sends it to the first device through an OOB message.
[0127] Among them, through the OOB message means sending the negotiation information to the peer end in the form of the OOB message through the OOB connection.
[0128] Step 3: The first device determines that the role of the first device is a GO based on the first negotiation information and the second negotiation information.
[0129] Step 4: The second device determines that the role of the second device is GC based on the first negotiation information and the second negotiation information.
[0130] Step 5: The first device generates configuration information and starts GO.
[0131] Step 6: After the first device successfully starts GO, it sends configuration information to the second device via an OOB message.
[0132] Step 7: The second device initiates single-channel scanning and connects to the first device according to the configuration information.
[0133] Among them, the process of the second device connecting to the first device includes: the first device sends Auth Req to the second device, the first device responds to Auth Req and returns Auth Resp to the second device, the second device sends Assoc Req to the first device in response to receiving the Auth Resp, the first device responds to the Assoc Req and returns Assoc Resp to the second device, the second device performs a 4way-handshake with the first device, and the P2P connection is established.
[0134] It should be noted that the above embodiment is described by taking the example that after the first device and the second device negotiate, the first device is determined to be a GO and the second device is a GC. In another embodiment, when it is determined that the first device is a GC and the second device is a GO, the first device can perform the operations performed by the second device in the above embodiment, and the second device can perform the operations performed by the first device in the above embodiment.
[0135] Figure 5is a block diagram of a device connection apparatus according to an exemplary embodiment, which is configured in a first device, see Figure 5 , the device comprises:
[0136] A first connection establishing module, configured to establish a first communication connection with a second device;
[0137] A negotiation information sending module, configured to send first negotiation information to the second device through the first communication connection, the first negotiation information being used to determine a role of the first device and a role of the second device, the role including a group owner or a group client;
[0138] a configuration information sending module, configured to send configuration information to the second device via the first communication connection in response to determining that the first device is the group owner and the second device is the group client, the configuration information including information required to establish the second communication connection;
[0139] The second connection establishing module is configured to establish a second communication connection with the second device.
[0140] In some embodiments, the apparatus further comprises:
[0141] The device determination module is configured to determine a connectable second device through a short distance communication method.
[0142] In some embodiments, the apparatus further comprises:
[0143] A negotiation information receiving module, configured to receive second negotiation information sent by the second device through the first communication connection, where the second negotiation information is used to determine the role of the first device and the role of the second device;
[0144] The role determination module is configured to determine a role of the first device and a role of the second device based on the first negotiation information and the second negotiation information.
[0145] In some embodiments, the first negotiation information includes at least one of the device type of the first device, the frequency band supported by the first device, and the communication channel supported by the first device, and the second protocol information includes at least one of the device type of the second device, the frequency band supported by the second device, and the communication channel supported by the second device.
[0146] In some embodiments, the second connection establishing module is configured to:
[0147] receiving a connection request sent by a second device;
[0148] In response to the connection request, a second communication connection is established with the second device.
[0149] In some embodiments, the apparatus further comprises:
[0150] The configuration information generating module is configured to generate configuration information, wherein the configuration information at least includes a service set identifier and password information.
[0151] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0152] Figure 6 is a block diagram of another device connection apparatus according to an exemplary embodiment, which is configured in a second device, see Figure 6 , the device comprises:
[0153] A first connection establishing module, configured to establish a first communication connection with a first device;
[0154] A negotiation information sending module, configured to send second negotiation information to the first device through the first communication connection, the second negotiation information being used to determine a role of the first device and a role of the second device, the role including a group owner or a group client;
[0155] a configuration information receiving module, configured to, in response to determining that the first device is the group owner and the second device is the group client, receive configuration information sent by the first device through the first communication connection, the configuration information including information required to establish the second communication connection;
[0156] The second connection establishing module is configured to establish a second communication connection with the first device.
[0157] In some embodiments, the apparatus further comprises:
[0158] The device determination module is configured to determine a connectable first device through a short distance communication method.
[0159] In some embodiments, the apparatus further comprises:
[0160] A negotiation information receiving module, configured to receive first negotiation information sent by a first device through a first communication connection, where the first negotiation information is used to determine a role of the first device and a role of a second device;
[0161] The role determination module is configured to determine a role of the first device and a role of the second device based on the first negotiation information and the second negotiation information.
[0162] In some embodiments, the first negotiation information includes at least one of the device type of the first device, the frequency band supported by the first device, and the communication channel supported by the first device, and the second protocol information includes at least one of the device type of the second device, the frequency band supported by the second device, and the communication channel supported by the second device.
[0163] In some embodiments, the second connection establishing module is configured to:
[0164] Perform channel scanning based on configuration information;
[0165] In response to scanning the first device, a connection request is sent to the first device to establish a second communication connection with the first device.
[0166] In some embodiments, the configuration information includes at least a service set identifier and password information.
[0167] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0168] An embodiment of the present disclosure further provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the device connection method in the above embodiment.
[0169] Figure 7 is a block diagram of an electronic device 700 according to an exemplary embodiment.
[0170] Reference Figure 7 , the electronic device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .
[0171] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0172] The memory 704 is configured to store various types of data to support operations on the electronic device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0173] The power supply component 706 provides power to various components of the electronic device 700. The power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 700.
[0174] The multimedia component 708 includes a screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0175] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.
[0176] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0177] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the electronic device 700. For example, the sensor assembly 714 can detect the open / closed state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700, and the sensor assembly 714 can also detect the position change of the electronic device 700 or a component of the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0178] The communication component 716 is configured to facilitate wired or wireless communication between the electronic device 700 and other devices. The electronic device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0179] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0180] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0181] The embodiments of the present disclosure also provide a non-temporary computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the device connection method in the above embodiments.
[0182] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0183] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A device connection method, applied to a first device, characterized in that: The method comprises: Establishing a first communication connection with a second device; Sending first negotiation information to the second device through the first communication connection, where the first negotiation information is used to determine a role of the first device and a role of the second device, where the roles include a group owner or a group client; In response to determining that the first device is the group owner and the second device is the group client, sending configuration information to the second device through the first communication connection, the configuration information including information required to establish a second communication connection; Establishing the second communication connection with the second device.
2. The method according to claim 1, characterized in that Before establishing the first communication connection with the second device, the method further includes: The second device that can be connected is determined by short-range communication.
3. The method according to claim 1, characterized in that In response to determining that the first device is the group owner and the second device is the group client, before sending configuration information to the second device through the first communication connection, the method further includes: receiving, through the first communication connection, second negotiation information sent by the second device, where the second negotiation information is used to determine a role of the first device and a role of the second device; Based on the first negotiation information and the second negotiation information, a role of the first device and a role of the second device are determined.
4. The method according to claim 3, characterized in that The first negotiation information includes at least one of a device type of the first device, a frequency band supported by the first device, and a communication channel supported by the first device, and the second protocol information includes at least one of a device type of the second device, a frequency band supported by the second device, and a communication channel supported by the second device.
5. The method according to claim 1, characterized in that The establishing the second communication connection with the second device includes: receiving a connection request sent by the second device; In response to the connection request, establishing the second communication connection with the second device.
6. The method according to any one of claims 1 to 5, characterized in that: Before sending the configuration information to the second device through the first communication connection, the method further includes: The configuration information is generated, wherein the configuration information at least includes a service set identifier and password information.
7. A device connection method, applied to a second device, characterized in that: The method comprises: Establishing a first communication connection with a first device; Sending second negotiation information to the first device through the first communication connection, where the second negotiation information is used to determine a role of the first device and a role of the second device, where the roles include a group owner or a group client; In response to determining that the first device is the group owner and the second device is the group client, receiving configuration information sent by the first device through the first communication connection, the configuration information including information required to establish a second communication connection; Establishing the second communication connection with the first device.
8. The method according to claim 7, characterized in that Before establishing the first communication connection with the first device, the method further includes: Determine the first device that can be connected through short-range communication.
9. The method according to claim 7, characterized in that: In response to determining that the first device is the group owner and the second device is the group client, before receiving the configuration information sent by the first device through the first communication connection, the method further includes: receiving, through the first communication connection, first negotiation information sent by the first device, where the first negotiation information is used to determine a role of the first device and a role of the second device; Based on the first negotiation information and the second negotiation information, a role of the first device and a role of the second device are determined.
10. The method according to claim 9, characterized in that The first negotiation information includes at least one of a device type of the first device, a frequency band supported by the first device, and a communication channel supported by the first device, and the second protocol information includes at least one of a device type of the second device, a frequency band supported by the second device, and a communication channel supported by the second device.
11. The method according to claim 7, characterized in that The establishing the second communication connection with the first device includes: Perform channel scanning based on the configuration information; In response to scanning the first device, a connection request is sent to the first device to establish the second communication connection with the first device.
12. The method according to any one of claims 7 to 11, characterized in that The configuration information at least includes a service set identifier and password information.
13. A device connection device, configured on a first device, characterized in that: The device comprises: A first connection establishing module, configured to establish a first communication connection with a second device; a negotiation information sending module, configured to send first negotiation information to the second device through the first communication connection, wherein the first negotiation information is used to determine a role of the first device and a role of the second device, wherein the roles include a group owner or a group client; a configuration information sending module, configured to, in response to determining that the first device is the group owner and the second device is the group client, send configuration information to the second device through the first communication connection, the configuration information including information required to establish a second communication connection; The second connection establishing module is configured to establish the second communication connection with the second device.
14. A device connection state, configured on a second device, characterized in that: The device comprises: A first connection establishing module, configured to establish a first communication connection with a first device; a negotiation information sending module, configured to send second negotiation information to the first device through the first communication connection, wherein the second negotiation information is used to determine a role of the first device and a role of the second device, wherein the roles include a group owner or a group client; a configuration information receiving module, configured to, in response to determining that the first device is the group owner and the second device is the group client, receive configuration information sent by the first device through the first communication connection, the configuration information including information required to establish a second communication connection; The second connection establishing module is configured to establish the second communication connection with the first device.
15. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method according to any one of claims 1 to 6, or the processor is configured to execute the method according to any one of claims 7 to 12.
16. A non-transitory computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as described in any one of claims 1 to 6, or the electronic device is enabled to execute the method as described in any one of claims 7 to 12.